diff --git a/TRANSLATION.md b/TRANSLATION.md index 6bd2c8d9772a..f94f9152dcdd 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -44,7 +44,7 @@ Fill the language object with the following fields: | `hrefLang` | The language code in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format | `fr` | | `enabled` | If the language is enabled or not | `true` | -Please also add the new locale file to the locales folder `/i18n/locales` and import it in the `/i18n/locales/index.mjs` file. +Please also add the new locale file to the locales folder `/i18n/locales`. ## Adding new Translation Keys @@ -54,7 +54,7 @@ If you're making a new Component and adding Translation Keys for your Component, - The translation keys should have the prefix as the canonical path of your Component. If your Component is `components/Common/MyComponent` the prefix key should be `components.common.myComponent` - The Translation Key suffix should be easy to understand and semantic. For example, if the key is about "the text of a button that when interacted it copies content to the clipboard", the suffix should probably be `copyButton.title`. The final translation key would be `components.common.myComponent.copyButton.title` - Translation Keys should be in Camel Case only. - - The values of each Translation Key should follow the [ICU Message Syntax](https://formatjs.io/docs/core-concepts/icu-syntax/) + - The values of each Translation Key should follow the [ICU Message Syntax](https://next-intl-docs.vercel.app/docs/usage/messages#rendering-icu-messages) - All new Translation keys should be added at the bottom of the `i18n/locales/en.json` file. Since this makes it easier for Translators to notice that there are new Translation keys to be translated. #### Notes about Translation Keys @@ -77,7 +77,7 @@ It's important to mention that we use nested translation keys within the Locale ### Translations and Unit Testing -Translation Keys should not be translated during Unit Testing. If your Component uses, for example `usTranslations`, you should provide the `` surrounding your `testing-library` render logic, or you can create a wrapper for your test. Note that you should not import the English messages to your Unit Test as: +Translation Keys should not be translated during Unit Testing. If your Component uses, for example `useTranslations`, you should provide the `` surrounding your `testing-library` render logic, or you can create a wrapper for your test. Note that you should not import the English messages to your Unit Test as: - Unit Testing should test a Component functionality. - Unit Tests should not rely on text, titles, or string bags, as these texts will change arbitrarily and make the test suite fail. diff --git a/components/Common/ThemeToggle/index.tsx b/components/Common/ThemeToggle/index.tsx index 9696c945f211..ac2f06fefc8f 100644 --- a/components/Common/ThemeToggle/index.tsx +++ b/components/Common/ThemeToggle/index.tsx @@ -11,7 +11,7 @@ type ThemeToggleProps = { const ThemeToggle: FC = ({ onClick = () => {} }) => { const t = useTranslations(); - const ariaLabel = t('components.header.buttons.toggleTheme'); + const ariaLabel = t('components.common.themeToggle.label'); return (