Combine frontend/backend translation files.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-10-26 22:01:01 -05:00
parent 2d908e3b07
commit bf90348788
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
7 changed files with 5368 additions and 5420 deletions

View File

@ -77,10 +77,10 @@ jobs:
- name: Generate new translations from existing code.
if: github.event_name == 'push' || github.event_name == 'schedule'
run: |
bin/console locale:generate
cd frontend
npm ci
npm run generate-locales
bin/console locale:generate
- name: Pull latest translations.
if: github.event_name == 'push' || github.event_name == 'schedule'

View File

@ -6,6 +6,3 @@ preserve_hierarchy: true
files:
- source: /resources/locale/default.pot
translation: /resources/locale/%locale_with_underscore%.UTF-8/LC_MESSAGES/default.po
- source: /resources/locale/frontend.pot
translation: /resources/locale/%locale_with_underscore%.UTF-8/LC_MESSAGES/frontend.po

View File

@ -2,12 +2,12 @@
"name": "azuracast",
"license": "Apache-2.0",
"scripts": {
"dev": "npm ci && bash",
"dev-build": "npm ci && npm run build",
"build": "gulp",
"generate-locales": "gettext-extract --attribute v-translate --keywords '$gettext' --output ../resources/locale/frontend.pot $(find ./vue -type f -name '*.vue')",
"import-locales": "gettext-compile --output ../resources/locale/translations.json $(find ../resources/locale/*.UTF-8 -type f -name 'frontend.po')",
"ci": "npm run import-locales && npm run build"
"dev": "npm ci && bash",
"dev-build": "npm ci && npm run build",
"build": "gulp",
"generate-locales": "gettext-extract --attribute v-translate --keywords '$gettext' --output ../resources/locale/frontend.pot $(find ./vue -type f -name '*.vue' -o -name '*.js')",
"import-locales": "gettext-compile --output ../resources/locale/translations.json $(find ../resources/locale/*.UTF-8 -type f -name '*.po')",
"ci": "npm run import-locales && npm run build"
},
"dependencies": {
"@babel/core": "^7.15.5",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -21,9 +21,17 @@ class GenerateCommand extends CommandAbstract
): int {
$io->title('Generate Locales');
$dest_file = $environment->getBaseDirectory() . '/resources/locale/default.pot';
$exportDir = $environment->getBaseDirectory() . '/resources/locale';
$dest_file = $exportDir . '/default.pot';
$frontendFile = $exportDir . '/frontend.pot';
$translations = new Translations();
if (file_exists($frontendFile)) {
$translations->addFromPoFile($frontendFile);
}
// Find all PHP/PHTML files in the application's code.
$translatable_folders = [
$environment->getBaseDirectory() . '/src',
@ -44,6 +52,8 @@ class GenerateCommand extends CommandAbstract
$translations->toPoFile($dest_file);
@unlink($frontendFile);
$io->success('Locales generated.');
return 0;
}