From 9329b896b351f10949e9e9548612c6b86cc2d64c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 31 Aug 2023 08:35:34 +0100 Subject: [PATCH] Port more strings to translation keys (#11474) * Port composer formatting strings to translation keys ``` replace "Bold" "composer|format_bold" replace "Italic" "composer|format_italic" replace "Underline" "composer|format_underline" replace "Strikethrough" "composer|format_strikethrough" replace "Bulleted list" "composer|format_unordered_list" replace "Numbered list" "composer|format_ordered_list" replace "Indent increase" "composer|format_increase_indent" replace "Indent decrease" "composer|format_decrease_indent" replace "Code" "composer|format_inline_code" replace "Code block" "composer|format_code_block" replace "Link" "composer|format_link" copy "composer|format_bold" "Bold" copy "composer|format_link" "Link" copy "composer|format_inline_code" "Code" ``` * Port role strings to translation keys ``` copy "Default" "power_level|default" copy "Restricted" "power_level|restricted" copy "Moderator" "power_level|moderator" copy "Admin" "power_level|admin" ``` * Port bug reporting strings to translation keys ``` replace "If you've submitted a bug via GitHub, debug logs can help us track down the problem. " "bug_reporting|introduction" replace "Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages." "bug_reporting|description" copy "To report a Matrix-related security issue, please read the Matrix.org Security Disclosure Policy." "bug_reporting|matrix_security_issue" replace "Submit debug logs" "bug_reporting|submit_debug_logs" replace "Bug reporting" "bug_reporting|title" replace "If there is additional context that would help in analysing the issue, such as what you were doing at the time, room IDs, user IDs, etc., please include those things here." "bug_reporting|additional_context" replace "Send logs" "bug_reporting|send_logs" replace "GitHub issue" "bug_reporting|github_issue" replace "Download logs" "bug_reporting|download_logs" copy "Before submitting logs, you must create a GitHub issue to describe your problem." "bug_reporting|before_submitting" ``` * i18n * Port time duration strings to translation keys ``` replace "%(hours)sh %(minutes)sm %(seconds)ss left" "time|hours_minutes_seconds_left" replace "%(minutes)sm %(seconds)ss left" "time|minutes_seconds_left" replace "%(seconds)ss left" "time|seconds_left" replace "%(date)s at %(time)s" "time|date_at_time" replace "%(value)sd" "time|short_days" replace "%(value)sh" "time|short_hours" replace "%(value)sm" "time|short_minutes" replace "%(value)ss" "time|short_seconds" replace "%(days)sd %(hours)sh %(minutes)sm %(seconds)ss" "time|short_days_hours_minutes_seconds" replace "%(hours)sh %(minutes)sm %(seconds)ss" "time|short_hours_minutes_seconds" replace "%(minutes)sm %(seconds)ss" "time|short_minutes_seconds" ``` * i18n --- src/DateUtils.ts | 24 +++--- src/Roles.ts | 10 +-- .../views/dialogs/BugReportDialog.tsx | 20 ++--- .../views/elements/ErrorBoundary.tsx | 11 +-- .../views/rooms/MessageComposer.tsx | 7 +- .../views/rooms/MessageComposerFormatBar.tsx | 6 +- .../components/FormattingButtons.tsx | 22 ++--- .../tabs/user/HelpUserSettingsTab.tsx | 16 ++-- src/i18n/strings/ar.json | 28 +++++-- src/i18n/strings/az.json | 6 ++ src/i18n/strings/bg.json | 46 ++++++---- src/i18n/strings/ca.json | 12 ++- src/i18n/strings/cs.json | 79 +++++++++++------- src/i18n/strings/da.json | 16 +++- src/i18n/strings/de_DE.json | 79 +++++++++++------- src/i18n/strings/el.json | 52 ++++++++---- src/i18n/strings/en_EN.json | 83 +++++++++++-------- src/i18n/strings/en_US.json | 18 +++- src/i18n/strings/eo.json | 58 ++++++++----- src/i18n/strings/es.json | 79 +++++++++++------- src/i18n/strings/et.json | 79 +++++++++++------- src/i18n/strings/eu.json | 32 +++++-- src/i18n/strings/fa.json | 48 +++++++---- src/i18n/strings/fi.json | 75 ++++++++++------- src/i18n/strings/fr.json | 79 +++++++++++------- src/i18n/strings/ga.json | 16 +++- src/i18n/strings/gl.json | 62 +++++++++----- src/i18n/strings/he.json | 56 ++++++++----- src/i18n/strings/hi.json | 24 ++++-- src/i18n/strings/hu.json | 79 +++++++++++------- src/i18n/strings/id.json | 79 +++++++++++------- src/i18n/strings/is.json | 70 ++++++++++------ src/i18n/strings/it.json | 79 +++++++++++------- src/i18n/strings/ja.json | 77 ++++++++++------- src/i18n/strings/jbo.json | 6 ++ src/i18n/strings/ka.json | 8 +- src/i18n/strings/kab.json | 34 +++++--- src/i18n/strings/ko.json | 31 +++++-- src/i18n/strings/lo.json | 52 ++++++++---- src/i18n/strings/lt.json | 52 ++++++++---- src/i18n/strings/lv.json | 21 ++++- src/i18n/strings/ml.json | 4 +- src/i18n/strings/nb_NO.json | 33 ++++++-- src/i18n/strings/nl.json | 56 ++++++++----- src/i18n/strings/nn.json | 47 +++++++---- src/i18n/strings/oc.json | 12 ++- src/i18n/strings/pl.json | 79 +++++++++++------- src/i18n/strings/pt.json | 36 +++++--- src/i18n/strings/pt_BR.json | 67 +++++++++------ src/i18n/strings/ru.json | 77 ++++++++++------- src/i18n/strings/sk.json | 79 +++++++++++------- src/i18n/strings/sl.json | 18 ++-- src/i18n/strings/sq.json | 79 +++++++++++------- src/i18n/strings/sr.json | 17 +++- src/i18n/strings/sr_Latn.json | 14 +++- src/i18n/strings/sv.json | 79 +++++++++++------- src/i18n/strings/ta.json | 4 +- src/i18n/strings/te.json | 8 +- src/i18n/strings/th.json | 31 +++++-- src/i18n/strings/tr.json | 37 ++++++--- src/i18n/strings/uk.json | 79 +++++++++++------- src/i18n/strings/vi.json | 75 ++++++++++------- src/i18n/strings/vls.json | 26 ++++-- src/i18n/strings/zh_Hans.json | 62 +++++++++----- src/i18n/strings/zh_Hant.json | 79 +++++++++++------- 65 files changed, 1786 insertions(+), 1043 deletions(-) diff --git a/src/DateUtils.ts b/src/DateUtils.ts index 78b390a4aa..f955299682 100644 --- a/src/DateUtils.ts +++ b/src/DateUtils.ts @@ -212,7 +212,7 @@ export function formatTimeLeft(inSeconds: number): string { const seconds = Math.floor((inSeconds % (60 * 60)) % 60).toFixed(0); if (hours !== "0") { - return _t("%(hours)sh %(minutes)sm %(seconds)ss left", { + return _t("time|hours_minutes_seconds_left", { hours, minutes, seconds, @@ -220,13 +220,13 @@ export function formatTimeLeft(inSeconds: number): string { } if (minutes !== "0") { - return _t("%(minutes)sm %(seconds)ss left", { + return _t("time|minutes_seconds_left", { minutes, seconds, }); } - return _t("%(seconds)ss left", { + return _t("time|seconds_left", { seconds, }); } @@ -258,7 +258,7 @@ export function wantsDateSeparator(prevEventDate: Optional, nextEventDate: export function formatFullDateNoDay(date: Date): string { const locale = getUserLanguage(); - return _t("%(date)s at %(time)s", { + return _t("time|date_at_time", { date: date.toLocaleDateString(locale).replace(/\//g, "-"), time: date.toLocaleTimeString(locale).replace(/:/g, "-"), }); @@ -311,15 +311,15 @@ export function formatRelativeTime(date: Date, showTwelveHour = false): string { */ export function formatDuration(durationMs: number): string { if (durationMs >= DAY_MS) { - return _t("%(value)sd", { value: Math.round(durationMs / DAY_MS) }); + return _t("time|short_days", { value: Math.round(durationMs / DAY_MS) }); } if (durationMs >= HOUR_MS) { - return _t("%(value)sh", { value: Math.round(durationMs / HOUR_MS) }); + return _t("time|short_hours", { value: Math.round(durationMs / HOUR_MS) }); } if (durationMs >= MINUTE_MS) { - return _t("%(value)sm", { value: Math.round(durationMs / MINUTE_MS) }); + return _t("time|short_minutes", { value: Math.round(durationMs / MINUTE_MS) }); } - return _t("%(value)ss", { value: Math.round(durationMs / 1000) }); + return _t("time|short_seconds", { value: Math.round(durationMs / 1000) }); } /** @@ -334,15 +334,15 @@ export function formatPreciseDuration(durationMs: number): string { const seconds = Math.floor((durationMs % MINUTE_MS) / 1000); if (days > 0) { - return _t("%(days)sd %(hours)sh %(minutes)sm %(seconds)ss", { days, hours, minutes, seconds }); + return _t("time|short_days_hours_minutes_seconds", { days, hours, minutes, seconds }); } if (hours > 0) { - return _t("%(hours)sh %(minutes)sm %(seconds)ss", { hours, minutes, seconds }); + return _t("time|short_hours_minutes_seconds", { hours, minutes, seconds }); } if (minutes > 0) { - return _t("%(minutes)sm %(seconds)ss", { minutes, seconds }); + return _t("time|short_minutes_seconds", { minutes, seconds }); } - return _t("%(value)ss", { value: seconds }); + return _t("time|short_seconds", { value: seconds }); } /** diff --git a/src/Roles.ts b/src/Roles.ts index aa6a369081..1ec2be004d 100644 --- a/src/Roles.ts +++ b/src/Roles.ts @@ -18,11 +18,11 @@ import { _t } from "./languageHandler"; export function levelRoleMap(usersDefault: number): Record { return { - undefined: _t("Default"), - 0: _t("Restricted"), - [usersDefault]: _t("Default"), - 50: _t("Moderator"), - 100: _t("Admin"), + undefined: _t("power_level|default"), + 0: _t("power_level|restricted"), + [usersDefault]: _t("power_level|default"), + 50: _t("power_level|moderator"), + 100: _t("power_level|admin"), }; } diff --git a/src/components/views/dialogs/BugReportDialog.tsx b/src/components/views/dialogs/BugReportDialog.tsx index 5a9af1dc3f..d2074c5cd4 100644 --- a/src/components/views/dialogs/BugReportDialog.tsx +++ b/src/components/views/dialogs/BugReportDialog.tsx @@ -217,20 +217,16 @@ export default class BugReportDialog extends React.Component {
{warning} -

- {_t( - "Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages.", - )} -

+

{_t("bug_reporting|description")}

{_t( - "Before submitting logs, you must create a GitHub issue to describe your problem.", + "bug_reporting|before_submitting", {}, { a: (sub) => ( @@ -248,7 +244,7 @@ export default class BugReportDialog extends React.Component {

- {_t("Download logs")} + {_t("bug_reporting|download_logs")} {this.state.downloadProgress && {this.state.downloadProgress} ...}
@@ -256,7 +252,7 @@ export default class BugReportDialog extends React.Component { { rows={5} onChange={this.onTextChange} value={this.state.text} - placeholder={_t( - "If there is additional context that would help in analysing the issue, such as what you were doing at the time, room IDs, user IDs, etc., please include those things here.", - )} + placeholder={_t("bug_reporting|additional_context")} /> {progress} {error}
{ )}

- {_t( - "If you've submitted a bug via GitHub, debug logs can help us track down the problem. ", - )} - {_t( - "Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages.", - )} + {_t("bug_reporting|introduction")} +   + {_t("bug_reporting|description")}

- {_t("Submit debug logs")} + {_t("bug_reporting|submit_debug_logs")} ); diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index 7c7624f6e5..44c494765f 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -64,6 +64,7 @@ import { SdkContextClass } from "../../../contexts/SDKContext"; import { VoiceBroadcastInfoState } from "../../../voice-broadcast"; import { createCantStartVoiceMessageBroadcastDialog } from "../dialogs/CantStartVoiceMessageBroadcastDialog"; import { UIFeature } from "../../../settings/UIFeature"; +import { formatTimeLeft } from "../../../DateUtils"; let instanceCount = 0; @@ -569,11 +570,7 @@ export class MessageComposer extends React.Component { if (this.state.recordingTimeLeftSeconds) { const secondsLeft = Math.round(this.state.recordingTimeLeftSeconds); recordingTooltip = ( - + ); } diff --git a/src/components/views/rooms/MessageComposerFormatBar.tsx b/src/components/views/rooms/MessageComposerFormatBar.tsx index ac62b8a2d6..f57ce93904 100644 --- a/src/components/views/rooms/MessageComposerFormatBar.tsx +++ b/src/components/views/rooms/MessageComposerFormatBar.tsx @@ -54,7 +54,7 @@ export default class MessageComposerFormatBar extends React.PureComponent this.props.onAction(Formatting.Bold)} icon="Bold" shortcut={this.props.shortcuts.bold} @@ -68,13 +68,13 @@ export default class MessageComposerFormatBar extends React.PureComponent this.props.onAction(Formatting.Strikethrough)} icon="Strikethrough" visible={this.state.visible} /> this.props.onAction(Formatting.Code)} icon="Code" shortcut={this.props.shortcuts.code} diff --git a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx index 0045b13ab2..bf0ad48cf5 100644 --- a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx +++ b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx @@ -93,47 +93,47 @@ export function FormattingButtons({ composer, actionStates }: FormattingButtonsP