Feat add i18n support (Multi-Language Support) #403
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The main purpose of this pull request is to refactor the application's UI, removing static text to prepare it for multi-language support.
To achieve this, I have integrated the
vue-i18nlibrary, established the necessary infrastructure, and fully dynamized theSetupUI.vuecomponent. Thanks to this new foundation, adding new languages in the future will be as simple as adding a single translation file.Technical Implementation
Installed
vue-i18nLibrary:vue-i18n@nextto the project dependencies, which is fully compatible with the Vue 3 structure.Created Translation Infrastructure:
src/renderer/locales/directory to host translation files.SetupUI.vueinto a key-value format inen.json. This file now serves as the primary template for all future languages.Configured
i18n.ts:src/renderer/i18n.ts. This file:en.json).fallbackLocale: 'en') as the default language if the browser's language is not supported.Integrated into Vue App:
i18ninstance was integrated into the app's main entry point (src/renderer/main.ts) using the.use(i18n)directive, making translation functions available globally.Converted UI to Dynamic Translations:
SetupUI.vuewas replaced with thet('key')function.vue-i18n's parameters and pluralization features.How to Add a New Language
As requested, I am only leaving the English language pack as the base. To add a new language (e.g., German -
de), you just need to follow these steps:en.jsonand createde.jsonin thesrc/renderer/locales/directory.de.jsonand translate the values from English to German, using the keys fromen.jsonas a reference.src/renderer/i18n.tsand make these two small changes:import de from './locales/de.json';messagesobject:de,