|
@@ -8,6 +8,10 @@ const pathUtils = require('growi-commons').pathUtils;
|
|
|
const md5 = require('md5');
|
|
const md5 = require('md5');
|
|
|
const entities = require('entities');
|
|
const entities = require('entities');
|
|
|
|
|
|
|
|
|
|
+const { getLocaleAliasToIdMap } = require('@commons/util/locale-utils');
|
|
|
|
|
+
|
|
|
|
|
+const aliasToIdMap = getLocaleAliasToIdMap();
|
|
|
|
|
+
|
|
|
module.exports = (crowi) => {
|
|
module.exports = (crowi) => {
|
|
|
const { configManager, appService } = crowi;
|
|
const { configManager, appService } = crowi;
|
|
|
|
|
|
|
@@ -154,6 +158,15 @@ module.exports = (crowi) => {
|
|
|
return list.slice(start, end);
|
|
return list.slice(start, end);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * convert locale alias to corrent locale id for backward compatibility -- 2020.06.21 Yuki Takei
|
|
|
|
|
+ */
|
|
|
|
|
+ swig.setFilter('convertOldLangPropertyToLocaleId', (user) => {
|
|
|
|
|
+ const { lang: userLang } = user;
|
|
|
|
|
+ user.lang = aliasToIdMap[userLang] || userLang;
|
|
|
|
|
+ return user;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
next();
|
|
next();
|
|
|
};
|
|
};
|
|
|
};
|
|
};
|