This commit is contained in:
syuilo 2017-03-23 06:31:46 +09:00
parent abb8e021ba
commit d850b157f4
5 changed files with 55 additions and 15 deletions

View file

@ -30,11 +30,11 @@ module.exports = (Object as any).entries(languages).map(([lang, locale]) => {
rules: [
{
enforce: 'pre',
test: /\.*$/,
test: /\.(tag|js)$/,
exclude: /node_modules/,
loader: StringReplacePlugin.replace({
replacements: [
{ pattern: /'i18n:(.+?)'/g, replacement: (_, text) => locale[text] }
{ pattern: /%i18n:(.+?)%/g, replacement: (_, text) => eval('locale' + text.split('.').map(x => `['${x}']`).join('')) }
]
})
},