diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-05-17 09:28:31 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-05-17 09:28:31 +0900 |
| commit | 14f7ff13ec13e282480e1be779dc25f080cf5f4c (patch) | |
| tree | 3aefb607509d386ad8d838c154783a14dd37e13b /src | |
| parent | Merge pull request #1589 from rinsuki/fix/1428 (diff) | |
| download | sharkey-14f7ff13ec13e282480e1be779dc25f080cf5f4c.tar.gz sharkey-14f7ff13ec13e282480e1be779dc25f080cf5f4c.tar.bz2 sharkey-14f7ff13ec13e282480e1be779dc25f080cf5f4c.zip | |
#491
Diffstat (limited to 'src')
| -rw-r--r-- | src/build/i18n.ts | 17 |
1 files changed, 7 insertions, 10 deletions
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') |