From 2cbe96d8158d8977b44a794e73bd6cee1012a184 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 4 Feb 2026 18:03:17 +0200 Subject: [PATCH] feat(mobile/note_actions): integrate text content language switcher --- .../mobile_widgets/mobile_detail_menu.tsx | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx b/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx index 53bb58c50..a60267001 100644 --- a/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx +++ b/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx @@ -7,16 +7,17 @@ import { t } from "../../services/i18n"; import note_create from "../../services/note_create"; import server from "../../services/server"; import { BacklinksList, useBacklinkCount } from "../FloatingButtonsDefinitions"; -import { NoteInfoContent } from "../layout/StatusBar"; +import { getLocaleName, NoteInfoContent } from "../layout/StatusBar"; import ActionButton from "../react/ActionButton"; -import { FormDropdownDivider, FormListItem } from "../react/FormList"; +import { FormDropdownDivider, FormDropdownSubmenu, FormListItem } from "../react/FormList"; import { useNoteContext, useNoteProperty } from "../react/hooks"; import Modal from "../react/Modal"; -import { NoteTypeCodeNoteList, useMimeTypes } from "../ribbon/BasicPropertiesTab"; +import { NoteTypeCodeNoteList, useLanguageSwitcher, useMimeTypes } from "../ribbon/BasicPropertiesTab"; import { NoteContextMenu } from "../ribbon/NoteActions"; import NoteActionsCustom from "../ribbon/NoteActionsCustom"; import { NotePathsWidget, useSortedNotePaths } from "../ribbon/NotePathsTab"; import SimilarNotesTab from "../ribbon/SimilarNotesTab"; +import { useProcessedLocales } from "../type_widgets/options/components/LocaleSelector"; export default function MobileDetailMenu() { const { note, noteContext, parentComponent, ntxId, viewScope, hoistedNoteId } = useNoteContext(); @@ -81,6 +82,7 @@ export default function MobileDetailMenu() { >{t("close_pane_button.close_this_pane")} } + {note.type === "text" && } {note.type === "code" && setCodeNoteSwitcherModalShown(true)}>{t("status_bar.code_note_switcher")}} setNoteInfoModalShown(true)}>{t("note_info_widget.title")} setSimilarNotesModalShown(true)}>{t("similar_notes.title")} @@ -108,6 +110,31 @@ export default function MobileDetailMenu() { ); } +function ContentLanguageSelector({ note }: { note: FNote | null | undefined }) { + const { locales, DEFAULT_LOCALE, currentNoteLanguage, setCurrentNoteLanguage } = useLanguageSwitcher(note); + const { processedLocales } = useProcessedLocales(locales, DEFAULT_LOCALE, currentNoteLanguage ?? DEFAULT_LOCALE.id); + + return ( + + {processedLocales.map((locale, index) => + (typeof locale === "object") ? ( + setCurrentNoteLanguage(locale.id)} + >{locale.name} + ) : ( + + ) + )} + + ); +} + interface WithModal { modalShown: boolean; setModalShown: (shown: boolean) => void;