Skip to content

Commit

Permalink
Merge pull request #1499 from halcyon-tech/fix/locale_no_exist
Browse files Browse the repository at this point in the history
Fix for attempting to use a locale that is not defined
  • Loading branch information
sebjulliand authored Aug 23, 2023
2 parents 49a4d8c + 4f40f07 commit ae88dc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/locale/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function updateLocale() {

export function t(id: string, ...values: any[]) {
// Check for the id in their local locale first, then default to en, then just show the id.
let text = locales[currentLocale][id] ? locales[currentLocale][id] : (locales.en[id] || `!${id}!`);
let text = locales[currentLocale] && locales[currentLocale][id] ? locales[currentLocale][id] : (locales.en[id] || `!${id}!`);

if (values.length > 0) {
values.forEach((value, i) => {
Expand Down

0 comments on commit ae88dc9

Please sign in to comment.