Skip to content

Commit 4d81fca

Browse files
committed
chore: cleanup toLocale
1 parent 8309d7f commit 4d81fca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/utils/toLocale.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ export default ({
55
}) => {
66
const l = $.i18n().locale;
77
$.i18n().locale = locale;
8-
let text;
98
try {
10-
text = $.i18n(id, ...data);
9+
const text = $.i18n(id, ...data);
10+
return text;
1111
} catch {
12-
text = 'ERROR';
12+
return 'ERROR';
13+
} finally {
14+
$.i18n().locale = l;
1315
}
14-
$.i18n().locale = l;
15-
return text;
1616
};

0 commit comments

Comments
 (0)