You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have any questions or feedbacks on current translations, you can [start a discussion](https://crowdin.com/project/nodejs-website/discussions) by choosing the "New Topic" and your language from the right dropdown, or a [conversation](https://support.crowdin.com/conversations/) by adding your translators.
14
14
@@ -39,3 +39,23 @@ Fill the language object with the following fields:
39
39
|`dateFormat`| The date format. It must be a valid [moment.js format](https://momentjs.com/docs/#/displaying/format/)|`DD.MM.YYYY`|
40
40
|`hrefLang`| The language code in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format |`fr`|
41
41
|`enabled`| If the language is enabled or not |`true`|
42
+
43
+
## Adding new Translation Keys
44
+
45
+
If you're making a new Component and adding Translation Keys for your Component, they should follow these guidelines:
46
+
47
+
- Only add the new translation keys on the `i18n/locales/en.json` file. Crowdin will handle on syncing the files and letting translators know there are new keys to be translated
48
+
- 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`
49
+
- The Translation Key suffix should be easy to undersand 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`
50
+
- Translation Keys should be in Camel Case only.
51
+
- The values of each Translation Key should follow the [ICU Message Syntax](https://formatjs.io/docs/core-concepts/icu-syntax/)
52
+
- All new Translation keys should be added at the bottom of the `i18n/locales/en.json` file. Since this makes it easer for Translators to notice that there are new Translation keys to be translated.
53
+
54
+
### Translations and Unit Testing
55
+
56
+
Translation Keys should not be translated during Unit Testing. If your Component uses, for example `FormattedMessage`, you should provide the `<IntlProvider>` 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:
57
+
58
+
- Unit Testing should test a Component functionality.
59
+
- Unit Tests should not rely on text, titles, or string bags, as these texts will change arbitrarily and make the test suite fail.
60
+
- In this case, you should test your component by aria-text, or other `aria-*` attributes or even by class names or other artifacts.
61
+
- If you want to test how different languages and text appear within a Component, Visual Regression Testing is recommended.
0 commit comments