diff --git a/apps/client/i18n.js b/apps/client/i18n.js index 7d8f999b3..d74868d19 100644 --- a/apps/client/i18n.js +++ b/apps/client/i18n.js @@ -4,5 +4,5 @@ module.exports = { pages: { "*": ["peppermint"], }, - localeDetection: false, + localeDetection: true, }; diff --git a/apps/docs/pages/translation.md b/apps/docs/pages/translation.md index c4ac78277..69f28ce7c 100644 --- a/apps/docs/pages/translation.md +++ b/apps/docs/pages/translation.md @@ -17,19 +17,21 @@ Before you begin, ensure you have the following: Navigate to the directory where language files are stored. This is typically a folder named `locales` or `i18n`. ```bash - cd path/to/your/project/locales + cd apps/client/locales ``` Create a new file for the language you want to add. For example, to add French, create a file named `fr.json`. ```bash - touch fr.json + touch /fr/peppermint.json ``` 2. **Add Translations** Open the newly created language file and add the necessary translations. Use the existing language files as a reference for the structure. + Copy the contents of the English file and translate it to the new language. + ```json { "welcome": "Bienvenue", @@ -43,22 +45,27 @@ Before you begin, ensure you have the following: If your project has a configuration file for supported languages (e.g., `config.js` or `i18n.js`), add the new language to the list of supported languages. ```javascript - // config/i18n.js - export const supportedLanguages = ['en', 'fr', 'es']; + // i18n.js + export const supportedLanguages = ["en", "fr", "es"]; ``` 4. **Test the New Language** Start your application and switch to the new language to ensure that translations are displayed correctly. This might involve changing a language setting in your application or using a URL parameter. + This requires you to have the application running. + ```bash - npm start + yarn install --legacy-peer-deps + cd apps/api && npm run db:migrate + cd ../../ + yarn dev --filter=client --filter=api ``` Access the application and switch to French: ``` - http://localhost:3000?lang=fr + http://localhost:3000/fr/ ``` 5. **Update Documentation** @@ -91,4 +98,3 @@ If you encounter any issues, consider the following: --- Feel free to reach out to the project maintainers if you have any questions or need further assistance. Happy localizing! -