1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-11-28 08:58:49 +02:00

Adding german language to angular.json. Also adding test to catch these errors in the future fixes #428

This commit is contained in:
Patrik J. Braun 2022-02-26 18:38:29 +01:00
parent 8469903189
commit 667160f4f8
3 changed files with 42 additions and 0 deletions

View File

@ -19,6 +19,10 @@
"baseHref": "",
"translation": "src/frontend/translate/messages.cn.xlf"
},
"de": {
"baseHref": "",
"translation": "src/frontend/translate/messages.de.xlf"
},
"es": {
"baseHref": "",
"translation": "src/frontend/translate/messages.es.xlf"

1
test/frontend/mocha.opts Normal file
View File

@ -0,0 +1 @@
--recursive

View File

@ -0,0 +1,37 @@
import {ProjectPath} from '../../src/backend/ProjectPath';
import {promises as fsp} from 'fs';
const chai = require('chai');
import path = require('path');
const {expect} = chai;
// to help WebStorm to handle the test cases
declare let describe: any;
describe('UI', () => {
it('translation should be listed in the angular.json', async () => {
const base = path.join('src', 'frontend', 'translate');
const translations = await fsp.readdir(path.join(ProjectPath.Root, base));
const angularConfig = require(path.join(ProjectPath.Root, 'angular.json'));
const knownTranslations = angularConfig.projects.pigallery2.i18n.locales;
for (const t of translations) {
const lang = t.substr(t.indexOf('.') + 1, 2);
if (lang === 'en') {
continue; // no need to add 'en' as it is the default language.
}
const translationPath = path.join(base, t).replace(new RegExp('\\\\', 'g'), '/');
expect(knownTranslations[lang]).to.deep.equal({
baseHref: '',
translation: translationPath
}, translationPath + ' should be added to angular.json');
}
});
});