Complete client UI i18n migration

Adds client-side i18n support, language settings, translated UI copy, and locale parity coverage.
This commit is contained in:
chyendongnhanh338
2026-06-11 14:15:35 +08:00
committed by GitHub
parent 41cf070fd8
commit 08ebe5e7e1
199 changed files with 16426 additions and 1821 deletions
@@ -1,6 +1,7 @@
import { useCallback, useRef } from "react";
import { Alert } from "react-native";
import * as ImagePicker from "expo-image-picker";
import { useTranslation } from "react-i18next";
import { getDesktopHost, isElectronRuntime } from "@/desktop/host";
import {
normalizePickedImageAssets,
@@ -14,6 +15,7 @@ interface UseImageAttachmentPickerResult {
}
export function useImageAttachmentPicker(): UseImageAttachmentPickerResult {
const { t } = useTranslation();
const [mediaPermission, requestMediaPermission] = ImagePicker.useMediaLibraryPermissions();
const isPickingRef = useRef(false);
@@ -31,14 +33,14 @@ export function useImageAttachmentPicker(): UseImageAttachmentPickerResult {
if (!currentPermission?.granted) {
Alert.alert(
"Permission required",
"Please allow access to your photo library to attach images.",
t("imageAttachmentPicker.permissionTitle"),
t("imageAttachmentPicker.permissionMessage"),
);
return false;
}
return true;
}, [mediaPermission, requestMediaPermission]);
}, [mediaPermission, requestMediaPermission, t]);
const pickImages = useCallback(async () => {
if (isPickingRef.current) {
@@ -83,12 +85,12 @@ export function useImageAttachmentPicker(): UseImageAttachmentPickerResult {
return await normalizePickedImageAssets(result.assets);
} catch (error) {
console.error("[ImageAttachmentPicker] Failed to pick image:", error);
Alert.alert("Error", "Failed to select image");
Alert.alert(t("imageAttachmentPicker.errorTitle"), t("imageAttachmentPicker.failedToSelect"));
return null;
} finally {
isPickingRef.current = false;
}
}, [ensurePermission]);
}, [ensurePermission, t]);
return { pickImages };
}