diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 867eb0c62..0954a4e6d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -83,6 +83,7 @@ jobs:
run: pnpm recursive install --frozen-lockfile --ignore-scripts
- name: Lint
run: pnpm format:check
+
build:
runs-on: ubuntu-latest
name: build
@@ -101,6 +102,12 @@ jobs:
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install
run: pnpm recursive install --frozen-lockfile --ignore-scripts
+ - name: crowdin download
+ env:
+ CROWDIN_VERDACCIO_PROJECT_ID: ${{ secrets.CROWDIN_VERDACCIO_PROJECT_ID }}
+ CROWDIN_VERDACCIO_API_KEY: ${{ secrets.CROWDIN_VERDACCIO_API_KEY }}
+ CONTEXT: production
+ run: pnpm crowdin:download
- name: build
run: pnpm build
- name: tar packages
diff --git a/.gitignore b/.gitignore
index d3a7a357b..faf68fe8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,8 @@ packages/standalone/dist/
packages/plugins/ui-theme/static
/packages/plugins/ui-theme/src/i18n/crowdin/*
!/packages/plugins/ui-theme/src/i18n/crowdin/en-US.json
+!/packages/plugins/ui-theme/src/i18n/crowdin/*.md
+
# CI Pnpm cache
.pnpm-store/
diff --git a/packages/plugins/ui-theme/src/App/Header/Header.test.tsx b/packages/plugins/ui-theme/src/App/Header/Header.test.tsx
index ddfde9e10..6b5e15ab6 100644
--- a/packages/plugins/ui-theme/src/App/Header/Header.test.tsx
+++ b/packages/plugins/ui-theme/src/App/Header/Header.test.tsx
@@ -10,7 +10,7 @@ import {
} from 'verdaccio-ui/utils/test-react-testing-library';
import { AppContextProvider } from '../../App';
-import translationEN from '../../i18n/translations/en-US.json';
+import translationEN from '../../i18n/crowdin/en-US.json';
import Header from './Header';
diff --git a/packages/plugins/ui-theme/src/i18n/config.ts b/packages/plugins/ui-theme/src/i18n/config.ts
index 91f6874f0..1201d84b0 100644
--- a/packages/plugins/ui-theme/src/i18n/config.ts
+++ b/packages/plugins/ui-theme/src/i18n/config.ts
@@ -8,9 +8,27 @@ import {
listLanguagesAsString,
} from './enabledLanguages';
+/**
+ * In development mode translations files might be not available,
+ * crowdin translations are only available in CI.
+ */
+function loadTranslationFile(lng) {
+ try {
+ return require(`./crowdin/${lng}/en-US.json`);
+ } catch {
+ // eslint-disable-next-line no-console
+ console.error(`language ${lng} file not found, fallback to en-US`);
+ // in case the file is not there, fallback to en-US
+ return require(`./crowdin/en-US.json`);
+ }
+}
+
const languages = listLanguages.reduce((acc, item: LanguageConfiguration) => {
acc[item.lng] = {
- translation: require(`./translations/${item.lng}.json`),
+ translation:
+ item.lng === DEFAULT_LANGUAGE
+ ? require(`./crowdin/en-US.json`)
+ : loadTranslationFile(item.lng),
};
return acc;
}, {});
diff --git a/packages/plugins/ui-theme/src/i18n/crowdin/ABOUT_TRANSLATIONS.md b/packages/plugins/ui-theme/src/i18n/crowdin/ABOUT_TRANSLATIONS.md
new file mode 100644
index 000000000..e251a9949
--- /dev/null
+++ b/packages/plugins/ui-theme/src/i18n/crowdin/ABOUT_TRANSLATIONS.md
@@ -0,0 +1,13 @@
+## Translate UI Strings
+
+If you are willing to translate User Interfances strings, are located in the `crowdin` project which is available [here](https://crowdin.com/project/verdaccio) at `packages/plugins/src/i18n/crowdin/en-US.json`.
+
+### Requirements
+
+- Need a crowdin account, use your GitHub account for fast access as an option.
+
+### Adding a new language to the UI
+
+- If the language is not available, ask in the Discord channel to enable it, that will be pretty fast.
+- After you have translated the strings, add to `packages/plugins/ui-theme/src/i18n/enabledLanguages.ts` the configuration for the new language.
+- In development mode the file must not be available since you need admin credentials to download translations, as a work around, create a folder withing the `crowdin` folder eg: `/packages/plugins/ui-theme/src/i18n/crowdin/fr-FR/en-US.json` and then will be available for testing. If the language is not found, will fallback to `en-US`.
diff --git a/packages/plugins/ui-theme/src/i18n/translations/cs-CZ.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/cs-CZ.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/cs-CZ.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/cs-CZ.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/de-DE.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/de-DE.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/de-DE.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/de-DE.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/en-US.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/en-US.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/en-US.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/en-US.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/es-ES.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/es-ES.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/es-ES.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/es-ES.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/fr-FR.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/fr-FR.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/fr-FR.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/fr-FR.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/ja-JP.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/ja-JP.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/ja-JP.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/ja-JP.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/km-KH.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/km-KH.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/km-KH.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/km-KH.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/pt-BR.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/pt-BR.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/pt-BR.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/pt-BR.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/ru-RU.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/ru-RU.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/ru-RU.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/ru-RU.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/tr-TR.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/tr-TR.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/tr-TR.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/tr-TR.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/uk-UA.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/uk-UA.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/uk-UA.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/uk-UA.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/zh-CN.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/zh-CN.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/zh-CN.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/zh-CN.json
diff --git a/packages/plugins/ui-theme/src/i18n/translations/zh-TW.json b/packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/zh-TW.json
similarity index 100%
rename from packages/plugins/ui-theme/src/i18n/translations/zh-TW.json
rename to packages/plugins/ui-theme/src/i18n/deprecated_translations_dont_use/zh-TW.json
diff --git a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.test.tsx b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.test.tsx
index fae607df1..b109bbf17 100644
--- a/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.test.tsx
+++ b/packages/plugins/ui-theme/src/pages/Version/DetailContainer/Versions/Versions.test.tsx
@@ -3,7 +3,7 @@ import { MemoryRouter } from 'react-router-dom';
import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library';
-import translationEN from '../../../../i18n/translations/en-US.json';
+import translationEN from '../../../../i18n/crowdin/en-US.json';
import { DetailContext } from '../../context';
import { DetailContextProps } from '../../version-config';
diff --git a/packages/plugins/ui-theme/src/pages/Version/Version.test.tsx b/packages/plugins/ui-theme/src/pages/Version/Version.test.tsx
index 5d5e0f3b6..04b5e8def 100644
--- a/packages/plugins/ui-theme/src/pages/Version/Version.test.tsx
+++ b/packages/plugins/ui-theme/src/pages/Version/Version.test.tsx
@@ -4,7 +4,7 @@ import { MemoryRouter } from 'react-router';
import { render } from 'verdaccio-ui/utils/test-react-testing-library';
-import translationEN from '../../i18n/translations/en-US.json';
+import translationEN from '../../i18n/crowdin/en-US.json';
import data from './__partials__/data.json';
import { DetailContext } from './context';
diff --git a/packages/plugins/ui-theme/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap b/packages/plugins/ui-theme/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap
index 2dd31e72d..a47cf7ec3 100644
--- a/packages/plugins/ui-theme/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap
+++ b/packages/plugins/ui-theme/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap
@@ -133,7 +133,7 @@ exports[`