From b5160c47b375ed32e7d32bb28efb9ace8f68efca Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Fri, 25 Jul 2025 10:14:48 +0200 Subject: [PATCH] chore: move i18n.tsx into utils folder (#30400) --- .storybook/preview.tsx | 2 +- src/accessibility/KeyboardShortcuts.ts | 2 +- src/languageHandler.tsx | 4 ++-- src/settings/Settings.tsx | 2 +- src/shared-components/{ => utils}/i18n.tsx | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename src/shared-components/{ => utils}/i18n.tsx (99%) diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 904405c75a..b7f05badf3 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -5,7 +5,7 @@ import "../res/css/shared.pcss"; import "./preview.css"; import React, { useLayoutEffect } from "react"; import { FORCE_RE_RENDER } from "storybook/internal/core-events"; -import { setLanguage } from "../src/shared-components/i18n"; +import { setLanguage } from "../src/shared-components/utils/i18n"; import { TooltipProvider } from "@vector-im/compound-web"; export const globalTypes = { diff --git a/src/accessibility/KeyboardShortcuts.ts b/src/accessibility/KeyboardShortcuts.ts index a1b18a106c..21ea5abb02 100644 --- a/src/accessibility/KeyboardShortcuts.ts +++ b/src/accessibility/KeyboardShortcuts.ts @@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details. */ // Import i18n.tsx instead of languageHandler to avoid circular deps -import { _td, type TranslationKey } from "../shared-components/i18n"; +import { _td, type TranslationKey } from "../shared-components/utils/i18n"; import { IS_MAC, IS_ELECTRON, Key } from "../Keyboard"; import { type IBaseSetting } from "../settings/Settings"; import { type KeyCombo } from "../KeyBindingsManager"; diff --git a/src/languageHandler.tsx b/src/languageHandler.tsx index 9ac6cce1c5..17a8432c27 100644 --- a/src/languageHandler.tsx +++ b/src/languageHandler.tsx @@ -25,7 +25,7 @@ import { type IVariables, KEY_SEPARATOR, getLangsJson, -} from "./shared-components/i18n"; +} from "./shared-components/utils/i18n"; export { _t, @@ -40,7 +40,7 @@ export { normalizeLanguageKey, getNormalizedLanguageKeys, substitute, -} from "./shared-components/i18n"; +} from "./shared-components/utils/i18n"; const i18nFolder = "i18n/"; diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 4ed3752372..62a24214b9 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -12,7 +12,7 @@ import { UNSTABLE_MSC4133_EXTENDED_PROFILES } from "matrix-js-sdk/src/matrix"; import { type MediaPreviewConfig } from "../@types/media_preview.ts"; // Import i18n.tsx instead of languageHandler to avoid circular deps -import { _t, _td, type TranslationKey } from "../shared-components/i18n"; +import { _t, _td, type TranslationKey } from "../shared-components/utils/i18n"; import DeviceIsolationModeController from "./controllers/DeviceIsolationModeController.ts"; import { NotificationBodyEnabledController, diff --git a/src/shared-components/i18n.tsx b/src/shared-components/utils/i18n.tsx similarity index 99% rename from src/shared-components/i18n.tsx rename to src/shared-components/utils/i18n.tsx index e23acff831..17ff4863c0 100644 --- a/src/shared-components/i18n.tsx +++ b/src/shared-components/utils/i18n.tsx @@ -25,7 +25,7 @@ import React from "react"; import { type TranslationKey as _TranslationKey, KEY_SEPARATOR } from "matrix-web-i18n"; import counterpart from "counterpart"; -import type Translations from "../i18n/strings/en_EN.json"; +import type Translations from "../../i18n/strings/en_EN.json"; // @ts-ignore - $webapp is a webpack resolve alias pointing to the output directory, see webpack config import webpackLangJsonUrl from "$webapp/i18n/languages.json";