Skip to content

Commit 11c44d9

Browse files
committed
fix(translate): coerce input into strings
1 parent bf5276d commit 11c44d9

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/utils/toLocale.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ export default ({
66
const l = $.i18n().locale;
77
$.i18n().locale = locale;
88
try {
9-
const text = $.i18n(id, ...data);
10-
return text;
9+
return $.i18n(`${id}`, ...data);
1110
} catch {
1211
return 'ERROR';
1312
} finally {

src/utils/translate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export function translateText(text, {
3434
}
3535
return temp;
3636
}
37-
return $.i18n(text, ...args);
37+
return $.i18n(`${text}`, ...args);
3838
})();
39-
if (val !== text && typeof val === 'string') return val;
39+
if (val !== text) return val;
4040
}
4141
return fallback;
4242
}

0 commit comments

Comments
 (0)