You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-07-17 01:32:29 +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:
@ -19,6 +19,10 @@
|
|||||||
"baseHref": "",
|
"baseHref": "",
|
||||||
"translation": "src/frontend/translate/messages.cn.xlf"
|
"translation": "src/frontend/translate/messages.cn.xlf"
|
||||||
},
|
},
|
||||||
|
"de": {
|
||||||
|
"baseHref": "",
|
||||||
|
"translation": "src/frontend/translate/messages.de.xlf"
|
||||||
|
},
|
||||||
"es": {
|
"es": {
|
||||||
"baseHref": "",
|
"baseHref": "",
|
||||||
"translation": "src/frontend/translate/messages.es.xlf"
|
"translation": "src/frontend/translate/messages.es.xlf"
|
||||||
|
1
test/frontend/mocha.opts
Normal file
1
test/frontend/mocha.opts
Normal file
@ -0,0 +1 @@
|
|||||||
|
--recursive
|
37
test/frontend/translation.spec.ts
Normal file
37
test/frontend/translation.spec.ts
Normal 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');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
Reference in New Issue
Block a user