feat: i18n user interface (#40306)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@ -1,14 +1,18 @@
|
||||
const path = require('path');
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
|
||||
|
||||
const supportedLangs = ['chinese', 'english'];
|
||||
const {
|
||||
curriculum: curriculumLangs
|
||||
} = require('../client/i18n/allLangs').availableLangs;
|
||||
|
||||
// const supportedLangs = ['chinese', 'english'];
|
||||
|
||||
exports.testedLang = function testedLang() {
|
||||
if (process.env.LOCALE) {
|
||||
if (supportedLangs.includes(process.env.LOCALE)) {
|
||||
return process.env.LOCALE;
|
||||
if (process.env.CURRICULUM_LOCALE) {
|
||||
if (curriculumLangs.includes(process.env.CURRICULUM_LOCALE)) {
|
||||
return process.env.CURRICULUM_LOCALE;
|
||||
} else {
|
||||
throw Error(`${process.env.LOCALE} is not a supported language.
|
||||
throw Error(`${process.env.CURRICULUM_LOCALE} is not a supported language.
|
||||
Before the site can be built, this language needs to be manually approved`);
|
||||
}
|
||||
} else {
|
||||
@ -16,4 +20,4 @@ exports.testedLang = function testedLang() {
|
||||
}
|
||||
};
|
||||
|
||||
exports.supportedLangs = supportedLangs;
|
||||
// exports.supportedLangs = supportedLangs;
|
||||
|
Reference in New Issue
Block a user