Skip to content

Commit be27446

Browse files
Fix in-context translation (#636)
lol language was not being set
1 parent 3aeb4b6 commit be27446

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/messages/TranslationProvider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* SPDX-License-Identifier: MIT
55
*/
6-
import { useSettings } from "../store";
6+
import { inContextTranslationLangId, useSettings } from "../store";
77
import { IntlProvider, MessageFormatElement } from "react-intl";
88
import { ReactNode, useEffect, useState } from "react";
99
import { retryAsyncLoad } from "./chunk-util";
@@ -17,7 +17,7 @@ async function loadLocaleData(locale: string) {
1717
);
1818
const importLanguage =
1919
(flags.translationPreview && languageSetting?.ui === "preview") ||
20-
languageSetting?.ui === true;
20+
languageSetting?.ui === true || lang === inContextTranslationLangId;
2121
if (importLanguage) {
2222
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2323
return (await import(`./ui.${lang}.json`)).default as Messages;

src/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ export const useHasNoStoredData = (): boolean => {
13881388

13891389
type UseSettingsReturn = [Settings, (settings: Partial<Settings>) => void];
13901390

1391-
const inContextTranslationLangId = "lol";
1391+
export const inContextTranslationLangId = "lol";
13921392

13931393
export const useSettings = (): UseSettingsReturn => {
13941394
const [settings, setSettings] = useStore(

0 commit comments

Comments
 (0)