Combine frontend/backend translation files.
This commit is contained in:
parent
2d908e3b07
commit
bf90348788
|
@ -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'
|
||||
|
|
|
@ -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
|
|
@ -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
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue