Skip to content

Commit

Permalink
Fix for attempting to use a locale that is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
worksofliam committed Aug 23, 2023
1 parent 49a4d8c commit 4f40f07
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 4f40f07

Please sign in to comment.