mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-13 17:52:22 +00:00
fix(escaping): global inoffensive apostrophe
This commit is contained in:
parent
30cedad9b2
commit
2b8f94b244
1 changed files with 8 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue