Treat falsy values as valid for i18n placeholders & fix groups in common message
This commit is contained in:
parent
476006af96
commit
fdaaa531b3
3 changed files with 21 additions and 6 deletions
|
@ -4430,8 +4430,16 @@
|
||||||
},
|
},
|
||||||
"ConversationDetailsGroups--title": {
|
"ConversationDetailsGroups--title": {
|
||||||
"message": "$number$ groups in common",
|
"message": "$number$ groups in common",
|
||||||
|
"description": "(deleted 2023/01/03) Title of the groups-in-common panel, in the contact details"
|
||||||
|
},
|
||||||
|
"icu:ConversationDetailsGroups--title": {
|
||||||
|
"messageformat": "{count, plural, one {1 group} other {# groups}} in common",
|
||||||
"description": "Title of the groups-in-common panel, in the contact details"
|
"description": "Title of the groups-in-common panel, in the contact details"
|
||||||
},
|
},
|
||||||
|
"icu:ConversationDetailsGroups--title--with-zero-groups-in-common": {
|
||||||
|
"messageformat": "No groups in common",
|
||||||
|
"description": "Title of the groups-in-common panel, in the contact details, with zero groups in common"
|
||||||
|
},
|
||||||
"ConversationDetailsGroups--add-to-group": {
|
"ConversationDetailsGroups--add-to-group": {
|
||||||
"message": "Add to a group",
|
"message": "Add to a group",
|
||||||
"description": "The button shown on a conversation details (for a direct contact) that you can click to add that contact to groups"
|
"description": "The button shown on a conversation details (for a direct contact) that you can click to add that contact to groups"
|
||||||
|
|
|
@ -37,9 +37,15 @@ export function ConversationDetailsGroups({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PanelSection
|
<PanelSection
|
||||||
title={i18n('ConversationDetailsGroups--title', {
|
title={
|
||||||
number: groupsInCommon.length,
|
groupsInCommon.length > 0
|
||||||
})}
|
? i18n('icu:ConversationDetailsGroups--title', {
|
||||||
|
count: groupsInCommon.length,
|
||||||
|
})
|
||||||
|
: i18n(
|
||||||
|
'icu:ConversationDetailsGroups--title--with-zero-groups-in-common'
|
||||||
|
)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<PanelRow
|
<PanelRow
|
||||||
icon={<div className="ConversationDetails-groups__add-to-group-icon" />}
|
icon={<div className="ConversationDetails-groups__add-to-group-icon" />}
|
||||||
|
|
|
@ -145,13 +145,14 @@ export function setupI18n(
|
||||||
}
|
}
|
||||||
|
|
||||||
const placeholderName = match[1];
|
const placeholderName = match[1];
|
||||||
const value = substitutions[placeholderName];
|
let value = substitutions[placeholderName];
|
||||||
if (!value) {
|
if (value == null) {
|
||||||
log.error(
|
log.error(
|
||||||
`i18n: Value not provided for placeholder ${placeholderName} in key '${key}'`
|
`i18n: Value not provided for placeholder ${placeholderName} in key '${key}'`
|
||||||
);
|
);
|
||||||
|
value = '';
|
||||||
}
|
}
|
||||||
builder += value || '';
|
builder += value;
|
||||||
|
|
||||||
lastTextIndex = FIND_REPLACEMENTS.lastIndex;
|
lastTextIndex = FIND_REPLACEMENTS.lastIndex;
|
||||||
match = FIND_REPLACEMENTS.exec(message);
|
match = FIND_REPLACEMENTS.exec(message);
|
||||||
|
|
Loading…
Add table
Reference in a new issue