fix(escaping): global inoffensive apostrophe

This commit is contained in:
Sabe Jones 2020-08-15 10:27:37 -05:00
parent 30cedad9b2
commit 2b8f94b244

View file

@ -1,5 +1,6 @@
import isString from 'lodash/isString';
import clone from 'lodash/clone';
import forEach from 'lodash/forEach';
import template from 'lodash/template';
const i18n = {
@ -36,9 +37,16 @@ function t (stringName) {
const clonedVars = clone(vars) || {};
forEach(clonedVars, (val, key) => {
if (typeof clonedVars[key] === 'string') {
clonedVars[key] = clonedVars[key].replace(/'/g, '');
}
});
clonedVars.locale = locale;
if (string) {
string = string.replace(/'/g, '');
try {
return template(string)(clonedVars);
} catch (_error) {