Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/modules/includes/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const lookup = (path, refLocale) => {
for (let i = 0; i < locales.length; i++) {
const locale = locales[i];
const message = getMessageFromDictionary(locale, path);
if (message) {
if (message !== null) {
// Used the requested locale as the cache key
// Ex: { en: { title: "Title" }}
// lookup('title', 'en-GB') should cache with 'en-GB' instead of 'en'
Expand Down
2 changes: 1 addition & 1 deletion dist/modules/stores/dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function getMessageFromDictionary(locale, id) {
let tmpDict = localeDictionary;
for (let i = 0; i < ids.length; i++) {
if (typeof tmpDict[ids[i]] !== 'object') {
return tmpDict[ids[i]] || null;
return tmpDict[ids[i]] ?? null;
}
tmpDict = tmpDict[ids[i]];
}
Expand Down
2 changes: 1 addition & 1 deletion src/includes/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const lookup = (path: string, refLocale: string) => {
const locale = locales[i];
const message = getMessageFromDictionary(locale, path);

if (message) {
if (message !== null) {
// Used the requested locale as the cache key
// Ex: { en: { title: "Title" }}
// lookup('title', 'en-GB') should cache with 'en-GB' instead of 'en'
Expand Down
2 changes: 1 addition & 1 deletion src/stores/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function getMessageFromDictionary(locale: string, id: string) {
let tmpDict: any = localeDictionary
for (let i = 0; i < ids.length; i++) {
if (typeof tmpDict[ids[i]] !== 'object') {
return (tmpDict[ids[i]] as LocaleDictionaryValue) || null
return (tmpDict[ids[i]] as LocaleDictionaryValue) ?? null
}
tmpDict = tmpDict[ids[i]];
}
Expand Down