Added more comments for create help a new namespace

This commit is contained in:
Adrian 2024-10-09 15:43:36 -04:00
parent 304785a553
commit e63157717d
2 changed files with 7 additions and 2 deletions

View File

@ -130,7 +130,9 @@ export async function initI18n(): Promise<void> {
* Don't forget to declare new language in `supportedLngs` i18next initializer * Don't forget to declare new language in `supportedLngs` i18next initializer
* *
* Q: How do I add a new namespace? * Q: How do I add a new namespace?
* A: To add a new namespace, create a new file in each language folder with the translations. * A: To add a new namespace, create a new file .json in each language folder with the translations.
* The expected format for the files is kebab-case {@link https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case}
* If you want the namespace name to be different from the file name, configure it in namespacemap.ts.
* Then update the config file for that language in its locale directory * Then update the config file for that language in its locale directory
* and the CustomTypeOptions interface in the @types/i18next.d.ts file. * and the CustomTypeOptions interface in the @types/i18next.d.ts file.
* *

View File

@ -1,6 +1,9 @@
// When changing the file, the server restarts because of the namespaces-18n-plugin.ts // When changing the file, the server restarts because of the namespaces-18n-plugin.ts
/** maps namespaces that deviate from the file-name */ /**
* ### maps namespaces that deviate from the file-name
* @description expects file-name as value and custom-namespace as key
* */
export const namespaceMap = { export const namespaceMap = {
titles: "trainer-titles", titles: "trainer-titles",
moveTriggers: "move-trigger", moveTriggers: "move-trigger",