From b9ff6558e926d904f47ef62d28f8494cd4f5e89f Mon Sep 17 00:00:00 2001 From: Suguru Hirahara Date: Wed, 22 Feb 2023 11:40:18 +0000 Subject: [PATCH] Make localization keys compatible with agglutinative and/or SOV type languages (#10159) * Make localization keys on HelpUserSettingsTab compatible with agglutinative and/or SOV type languages * Make localization keys on room notifications debug dialog on devtools compatible with agglutinative and/or SOV type languages * Make keys compatible with inflection * Clarify context for Weblate translators --------- Signed-off-by: Suguru Hirahara --- .../dialogs/devtools/RoomNotifications.tsx | 40 +++++++++++++------ .../tabs/user/HelpUserSettingsTab.tsx | 20 +++++++++- src/i18n/strings/en_EN.json | 15 ++++--- .../RoomNotifications-test.tsx.snap | 26 +++++++----- 4 files changed, 69 insertions(+), 32 deletions(-) diff --git a/src/components/views/dialogs/devtools/RoomNotifications.tsx b/src/components/views/dialogs/devtools/RoomNotifications.tsx index 7ddfb5d8baa..25f4110ec11 100644 --- a/src/components/views/dialogs/devtools/RoomNotifications.tsx +++ b/src/components/views/dialogs/devtools/RoomNotifications.tsx @@ -20,7 +20,7 @@ import React, { useContext } from "react"; import MatrixClientContext from "../../../../contexts/MatrixClientContext"; import { useNotificationState } from "../../../../hooks/useRoomNotificationState"; -import { _t } from "../../../../languageHandler"; +import { _t, _td } from "../../../../languageHandler"; import { determineUnreadState } from "../../../../RoomNotifs"; import { humanReadableNotificationColor } from "../../../../stores/notifications/NotificationColor"; import { doesRoomOrThreadHaveUnreadMessages } from "../../../../Unread"; @@ -39,22 +39,38 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme

{_t("Room status")}

diff --git a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx index 0134062ca6a..7ad495e2aaa 100644 --- a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx @@ -327,10 +327,26 @@ export default class HelpUserSettingsTab extends React.Component {_t("Advanced")}
- {_t("Homeserver is")} {MatrixClientPeg.get().getHomeserverUrl()} + {_t( + "Homeserver is %(homeserverUrl)s", + { + homeserverUrl: MatrixClientPeg.get().getHomeserverUrl(), + }, + { + code: (sub) => {sub}, + }, + )}
- {_t("Identity server is")} {MatrixClientPeg.get().getIdentityServerUrl()} + {_t( + "Identity server is %(identityServerUrl)s", + { + identityServerUrl: MatrixClientPeg.get().getIdentityServerUrl(), + }, + { + code: (sub) => {sub}, + }, + )}
{_t("Access Token")} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 3c3ff6c20a4..4d7045c5772 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1567,8 +1567,8 @@ "FAQ": "FAQ", "Keyboard Shortcuts": "Keyboard Shortcuts", "Versions": "Versions", - "Homeserver is": "Homeserver is", - "Identity server is": "Identity server is", + "Homeserver is %(homeserverUrl)s": "Homeserver is %(homeserverUrl)s", + "Identity server is %(identityServerUrl)s": "Identity server is %(identityServerUrl)s", "Access Token": "Access Token", "Your access token gives full access to your account. Do not share it with anyone.": "Your access token gives full access to your account. Do not share it with anyone.", "Clear cache and reload": "Clear cache and reload", @@ -3150,12 +3150,11 @@ "Filter results": "Filter results", "No results found": "No results found", "Room status": "Room status", - "Room unread status: ": "Room unread status: ", - ", count:": ", count:", - "Notification state is": "Notification state is", - "Room is ": "Room is ", - "encrypted ✅": "encrypted ✅", - "not encrypted 🚨": "not encrypted 🚨", + "Room unread status: %(status)s, count: %(count)s|other": "Room unread status: %(status)s, count: %(count)s", + "Room unread status: %(status)s, count: %(count)s|zero": "Room unread status: %(status)s", + "Notification state is %(notificationState)s": "Notification state is %(notificationState)s", + "Room is encrypted ✅": "Room is encrypted ✅", + "Room is not encrypted 🚨": "Room is not encrypted 🚨", "Main timeline": "Main timeline", "Total: ": "Total: ", "Highlight: ": "Highlight: ", diff --git a/test/components/views/dialogs/devtools/__snapshots__/RoomNotifications-test.tsx.snap b/test/components/views/dialogs/devtools/__snapshots__/RoomNotifications-test.tsx.snap index 79e85f57e9e..843ee88ca5c 100644 --- a/test/components/views/dialogs/devtools/__snapshots__/RoomNotifications-test.tsx.snap +++ b/test/components/views/dialogs/devtools/__snapshots__/RoomNotifications-test.tsx.snap @@ -11,20 +11,26 @@ exports[` should render 1`] = `
  • - Room unread status: - - None - + + Room unread status: + + None + +
  • - Notification state is - + + Notification state is + +
  • - Room is - - not encrypted 🚨 - + + Room is + + not encrypted 🚨 + +