Fix instances of double translation and guard translation calls using typescript (#11443)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
parent
d13b6e1b41
commit
ac70f7ac9b
157 changed files with 554 additions and 780 deletions
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
import React, { ReactNode } from "react";
|
||||
|
||||
import { _t, _td } from "../languageHandler";
|
||||
import { _t, _td, TranslationKey } from "../languageHandler";
|
||||
import {
|
||||
NotificationBodyEnabledController,
|
||||
NotificationsEnabledController,
|
||||
|
@ -98,7 +98,7 @@ export enum Features {
|
|||
OidcNativeFlow = "feature_oidc_native_flow",
|
||||
}
|
||||
|
||||
export const labGroupNames: Record<LabGroup, string> = {
|
||||
export const labGroupNames: Record<LabGroup, TranslationKey> = {
|
||||
[LabGroup.Messaging]: _td("Messaging"),
|
||||
[LabGroup.Profile]: _td("Profile"),
|
||||
[LabGroup.Spaces]: _td("Spaces"),
|
||||
|
@ -129,13 +129,13 @@ export interface IBaseSetting<T extends SettingValueType = SettingValueType> {
|
|||
// Display names are strongly recommended for clarity.
|
||||
// Display name can also be an object for different levels.
|
||||
displayName?:
|
||||
| string
|
||||
| TranslationKey
|
||||
| Partial<{
|
||||
[level in SettingLevel]: string;
|
||||
[level in SettingLevel]: TranslationKey;
|
||||
}>;
|
||||
|
||||
// Optional description which will be shown as microCopy under SettingsFlags
|
||||
description?: string | (() => ReactNode);
|
||||
description?: TranslationKey | (() => ReactNode);
|
||||
|
||||
// The supported levels are required. Preferably, use the preset arrays
|
||||
// at the top of this file to define this rather than a custom array.
|
||||
|
@ -165,11 +165,11 @@ export interface IBaseSetting<T extends SettingValueType = SettingValueType> {
|
|||
|
||||
// XXX: Keep this around for re-use in future Betas
|
||||
betaInfo?: {
|
||||
title: string; // _td
|
||||
title: TranslationKey;
|
||||
caption: () => ReactNode;
|
||||
faq?: (enabled: boolean) => ReactNode;
|
||||
image?: string; // require(...)
|
||||
feedbackSubheading?: string;
|
||||
feedbackSubheading?: TranslationKey;
|
||||
feedbackLabel?: string;
|
||||
extraSettings?: string[];
|
||||
requiresRefresh?: boolean;
|
||||
|
@ -266,7 +266,7 @@ export const SETTINGS: { [setting: string]: ISetting } = {
|
|||
labsGroup: LabGroup.Moderation,
|
||||
displayName: _td("Report to moderators"),
|
||||
description: _td(
|
||||
"In rooms that support moderation, " + "the “Report” button will let you report abuse to room moderators.",
|
||||
"In rooms that support moderation, the “Report” button will let you report abuse to room moderators.",
|
||||
),
|
||||
supportedLevels: LEVELS_FEATURE,
|
||||
default: false,
|
||||
|
@ -805,7 +805,7 @@ export const SETTINGS: { [setting: string]: ISetting } = {
|
|||
"deviceClientInformationOptIn": {
|
||||
supportedLevels: [SettingLevel.ACCOUNT],
|
||||
displayName: _td(
|
||||
`Record the client name, version, and url ` + `to recognise sessions more easily in session manager`,
|
||||
"Record the client name, version, and url to recognise sessions more easily in session manager",
|
||||
),
|
||||
default: false,
|
||||
},
|
||||
|
|
|
@ -269,7 +269,7 @@ export default class SettingsStore {
|
|||
else displayName = displayName["default"];
|
||||
}
|
||||
|
||||
return _t(displayName as string);
|
||||
return displayName ? _t(displayName) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue