Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ module.exports = {

// Supported languages.
langs: [
'af', 'ar', 'bg', 'bn-BD', 'ca', 'cs', 'da', 'de', 'dbl', 'dbr', 'el',
'en-GB', 'en-US', 'es', 'eu', 'fa', 'fi', 'fr', 'ga-IE', 'he', 'hu', 'id',
'af', 'ar', 'bg', 'bn-BD', 'ca', 'cs', 'da', 'de', 'dbl', 'dbr', 'dsb', 'el',
'en-GB', 'en-US', 'es', 'eu', 'fa', 'fi', 'fr', 'ga-IE', 'he', 'hsb', 'hu', 'id',
'it', 'ja', 'ko', 'mk', 'mn', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sk',
'sl', 'sq', 'sv-SE', 'uk', 'vi', 'zh-CN', 'zh-TW',
],
Expand Down
28 changes: 28 additions & 0 deletions tests/server/TestLocalesConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import fs from 'fs';
import { assert } from 'chai';
import path from 'path';
import config from 'config';
import { langToLocale, localeToLang } from 'core/i18n/utils';
import glob from 'glob';

const langs = config.get('langs');
const basePath = config.get('basePath');

describe('Locale Config', () => {
for (const lang of langs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use langs.forEach(() => { you should be able to avoid the warning. I don't think there's a bug here but it's probably safer. Same for below.

// eslint-disable no-loop-func
it(`should have a corresponding ${lang} dir in locale`, () =>
fs.lstatSync(path.join(basePath, 'locale', langToLocale(lang))));
}

for (const localeDir of glob.sync('locale/*')) {
const locale = path.basename(localeDir);
const lang = localeToLang(locale);
if (locale === 'templates') {
continue;
}
// eslint-disable no-loop-func
it(`should have a corresponding ${lang} entry the locale dir in the config`, () =>
assert.include(langs, lang, `Should be a "${lang}" entry in config.langs`));
}
});