Split translations between EW and shared components (#31441)
* Split translations between EW and shared components Uses update module API with global TranslationKey type that can be overridden. WIP. * Removed the wrong script (for now) * Add the type files * Add shared components i18n file * More i18n strings * Add i18n check for shared conmponents * Needs a different name * rerun i18n for merge from develop, fix test * Move translated strings to shared components file NB. there are lots of removed strings for a few languages where we seem to have hit a localazy bug or something where the key/value for plurals got switched, making the translations invalid. They've been missing for a while so I'm removing them rather than trying to restore them, * Add shared components files to localazy * Merge element web & shared component translations for the built app * Use right translations for shared component tests and fix missign en_EN strings * Pull shared components translations too * Fix/disable warnings * We can now remove the build:res call ...right? (right?) * Remove webpack import for languages index ..and just load it using a relative path which we do for the individual language files and also did anyway for the index because even in non-test it was an object, not a string, so we always usesd the 'test' code path. * Make the storybook language selector work ...without referring to the parent app's files * Revert unnecessary yarn lock change * Typo Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> * Add comment on why we use merge * Fix localazy download config to actually put the translations in the right place * Better typescript syntax Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> * Watch both translations files --------- Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
co-authored by
Michael Telatynski
parent
4ee04d0661
commit
13696af194
@@ -12,7 +12,7 @@ import sanitizeHtml from "sanitize-html";
|
||||
import classnames from "classnames";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { _t, type TranslationKey } from "../../languageHandler";
|
||||
import { _t } from "../../languageHandler";
|
||||
import dis from "../../dispatcher/dispatcher";
|
||||
import { MatrixClientPeg } from "../../MatrixClientPeg";
|
||||
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||
|
||||
@@ -11,7 +11,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import React, { type JSX } from "react";
|
||||
import classNames from "classnames";
|
||||
|
||||
import { _t, type TranslationKey } from "../../languageHandler";
|
||||
import { _t } from "../../languageHandler";
|
||||
import AutoHideScrollbar from "./AutoHideScrollbar";
|
||||
import { PosthogScreenTracker, type ScreenName } from "../../PosthogTrackers";
|
||||
import { type NonEmptyArray } from "../../@types/common";
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Action } from "../../../../dispatcher/actions";
|
||||
import { asyncSome } from "../../../../utils/arrays";
|
||||
import { getUserDeviceIds } from "../../../../utils/crypto/deviceInfo";
|
||||
import { type RoomMember } from "../../../../models/rooms/RoomMember";
|
||||
import { _t, _td, type TranslationKey } from "../../../../languageHandler";
|
||||
import { _t, _td } from "../../../../languageHandler";
|
||||
import { E2EStatus } from "../../../../utils/ShieldUtils";
|
||||
|
||||
interface MemberTileViewModelProps {
|
||||
|
||||
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { FilterKey } from "../../../stores/room-list-v3/skip-list/filters";
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import RoomListStoreV3, {
|
||||
LISTS_LOADED_EVENT,
|
||||
LISTS_UPDATE_EVENT,
|
||||
|
||||
@@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import React, { type ComponentProps, PureComponent, type Ref } from "react";
|
||||
|
||||
import Field, { type IInputProps } from "../elements/Field";
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import withValidation, { type IFieldState, type IValidationResult } from "../elements/Validation";
|
||||
import * as Email from "../../../email";
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import React, { type ComponentProps, PureComponent, type Ref } from "react";
|
||||
|
||||
import Field, { type IInputProps } from "../elements/Field";
|
||||
import withValidation, { type IFieldState, type IValidationResult } from "../elements/Validation";
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
|
||||
interface IProps extends Omit<IInputProps, "onValidate" | "label" | "element"> {
|
||||
id?: string;
|
||||
|
||||
@@ -12,7 +12,7 @@ import classNames from "classnames";
|
||||
import type { ZxcvbnResult } from "@zxcvbn-ts/core";
|
||||
import SdkConfig from "../../../SdkConfig";
|
||||
import withValidation, { type IFieldState, type IValidationResult } from "../elements/Validation";
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import Field, { type IInputProps } from "../elements/Field";
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import React, { useEffect, useState } from "react";
|
||||
import MediaDeviceHandler, { MediaDeviceKindEnum } from "../../../MediaDeviceHandler";
|
||||
import IconizedContextMenu, { IconizedContextMenuOptionList, IconizedContextMenuRadio } from "./IconizedContextMenu";
|
||||
import { type IProps as IContextMenuProps } from "../../structures/ContextMenu";
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
|
||||
const SECTION_NAMES: Record<MediaDeviceKindEnum, TranslationKey> = {
|
||||
[MediaDeviceKindEnum.AudioInput]: _td("voip|input_devices"),
|
||||
|
||||
@@ -14,7 +14,7 @@ import { sleep } from "matrix-js-sdk/src/utils";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { ErrorIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import Dropdown from "../elements/Dropdown";
|
||||
import SearchBox from "../../structures/SearchBox";
|
||||
|
||||
@@ -10,7 +10,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import React, { type JSX, useState } from "react";
|
||||
import { Form } from "@vector-im/compound-web";
|
||||
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import { TimelineEventEditor } from "./devtools/Event";
|
||||
|
||||
@@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import React, { type ChangeEvent, createRef } from "react";
|
||||
|
||||
import Field from "../elements/Field";
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import { type IFieldState, type IValidationResult } from "../elements/Validation";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import DialogButtons from "../elements/DialogButtons";
|
||||
|
||||
@@ -14,7 +14,7 @@ import BaseTool, { DevtoolsContext, type IDevtoolsProps } from "./BaseTool";
|
||||
import MatrixClientContext from "../../../../contexts/MatrixClientContext";
|
||||
import { EventEditor, EventViewer, eventTypeField, type IEditorProps, stringify } from "./Event";
|
||||
import FilteredList from "./FilteredList";
|
||||
import { _td, type TranslationKey } from "../../../../languageHandler";
|
||||
import { _td } from "../../../../languageHandler";
|
||||
|
||||
export const AccountDataEventEditor: React.FC<IEditorProps> = ({ mxEvent, onBack }) => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
|
||||
@@ -11,7 +11,7 @@ import React, { createContext, type ReactNode, useState } from "react";
|
||||
import { type Room } from "matrix-js-sdk/src/matrix";
|
||||
import classNames from "classnames";
|
||||
|
||||
import { _t, type TranslationKey } from "../../../../languageHandler";
|
||||
import { _t } from "../../../../languageHandler";
|
||||
import { type XOR } from "../../../../@types/common";
|
||||
import { type Tool } from "../DevtoolsDialog";
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import React, { type ChangeEvent, type ReactNode, useContext, useMemo, useRef, useState } from "react";
|
||||
import { type IContent, type MatrixEvent, type TimelineEvents } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { _t, _td, type TranslationKey } from "../../../../languageHandler";
|
||||
import { _t, _td } from "../../../../languageHandler";
|
||||
import Field from "../../elements/Field";
|
||||
import BaseTool, { DevtoolsContext, type IDevtoolsProps } from "./BaseTool";
|
||||
import MatrixClientContext from "../../../../contexts/MatrixClientContext";
|
||||
|
||||
@@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import React from "react";
|
||||
import classNames from "classnames";
|
||||
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import BaseDialog from "..//dialogs/BaseDialog";
|
||||
import DialogButtons from "./DialogButtons";
|
||||
import AccessibleButton from "./AccessibleButton";
|
||||
|
||||
@@ -12,7 +12,7 @@ import classNames from "classnames";
|
||||
import { Tooltip } from "@vector-im/compound-web";
|
||||
import { ErrorSolidIcon, ShieldIcon, LockSolidIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import AccessibleButton from "../elements/AccessibleButton";
|
||||
import { E2EStatus } from "../../../utils/ShieldUtils";
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import { type ActionPayload } from "../../../dispatcher/payloads.ts";
|
||||
import { type ViewRoomDeltaPayload } from "../../../dispatcher/payloads/ViewRoomDeltaPayload.ts";
|
||||
import { type ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload.ts";
|
||||
import { useEventEmitterState } from "../../../hooks/useEventEmitter.ts";
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler.tsx";
|
||||
import { _t, _td } from "../../../languageHandler.tsx";
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg.ts";
|
||||
import PosthogTrackers from "../../../PosthogTrackers.ts";
|
||||
import SettingsStore from "../../../settings/SettingsStore.ts";
|
||||
|
||||
@@ -13,7 +13,7 @@ import { ErrorSolidIcon } from "@vector-im/compound-design-tokens/assets/web/ico
|
||||
|
||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||
import DMRoomMap from "../../../utils/DMRoomMap";
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import AccessibleButton, { type ButtonEvent } from "../elements/AccessibleButton";
|
||||
import MiniAvatarUploader, { AVATAR_SIZE } from "../elements/MiniAvatarUploader";
|
||||
import RoomAvatar from "../avatars/RoomAvatar";
|
||||
|
||||
@@ -10,7 +10,7 @@ import { type Room, ClientEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { type IWidget } from "matrix-widget-api";
|
||||
|
||||
import { _t, _td, type TranslationKey } from "../../../languageHandler";
|
||||
import { _t, _td } from "../../../languageHandler";
|
||||
import AppTile from "../elements/AppTile";
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
import dis from "../../../dispatcher/dispatcher";
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Icon as UnknownDeviceIcon } from "../../../../../res/img/element-icons/
|
||||
import { Icon as DesktopIcon } from "../../../../../res/img/element-icons/settings/desktop.svg";
|
||||
import { Icon as WebIcon } from "../../../../../res/img/element-icons/settings/web.svg";
|
||||
import { Icon as MobileIcon } from "../../../../../res/img/element-icons/settings/mobile.svg";
|
||||
import { _t, _td, type TranslationKey } from "../../../../languageHandler";
|
||||
import { _t, _td } from "../../../../languageHandler";
|
||||
import { type ExtendedDevice } from "./types";
|
||||
import { DeviceType } from "../../../../utils/device/parseUserAgent";
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { throttle, get, set } from "lodash";
|
||||
import { KnownMembership, type RoomPowerLevelsEventContent } from "matrix-js-sdk/src/types";
|
||||
|
||||
import { _t, _td, type TranslationKey } from "../../../../../languageHandler";
|
||||
import { _t, _td } from "../../../../../languageHandler";
|
||||
import AccessibleButton from "../../../elements/AccessibleButton";
|
||||
import Modal from "../../../../../Modal";
|
||||
import ErrorDialog from "../../../dialogs/ErrorDialog";
|
||||
|
||||
Reference in New Issue
Block a user