From 31231e41f75476699f7e13f7c249a3318aed4eaf Mon Sep 17 00:00:00 2001 From: Jake Low Date: Mon, 28 Oct 2024 15:47:49 -0700 Subject: [PATCH] Move translation files out of src/ --- .tx/config | 4 +-- DEVELOPMENT.md | 2 +- {src/lang => lang}/af.json | 0 {src/lang => lang}/cs_CZ.json | 0 {src/lang => lang}/de.json | 0 {src/lang => lang}/en-US.json | 0 {src/lang => lang}/es.json | 0 {src/lang => lang}/fa_IR.json | 0 {src/lang => lang}/fr.json | 0 {src/lang => lang}/it_IT.json | 0 {src/lang => lang}/ja.json | 0 {src/lang => lang}/ko.json | 0 {src/lang => lang}/nl.json | 0 {src/lang => lang}/pl.json | 0 {src/lang => lang}/pt_BR.json | 0 {src/lang => lang}/pt_PT.json | 0 {src/lang => lang}/ru_RU.json | 0 {src/lang => lang}/sr.json | 0 {src/lang => lang}/tr.json | 0 {src/lang => lang}/uk.json | 0 {src/lang => lang}/vi.json | 0 {src/lang => lang}/zh_TW.json | 0 package.json | 2 +- src/services/User/Locale/Locale.js | 40 +++++++++++++++--------------- src/services/User/Locale/README.md | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) rename {src/lang => lang}/af.json (100%) rename {src/lang => lang}/cs_CZ.json (100%) rename {src/lang => lang}/de.json (100%) rename {src/lang => lang}/en-US.json (100%) rename {src/lang => lang}/es.json (100%) rename {src/lang => lang}/fa_IR.json (100%) rename {src/lang => lang}/fr.json (100%) rename {src/lang => lang}/it_IT.json (100%) rename {src/lang => lang}/ja.json (100%) rename {src/lang => lang}/ko.json (100%) rename {src/lang => lang}/nl.json (100%) rename {src/lang => lang}/pl.json (100%) rename {src/lang => lang}/pt_BR.json (100%) rename {src/lang => lang}/pt_PT.json (100%) rename {src/lang => lang}/ru_RU.json (100%) rename {src/lang => lang}/sr.json (100%) rename {src/lang => lang}/tr.json (100%) rename {src/lang => lang}/uk.json (100%) rename {src/lang => lang}/vi.json (100%) rename {src/lang => lang}/zh_TW.json (100%) diff --git a/.tx/config b/.tx/config index 16843a24f..70234c7e0 100644 --- a/.tx/config +++ b/.tx/config @@ -2,8 +2,8 @@ host = https://www.transifex.com [o:osmlab:p:maproulette3:r:en-us-json] -file_filter = src/lang/.json -source_file = src/lang/en-US.json +file_filter = lang/.json +source_file = lang/en-US.json source_lang = en type = KEYVALUEJSON minimum_perc = 10 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 4b2028538..7f63fe7dd 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -216,7 +216,7 @@ used for creating production builds. Translations for other locales are managed through [transifex](https://www.transifex.com/maproulette/maproulette3), who kindly provides us with free service through their Open Source program. Translation files are -pulled into the code repository from time to time and stored in the `src/lang/` +pulled into the code repository from time to time and stored in the `lang/` directory. Adding support for additional locales is quick and straight-forward: edit diff --git a/src/lang/af.json b/lang/af.json similarity index 100% rename from src/lang/af.json rename to lang/af.json diff --git a/src/lang/cs_CZ.json b/lang/cs_CZ.json similarity index 100% rename from src/lang/cs_CZ.json rename to lang/cs_CZ.json diff --git a/src/lang/de.json b/lang/de.json similarity index 100% rename from src/lang/de.json rename to lang/de.json diff --git a/src/lang/en-US.json b/lang/en-US.json similarity index 100% rename from src/lang/en-US.json rename to lang/en-US.json diff --git a/src/lang/es.json b/lang/es.json similarity index 100% rename from src/lang/es.json rename to lang/es.json diff --git a/src/lang/fa_IR.json b/lang/fa_IR.json similarity index 100% rename from src/lang/fa_IR.json rename to lang/fa_IR.json diff --git a/src/lang/fr.json b/lang/fr.json similarity index 100% rename from src/lang/fr.json rename to lang/fr.json diff --git a/src/lang/it_IT.json b/lang/it_IT.json similarity index 100% rename from src/lang/it_IT.json rename to lang/it_IT.json diff --git a/src/lang/ja.json b/lang/ja.json similarity index 100% rename from src/lang/ja.json rename to lang/ja.json diff --git a/src/lang/ko.json b/lang/ko.json similarity index 100% rename from src/lang/ko.json rename to lang/ko.json diff --git a/src/lang/nl.json b/lang/nl.json similarity index 100% rename from src/lang/nl.json rename to lang/nl.json diff --git a/src/lang/pl.json b/lang/pl.json similarity index 100% rename from src/lang/pl.json rename to lang/pl.json diff --git a/src/lang/pt_BR.json b/lang/pt_BR.json similarity index 100% rename from src/lang/pt_BR.json rename to lang/pt_BR.json diff --git a/src/lang/pt_PT.json b/lang/pt_PT.json similarity index 100% rename from src/lang/pt_PT.json rename to lang/pt_PT.json diff --git a/src/lang/ru_RU.json b/lang/ru_RU.json similarity index 100% rename from src/lang/ru_RU.json rename to lang/ru_RU.json diff --git a/src/lang/sr.json b/lang/sr.json similarity index 100% rename from src/lang/sr.json rename to lang/sr.json diff --git a/src/lang/tr.json b/lang/tr.json similarity index 100% rename from src/lang/tr.json rename to lang/tr.json diff --git a/src/lang/uk.json b/lang/uk.json similarity index 100% rename from src/lang/uk.json rename to lang/uk.json diff --git a/src/lang/vi.json b/lang/vi.json similarity index 100% rename from src/lang/vi.json rename to lang/vi.json diff --git a/src/lang/zh_TW.json b/lang/zh_TW.json similarity index 100% rename from src/lang/zh_TW.json rename to lang/zh_TW.json diff --git a/package.json b/package.json index 43682efbb..487841455 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "vitest": "^2.1.2" }, "scripts": { - "build-intl": "NODE_ENV=production extract-messages -l=en-US -o src/lang/ -d en-US --flat -f json 'src/**/!(*.test).js'", + "build-intl": "NODE_ENV=production extract-messages -l=en-US -o lang/ -d en-US --flat -f json 'src/**/!(*.test).js'", "update-layers": "node scripts/update_layers.js", "update-layers-prod": "NODE_ENV=production node scripts/update_layers.js", "start-js": "vite", diff --git a/src/services/User/Locale/Locale.js b/src/services/User/Locale/Locale.js index 6d250237a..24aca879a 100644 --- a/src/services/User/Locale/Locale.js +++ b/src/services/User/Locale/Locale.js @@ -44,102 +44,102 @@ export const Locale = Object.freeze(Object.keys(unsortedLocale).sort().reduce( const LocaleImports = { [Locale.enUS]: () => Promise.all([ - import("../../../lang/en-US.json"), + import("../../../../lang/en-US.json"), import("@formatjs/intl-relativetimeformat/locale-data/en"), ]), [Locale.es]: () => Promise.all([ - import("../../../lang/es.json"), + import("../../../../lang/es.json"), import("@formatjs/intl-relativetimeformat/locale-data/es"), ]), [Locale.fr]: () => Promise.all([ - import("../../../lang/fr.json"), + import("../../../../lang/fr.json"), import("@formatjs/intl-relativetimeformat/locale-data/fr"), ]), [Locale.de]: () => Promise.all([ - import("../../../lang/de.json"), + import("../../../../lang/de.json"), import("@formatjs/intl-relativetimeformat/locale-data/de"), ]), [Locale.it]: () => Promise.all([ - import("../../../lang/it_IT.json"), + import("../../../../lang/it_IT.json"), import("@formatjs/intl-relativetimeformat/locale-data/it"), ]), [Locale.af]: () => Promise.all([ - import("../../../lang/af.json"), + import("../../../../lang/af.json"), import("@formatjs/intl-relativetimeformat/locale-data/af"), ]), [Locale.ja]: () => Promise.all([ - import("../../../lang/ja.json"), + import("../../../../lang/ja.json"), import("@formatjs/intl-relativetimeformat/locale-data/ja"), ]), [Locale.ko]: () => Promise.all([ - import("../../../lang/ko.json"), + import("../../../../lang/ko.json"), import("@formatjs/intl-relativetimeformat/locale-data/ko"), ]), [Locale.nl]: () => Promise.all([ - import("../../../lang/nl.json"), + import("../../../../lang/nl.json"), import("@formatjs/intl-relativetimeformat/locale-data/nl"), ]), [Locale.uk]: () => Promise.all([ - import("../../../lang/uk.json"), + import("../../../../lang/uk.json"), import("@formatjs/intl-relativetimeformat/locale-data/uk"), ]), [Locale.vi]: () => Promise.all([ - import("../../../lang/vi.json"), + import("../../../../lang/vi.json"), import("@formatjs/intl-relativetimeformat/locale-data/vi"), ]), [Locale["pt-BR"]]: () => Promise.all([ - import("../../../lang/pt_BR.json"), + import("../../../../lang/pt_BR.json"), import("@formatjs/intl-relativetimeformat/locale-data/pt"), ]), [Locale["pt-PT"]]: () => Promise.all([ - import("../../../lang/pt_PT.json"), + import("../../../../lang/pt_PT.json"), import("@formatjs/intl-relativetimeformat/locale-data/pt"), ]), [Locale["cs-CZ"]]: () => Promise.all([ - import("../../../lang/cs_CZ.json"), + import("../../../../lang/cs_CZ.json"), import("@formatjs/intl-relativetimeformat/locale-data/cs"), ]), [Locale["fa-IR"]]: () => Promise.all([ - import("../../../lang/fa_IR.json"), + import("../../../../lang/fa_IR.json"), import("@formatjs/intl-relativetimeformat/locale-data/fa"), ]), [Locale["ru-RU"]]: () => Promise.all([ - import("../../../lang/ru_RU.json"), + import("../../../../lang/ru_RU.json"), import("@formatjs/intl-relativetimeformat/locale-data/ru"), ]), [Locale.tr]: () => Promise.all([ - import("../../../lang/tr.json"), + import("../../../../lang/tr.json"), import("@formatjs/intl-relativetimeformat/locale-data/tr"), ]), [Locale.sr]: () => Promise.all([ - import("../../../lang/sr.json"), + import("../../../../lang/sr.json"), import("@formatjs/intl-relativetimeformat/locale-data/sr"), ]), [Locale.pl]: () => Promise.all([ - import("../../../lang/pl.json"), + import("../../../../lang/pl.json"), import("@formatjs/intl-relativetimeformat/locale-data/pl"), ]), [Locale["zh-TW"]]: () => Promise.all([ - import("../../../lang/zh_TW.json"), + import("../../../../lang/zh_TW.json"), import("@formatjs/intl-relativetimeformat/locale-data/zh"), ]), }; diff --git a/src/services/User/Locale/README.md b/src/services/User/Locale/README.md index 579cd1192..cef0c80ea 100644 --- a/src/services/User/Locale/README.md +++ b/src/services/User/Locale/README.md @@ -21,7 +21,7 @@ decisions it does, the config file is a good place to start. ### Pulling the latest translation files from Transifex -Updated and new translation files will be pulled into the `src/lang/` +Updated and new translation files will be pulled into the `lang/` directory. They should then be added and committed to the source repo like normal.