This commit is contained in:
syuilo 2018-04-16 06:22:28 +09:00
parent 6029b1ca58
commit 53f8428d4d
1 changed files with 2 additions and 8 deletions

View File

@ -7,7 +7,7 @@ import locale from '../../locales';
export default class Replacer { export default class Replacer {
private lang: string; private lang: string;
public pattern = /"%i18n:(.+?)%"|'%i18n:(.+?)%'|%i18n:(.+?)%/g; public pattern = /%i18n:(.+?)%/g;
constructor(lang: string) { constructor(lang: string) {
this.lang = lang; this.lang = lang;
@ -65,12 +65,6 @@ export default class Replacer {
if (ctx && ctx.lang) this.lang = ctx.lang; if (ctx && ctx.lang) this.lang = ctx.lang;
if (match[0] == '"') { return this.get(name, key).replace(/'/g, '\\x27').replace(/"/g, '\\x22');
return '"' + this.get(name, key).replace(/"/g, '\\"') + '"';
} else if (match[0] == "'") {
return '\'' + this.get(name, key).replace(/'/g, '\\\'') + '\'';
} else {
return this.get(name, key);
}
} }
} }