Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Re-key all |zero-pluralised translations for Localazy compatibility (#…
Browse files Browse the repository at this point in the history
…11417)

* Re-key all |zero-pluralised translations for Localazy compatibility

* Add missing interpolation variable

* i18n

* Add test coverage

* Improve coverage
  • Loading branch information
t3chguy authored Aug 16, 2023
1 parent a510751 commit 6b14ecf
Show file tree
Hide file tree
Showing 51 changed files with 270 additions and 158 deletions.
17 changes: 12 additions & 5 deletions src/components/structures/UploadBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
30 changes: 20 additions & 10 deletions src/components/views/dialogs/devtools/RoomNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 6 additions & 1 deletion src/components/views/dialogs/devtools/RoomState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand All @@ -103,7 +108,7 @@ const StateEventButton: React.FC<StateEventButtonProps> = ({ label, onClick }) =
})}
onClick={onClick}
>
{trimmed ? label : _t("<%(count)s spaces>", { count: label.length })}
{content}
</button>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/strings/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
"Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Беше направен опит да се зареди конкретна точка в хронологията на тази стая, но нямате разрешение да разгледате въпросното съобщение.",
"Failed to load timeline position": "Неуспешно зареждане на позицията в хронологията",
"Uploading %(filename)s and %(count)s others|other": "Качване на %(filename)s и %(count)s други",
"Uploading %(filename)s and %(count)s others|zero": "Качване на %(filename)s",
"Uploading %(filename)s": "Качване на %(filename)s",
"Uploading %(filename)s and %(count)s others|one": "Качване на %(filename)s и %(count)s друг",
"Success": "Успешно",
"<not supported>": "<не се поддържа>",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/strings/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
"Failed to load timeline position": "No s'ha pogut carregar aquesta posició de la línia de temps",
"Signed Out": "Sessió tancada",
"Uploading %(filename)s and %(count)s others|other": "Pujant %(filename)s i %(count)s més",
"Uploading %(filename)s and %(count)s others|zero": "Pujant %(filename)s",
"Uploading %(filename)s": "Pujant %(filename)s",
"Sign out": "Tanca la sessió",
"Import E2E room keys": "Importar claus E2E de sala",
"Cryptography": "Criptografia",
Expand Down
7 changes: 3 additions & 4 deletions src/i18n/strings/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2697,7 +2697,6 @@
"%(count)s votes|one": "%(count)s hlas",
"%(count)s votes|other": "%(count)s hlasů",
"%(spaceName)s and %(count)s others|one": "%(spaceName)s a %(count)s další",
"%(spaceName)s and %(count)s others|zero": "%(spaceName)s",
"%(spaceName)s and %(count)s others|other": "%(spaceName)s and %(count)s dalších",
"Sorry, the poll you tried to create was not posted.": "Omlouváme se, ale hlasování, které jste se pokusili vytvořit, nebylo zveřejněno.",
"Failed to post poll": "Nepodařilo se zveřejnit hlasování",
Expand Down Expand Up @@ -2910,7 +2909,7 @@
"%(severalUsers)sremoved a message %(count)s times|other": "%(severalUsers)ssmazali %(count)s zpráv",
"Maximise": "Maximalizovat",
"Automatically send debug logs when key backup is not functioning": "Automaticky odeslat ladící protokoly, když zálohování klíčů nefunguje",
"<%(count)s spaces>|zero": "<prázdný řetězec>",
"<empty string>": "<prázdný řetězec>",
"<%(count)s spaces>|one": "<mezera>",
"<%(count)s spaces>|other": "<%(count)s mezer>",
"Join %(roomAddress)s": "Vstoupit do %(roomAddress)s",
Expand Down Expand Up @@ -3191,7 +3190,7 @@
"Map feedback": "Zpětná vazba k mapě",
"Toggle attribution": "Přepnout atribut",
"In %(spaceName)s and %(count)s other spaces.|one": "V %(spaceName)s a %(count)s dalším prostoru.",
"In %(spaceName)s and %(count)s other spaces.|zero": "V prostoru %(spaceName)s.",
"In %(spaceName)s.": "V prostoru %(spaceName)s.",
"In %(spaceName)s and %(count)s other spaces.|other": "V %(spaceName)s a %(count)s ostatních prostorech.",
"In spaces %(space1Name)s and %(space2Name)s.": "V prostorech %(space1Name)s a %(space2Name)s.",
"Developer command: Discards the current outbound group session and sets up new Olm sessions": "Příkaz pro vývojáře: Zruší aktuální odchozí relaci skupiny a nastaví nové relace Olm",
Expand Down Expand Up @@ -3608,7 +3607,7 @@
"Show NSFW content": "Zobrazit NSFW obsah",
"Room is <strong>encrypted ✅</strong>": "Místnost je <strong>šifrovaná ✅</strong>",
"Notification state is <strong>%(notificationState)s</strong>": "Stav oznámení je <strong>%(notificationState)s</strong>",
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>|zero": "Stav nepřečtení místnosti: <strong>%(status)s</strong>",
"Room unread status: <strong>%(status)s</strong>": "Stav nepřečtení místnosti: <strong>%(status)s</strong>",
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>|other": "Stav nepřečtení místnosti: <strong>%(status)s</strong>, počet: <strong>%(count)s</strong>",
"Due to decryption errors, some votes may not be counted": "Kvůli chybám v dešifrování nemusí být některé hlasy započítány",
"Identity server is <code>%(identityServerUrl)s</code>": "Server identit je <code>%(identityServerUrl)s</code>",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@
"Go Back": "Gå tilbage",
"Are you sure you want to cancel entering passphrase?": "Er du sikker på, at du vil annullere indtastning af adgangssætning?",
"%(spaceName)s and %(count)s others|one": "%(spaceName)s og %(count)s andre",
"%(spaceName)s and %(count)s others|zero": "%(spaceName)s",
"%(spaceName)s and %(count)s others|other": "%(spaceName)s og %(count)s andre",
"Some invites couldn't be sent": "Nogle invitationer kunne ikke blive sendt",
"We sent the others, but the below people couldn't be invited to <RoomName/>": "Vi har sendt til de andre, men nedenstående mennesker kunne ikke blive inviteret til <RoomName/>",
Expand Down
9 changes: 4 additions & 5 deletions src/i18n/strings/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
"%(senderDisplayName)s changed the room avatar to <img/>": "%(senderDisplayName)s hat das Raumbild zu <img/> geändert",
"%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s hat das Raumbild von %(roomName)s geändert",
"Add": "Hinzufügen",
"Uploading %(filename)s and %(count)s others|zero": "%(filename)s wird hochgeladen",
"Uploading %(filename)s": "%(filename)s wird hochgeladen",
"Uploading %(filename)s and %(count)s others|one": "%(filename)s und %(count)s weitere Dateien werden hochgeladen",
"Uploading %(filename)s and %(count)s others|other": "%(filename)s und %(count)s weitere Dateien werden hochgeladen",
"You must <a>register</a> to use this functionality": "Du musst dich <a>registrieren</a>, um diese Funktionalität nutzen zu können",
Expand Down Expand Up @@ -2703,7 +2703,6 @@
"Themes": "Themen",
"Moderation": "Moderation",
"%(spaceName)s and %(count)s others|one": "%(spaceName)s und %(count)s anderer",
"%(spaceName)s and %(count)s others|zero": "%(spaceName)s",
"%(spaceName)s and %(count)s others|other": "%(spaceName)s und %(count)s andere",
"Share anonymous data to help us identify issues. Nothing personal. No third parties. <LearnMoreLink>Learn More</LearnMoreLink>": "Teile Daten anonymisiert um uns zu helfen Probleme zu identifizieren. Nichts persönliches. Keine Dritten. <LearnMoreLink>Mehr dazu hier</LearnMoreLink>",
"You previously consented to share anonymous usage data with us. We're updating how that works.": "Sie haben zuvor zugestimmt, anonymisierte Nutzungsdaten mit uns zu teilen. Wir aktualisieren, wie das funktioniert.",
Expand Down Expand Up @@ -2908,7 +2907,7 @@
"Open thread": "Thread anzeigen",
"Search Dialog": "Suchdialog",
"Join %(roomAddress)s": "%(roomAddress)s betreten",
"<%(count)s spaces>|zero": "<Leere Zeichenkette>",
"<empty string>": "<Leere Zeichenkette>",
"<%(count)s spaces>|one": "<Leerzeichen>",
"<%(count)s spaces>|other": "<%(count)s Leerzeichen>",
"Results are only revealed when you end the poll": "Die Ergebnisse werden erst sichtbar, sobald du die Umfrage beendest",
Expand Down Expand Up @@ -3229,7 +3228,7 @@
"Find and invite your friends": "Finde deine Freunde und lade sie ein",
"You made it!": "Geschafft!",
"In %(spaceName)s and %(count)s other spaces.|one": "Im Space %(spaceName)s und %(count)s weiteren Spaces.",
"In %(spaceName)s and %(count)s other spaces.|zero": "Im Space %(spaceName)s.",
"In %(spaceName)s.": "Im Space %(spaceName)s.",
"In %(spaceName)s and %(count)s other spaces.|other": "In %(spaceName)s und %(count)s weiteren Spaces.",
"Download %(brand)s": "%(brand)s herunterladen",
"Find and invite your community members": "Finde deine Community-Mitglieder und lade sie ein",
Expand Down Expand Up @@ -3611,7 +3610,7 @@
"Room is <strong>not encrypted 🚨</strong>": "Raum ist <strong>nicht verschlüsselt 🚨</strong>",
"Room is <strong>encrypted ✅</strong>": "Raum ist <strong>verschlüsselt ✅</strong>",
"Notification state is <strong>%(notificationState)s</strong>": "Benachrichtigungsstand ist <strong>%(notificationState)s</strong>",
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>|zero": "Ungelesen-Status im Raum: <strong>%(status)s</strong>",
"Room unread status: <strong>%(status)s</strong>": "Ungelesen-Status im Raum: <strong>%(status)s</strong>",
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>|other": "Ungelesen-Status im Raum: <strong>%(status)s</strong>, Anzahl: <strong>%(count)s</strong>",
"Identity server is <code>%(identityServerUrl)s</code>": "Identitäts-Server ist <code>%(identityServerUrl)s</code>",
"Homeserver is <code>%(homeserverUrl)s</code>": "Heim-Server ist <code>%(homeserverUrl)s</code>",
Expand Down
5 changes: 2 additions & 3 deletions src/i18n/strings/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"Server may be unavailable, overloaded, or you hit a bug.": "Ο διακομιστής μπορεί να είναι μη διαθέσιμος, υπερφορτωμένος, ή να πέσατε σε ένα σφάλμα.",
"Server unavailable, overloaded, or something else went wrong.": "Ο διακομιστής μπορεί να είναι μη διαθέσιμος, υπερφορτωμένος, ή κάτι άλλο να πήγε στραβά.",
"This room is not recognised.": "Αυτό το δωμάτιο δεν αναγνωρίζεται.",
"Uploading %(filename)s and %(count)s others|zero": "Γίνεται αποστολή του %(filename)s",
"Uploading %(filename)s": "Γίνεται αποστολή του %(filename)s",
"Uploading %(filename)s and %(count)s others|other": "Γίνεται αποστολή του %(filename)s και %(count)s υπολοίπων",
"%(userName)s (power %(powerLevelNumber)s)": "%(userName)s (δύναμη %(powerLevelNumber)s)",
"Verification Pending": "Εκκρεμεί επιβεβαίωση",
Expand Down Expand Up @@ -698,7 +698,6 @@
"We were unable to understand the given date (%(inputDate)s). Try using the format YYYY-MM-DD.": "Αδυναμία κατανόησης της δοθείσας ημερομηνίας (%(inputDate)s). Προσπαθήστε να χρησιμοποιήσετε την μορφή YYYY-MM-DD.",
"Sends the given message as a spoiler": "Στέλνει το δοθέν μήνυμα ως spoiler",
"Setting up keys": "Ρύθμιση κλειδιών",
"%(spaceName)s and %(count)s others|zero": "%(spaceName)s",
"Some invites couldn't be sent": "Δεν ήταν δυνατή η αποστολή κάποιων προσκλήσεων",
"We sent the others, but the below people couldn't be invited to <RoomName/>": "Στάλθηκαν οι προσκλήσεις στους άλλους, αλλά δεν ήταν δυνατή η αποστολή πρόσκλησης στους παρακάτω στο <RoomName/>",
"Custom (%(level)s)": "Προσαρμοσμένα (%(level)s)",
Expand Down Expand Up @@ -2978,7 +2977,7 @@
"Server Versions": "Εκδόσεις διακομιστή",
"Client Versions": "Εκδόσεις πελάτη",
"Send custom state event": "Αποστολή προσαρμοσμένου συμβάντος κατάστασης",
"<%(count)s spaces>|zero": "<empty string>",
"<empty string>": "<empty string>",
"Event Content": "Περιεχόμενο συμβάντος",
"Event sent!": "Το συμβάν στάλθηκε!",
"Failed to send event!": "Αποτυχία αποστολής συμβάντος!",
Expand Down
9 changes: 4 additions & 5 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,10 @@
"%(space1Name)s and %(space2Name)s": "%(space1Name)s and %(space2Name)s",
"In spaces %(space1Name)s and %(space2Name)s.": "In spaces %(space1Name)s and %(space2Name)s.",
"%(spaceName)s and %(count)s others|other": "%(spaceName)s and %(count)s others",
"%(spaceName)s and %(count)s others|zero": "%(spaceName)s",
"%(spaceName)s and %(count)s others|one": "%(spaceName)s and %(count)s other",
"In %(spaceName)s and %(count)s other spaces.|other": "In %(spaceName)s and %(count)s other spaces.",
"In %(spaceName)s and %(count)s other spaces.|zero": "In space %(spaceName)s.",
"In %(spaceName)s and %(count)s other spaces.|one": "In %(spaceName)s and %(count)s other space.",
"In %(spaceName)s.": "In %(spaceName)s.",
"%(name)s (%(userId)s)": "%(name)s (%(userId)s)",
"Unexpected server error trying to leave the room": "Unexpected server error trying to leave the room",
"Can't leave Server Notices room": "Can't leave Server Notices room",
Expand Down Expand Up @@ -3223,7 +3222,7 @@
"User read up to (m.read.private;ignoreSynthetic): ": "User read up to (m.read.private;ignoreSynthetic): ",
"Room status": "Room status",
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>|other": "Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>",
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>|zero": "Room unread status: <strong>%(status)s</strong>",
"Room unread status: <strong>%(status)s</strong>": "Room unread status: <strong>%(status)s</strong>",
"Notification state is <strong>%(notificationState)s</strong>": "Notification state is <strong>%(notificationState)s</strong>",
"Room is <strong>encrypted ✅</strong>": "Room is <strong>encrypted ✅</strong>",
"Room is <strong>not encrypted 🚨</strong>": "Room is <strong>not encrypted 🚨</strong>",
Expand All @@ -3239,7 +3238,7 @@
"Thread Id: ": "Thread Id: ",
"<%(count)s spaces>|other": "<%(count)s spaces>",
"<%(count)s spaces>|one": "<space>",
"<%(count)s spaces>|zero": "<empty string>",
"<empty string>": "<empty string>",
"See history": "See history",
"Send custom state event": "Send custom state event",
"Capabilities": "Capabilities",
Expand Down Expand Up @@ -3542,8 +3541,8 @@
"Tried to load a specific point in this room's timeline, but was unable to find it.": "Tried to load a specific point in this room's timeline, but was unable to find it.",
"Failed to load timeline position": "Failed to load timeline position",
"Uploading %(filename)s and %(count)s others|other": "Uploading %(filename)s and %(count)s others",
"Uploading %(filename)s and %(count)s others|zero": "Uploading %(filename)s",
"Uploading %(filename)s and %(count)s others|one": "Uploading %(filename)s and %(count)s other",
"Uploading %(filename)s": "Uploading %(filename)s",
"Got an account? <a>Sign in</a>": "Got an account? <a>Sign in</a>",
"New here? <a>Create an account</a>": "New here? <a>Create an account</a>",
"Switch to light mode": "Switch to light mode",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/strings/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
"%(roomName)s is not accessible at this time.": "%(roomName)s is not accessible at this time.",
"Start authentication": "Start authentication",
"Unnamed Room": "Unnamed Room",
"Uploading %(filename)s and %(count)s others|zero": "Uploading %(filename)s",
"Uploading %(filename)s": "Uploading %(filename)s",
"Uploading %(filename)s and %(count)s others|one": "Uploading %(filename)s and %(count)s other",
"Uploading %(filename)s and %(count)s others|other": "Uploading %(filename)s and %(count)s others",
"%(userName)s (power %(powerLevelNumber)s)": "%(userName)s (power %(powerLevelNumber)s)",
Expand Down
Loading

0 comments on commit 6b14ecf

Please sign in to comment.