From 14f7ff13ec13e282480e1be779dc25f080cf5f4c Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 09:28:31 +0900 Subject: #491 --- src/build/i18n.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/build/i18n.ts b/src/build/i18n.ts index 6c0f633ad9..212a5837dd 100644 --- a/src/build/i18n.ts +++ b/src/build/i18n.ts @@ -7,7 +7,7 @@ import locale from '../../locales'; export default class Replacer { private lang: string; - public pattern = /%i18n:([a-z0-9_\-@\.\!]+?)%/g; + public pattern = /%i18n:([a-z0-9_\-\.\!]+?)%/g; constructor(lang: string) { this.lang = lang; @@ -53,23 +53,20 @@ export default class Replacer { } } - public replacement(ctx, match, key) { - const client = '/src/client/app/'; - let name = null; + public replacement(match, key) { + let path = null; const shouldEscape = key[0] == '!'; if (shouldEscape) { key = key.substr(1); } - if (key[0] == '@') { - name = ctx.src.substr(ctx.src.indexOf(client) + client.length); - key = key.substr(1); + if (key.indexOf('|') != -1) { + path = key.split('|')[0]; + key = key.split('|')[1]; } - if (ctx && ctx.lang) this.lang = ctx.lang; - - const txt = this.get(name, key); + const txt = this.get(path, key); return shouldEscape ? txt.replace(/'/g, '\\x27').replace(/"/g, '\\x22') -- cgit v1.2.3-freya