fix: Move copying translation files before npm run build in Docker (#30099)

This commit is contained in:
Martyn Gigg
2024-09-16 21:43:11 +01:00
committed by GitHub
parent 2166cbdd80
commit 46b1d869b1
3 changed files with 34 additions and 18 deletions

View File

@@ -45,10 +45,10 @@ const ROOT_DIR = path.resolve(__dirname, '..');
const TRANSLATIONS_DIR = path.resolve(__dirname, '../superset/translations');
const getAvailableTranslationCodes = () => {
const LOCALE_CODE_MAPPING = {
zh: 'zh-cn',
};
try {
if (process.env.BUILD_TRANSLATIONS === 'true') {
const LOCALE_CODE_MAPPING = {
zh: 'zh-cn',
};
const files = fs.readdirSync(TRANSLATIONS_DIR);
return files
.filter(file =>
@@ -57,10 +57,9 @@ const getAvailableTranslationCodes = () => {
.filter(dirName => !dirName.startsWith('__'))
.map(dirName => dirName.replace('_', '-'))
.map(dirName => LOCALE_CODE_MAPPING[dirName] || dirName);
} catch (err) {
console.error('Error reading the directory:', err);
return [];
}
// Indicates to the MomentLocalesPlugin that we only want to keep 'en'.
return [];
};
const {