Re-key all |zero-pluralised translations for Localazy compatibility (#11417)
* Re-key all |zero-pluralised translations for Localazy compatibility * Add missing interpolation variable * i18n * Add test coverage * Improve coverage
This commit is contained in:
parent
a5107518b5
commit
6b14ecfdf9
51 changed files with 270 additions and 158 deletions
|
@ -107,11 +107,18 @@ export default class UploadBar extends React.PureComponent<IProps, IState> {
|
|||
return null;
|
||||
}
|
||||
|
||||
// MUST use var name 'count' for pluralization to kick in
|
||||
const uploadText = _t("Uploading %(filename)s and %(count)s others", {
|
||||
filename: this.state.currentFile,
|
||||
count: this.state.countFiles - 1,
|
||||
});
|
||||
let uploadText: string;
|
||||
if (this.state.countFiles > 1) {
|
||||
// MUST use var name 'count' for pluralization to kick in
|
||||
uploadText = _t("Uploading %(filename)s and %(count)s others", {
|
||||
filename: this.state.currentFile,
|
||||
count: this.state.countFiles - 1,
|
||||
});
|
||||
} else {
|
||||
uploadText = _t("Uploading %(filename)s", {
|
||||
filename: this.state.currentFile,
|
||||
});
|
||||
}
|
||||
|
||||
const uploadSize = fileSize(this.state.currentTotal!);
|
||||
return (
|
||||
|
|
|
@ -76,16 +76,26 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
|
|||
<h2>{_t("Room status")}</h2>
|
||||
<ul>
|
||||
<li>
|
||||
{_t(
|
||||
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>",
|
||||
{
|
||||
status: humanReadableNotificationColor(color),
|
||||
count,
|
||||
},
|
||||
{
|
||||
strong: (sub) => <strong>{sub}</strong>,
|
||||
},
|
||||
)}
|
||||
{count > 0
|
||||
? _t(
|
||||
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>",
|
||||
{
|
||||
status: humanReadableNotificationColor(color),
|
||||
count,
|
||||
},
|
||||
{
|
||||
strong: (sub) => <strong>{sub}</strong>,
|
||||
},
|
||||
)
|
||||
: _t(
|
||||
"Room unread status: <strong>%(status)s</strong>",
|
||||
{
|
||||
status: humanReadableNotificationColor(color),
|
||||
},
|
||||
{
|
||||
strong: (sub) => <strong>{sub}</strong>,
|
||||
},
|
||||
)}
|
||||
</li>
|
||||
<li>
|
||||
{_t(
|
||||
|
|
|
@ -95,6 +95,11 @@ const RoomStateHistory: React.FC<{
|
|||
const StateEventButton: React.FC<StateEventButtonProps> = ({ label, onClick }) => {
|
||||
const trimmed = label.trim();
|
||||
|
||||
let content = label;
|
||||
if (!trimmed) {
|
||||
content = label.length > 0 ? _t("<%(count)s spaces>", { count: label.length }) : _t("<empty string>");
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
className={classNames("mx_DevTools_button", {
|
||||
|
@ -103,7 +108,7 @@ const StateEventButton: React.FC<StateEventButtonProps> = ({ label, onClick }) =
|
|||
})}
|
||||
onClick={onClick}
|
||||
>
|
||||
{trimmed ? label : _t("<%(count)s spaces>", { count: label.length })}
|
||||
{content}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue