You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native(Expo)输入与相机默认选项语言适配问题咨询

Fixing English Default Menus for TextInput & Camera in Expo React Native

Hey there! I’ve dealt with this exact localization issue in Expo apps before, so let’s break down the steps to get those default system menus (paste/cut for inputs, camera controls) to follow your phone’s system language.

1. Configure App Localization in app.json

This is the foundational step—Expo needs to know which languages your app supports to sync with the system locale.

  • Add supported languages to Expo’s core config:
    In your app.json, update the expo.localizations array to include all languages you want to support (e.g., Simplified Chinese and English):

    "expo": {
      "localizations": ["zh-Hans", "en"],
      // ... other configs
    }
    
  • iOS-specific tweaks:
    Add these settings to the ios.infoPlist section to ensure iOS recognizes your app’s language support and follows the system default:

    "ios": {
      "infoPlist": {
        "CFBundleDevelopmentRegion": "$(DEVELOPMENT_LANGUAGE)",
        "CFBundleLocalizations": ["zh-Hans", "en"]
      }
      // ... other iOS configs
    }
    
  • Android-specific tweaks:
    Define supported locales in the android.resources.locales section to let Android sync the native menus with the system language:

    "android": {
      "resources": {
        "locales": [
          {"name": "zh-rCN", "type": "default"},
          {"name": "en-rUS"}
        ]
      }
      // ... other Android configs
    }
    

2. Sync Camera Controls with System Language

Expo’s Camera component might not automatically pick up the system locale, so we’ll explicitly pass it using expo-localization:

  • First, install the package:

    npx expo install expo-localization
    
  • Import and use it in your Camera screen:

    import * as Localization from 'expo-localization';
    import { Camera } from 'expo-camera';
    
    // In your component
    const systemLocale = Localization.locale;
    
    return (
      <Camera
        locale={systemLocale}
        // ... other Camera props (style, type, etc.)
      />
    );
    

    This tells the Camera component to use the exact locale your phone is set to, which translates its default controls (like capture button labels, permissions prompts) accordingly.

3. Verify & Troubleshoot

  • Restart your dev environment: After modifying app.json, you’ll need to restart the Expo server and rebuild your app (or refresh the Expo Go app if you’re using it—though custom dev clients are more reliable for localization testing).
  • Test system language switch: Change your phone’s system language, restart the app, and check if the TextInput context menus (paste/cut/select) and Camera controls update to the new language.
  • Check Expo SDK version: Older SDK versions might have bugs with native component localization. If you’re on an older version, consider upgrading to the latest stable SDK.

If you still see English menus after these steps, double-check that your app.json config is correctly formatted and that you’ve included the exact language code matching your system’s locale (e.g., zh-Hans for Simplified Chinese, zh-Hant for Traditional Chinese).

内容的提问来源于stack exchange,提问作者Ayyoub

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 07:24:15