forked from FoundKeyGang/FoundKey
client: fix null i18n interpolation values
Fixed the occurence that was reported in <FoundKeyGang/FoundKey#317> along with a similar one. Fixes <FoundKeyGang/FoundKey#317> Also changed the i18n code so this should not happen any more in the general case.
This commit is contained in:
parent
a0c2cf328e
commit
35e9d7f958
3 changed files with 3 additions and 3 deletions
|
@ -33,7 +33,7 @@ class I18n<T extends Record<string, any>> {
|
||||||
// Perform string interpolation.
|
// Perform string interpolation.
|
||||||
if (args) {
|
if (args) {
|
||||||
for (const [k, v] of Object.entries(args)) {
|
for (const [k, v] of Object.entries(args)) {
|
||||||
str = str.replace(`{${k}}`, v.toString());
|
str = str.replace(`{${k}}`, v?.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ definePageMetadata(computed(() => note ? {
|
||||||
avatar: note.user,
|
avatar: note.user,
|
||||||
path: `/notes/${note.id}`,
|
path: `/notes/${note.id}`,
|
||||||
share: {
|
share: {
|
||||||
title: i18n.t('noteOf', { user: note.user.name }),
|
title: i18n.t('noteOf', { user: note.user.name || note.user.username }),
|
||||||
text: note.text,
|
text: note.text,
|
||||||
},
|
},
|
||||||
} : null));
|
} : null));
|
||||||
|
|
|
@ -183,7 +183,7 @@ export function getNoteMenu(props: {
|
||||||
|
|
||||||
function share(): void {
|
function share(): void {
|
||||||
navigator.share({
|
navigator.share({
|
||||||
title: i18n.t('noteOf', { user: appearNote.user.name }),
|
title: i18n.t('noteOf', { user: appearNote.user.name || appearNote.user.username }),
|
||||||
text: appearNote.text,
|
text: appearNote.text,
|
||||||
url: `${url}/notes/${appearNote.id}`,
|
url: `${url}/notes/${appearNote.id}`,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue