Skip to content

Flutter on iOS always chooses English for localization, even if the system's preferred language is not english #14128

@pcomans

Description

@pcomans

Steps to Reproduce

I have two languages set up on iOS and Android:

  • German
  • English

German is the preferred language of the system, meaning the OS and most apps appear in German.

I created an app that has translations for both English and German:

    return new MaterialApp(
      localizationsDelegates: <LocalizationsDelegate<dynamic>>[
        new _MyLocalizationsDelegate(),
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
      ],
      supportedLocales: [
        const Locale('de', 'DE'), // German
        const Locale('en', 'US'), // English
      ],
      title: "MyApp",
      home: new Home(),
    );
class _MyLocalizationsDelegate extends LocalizationsDelegate<MyStrings> {
  @override
  Future<MyStrings> load(Locale locale) => MyStrings.load(locale);

  @override
  bool shouldReload(_MyLocalizationsDelegate old) => false;
  @override
  bool isSupported(Locale locale) =>
      locale.languageCode == 'en' ||
      locale.languageCode == 'de';
}

On Android, this app appears in German. On iOS, it appears in English.
The only way to force the app to appear in German is to remove English as a secondary language of the system.

Is this a bug? Am I missing something?

Flutter Doctor

[✓] Flutter (on Mac OS X 10.12.6 16G1036, locale en-US, channel alpha-chq)
    • Flutter at /Users/philipp/code/flutter
    • Framework revision 0bd83f8c34 (12 days ago), 2018-01-04 18:01:44 -0800
    • Engine revision edaecdc8b8
    • Tools Dart version 1.25.0-dev.11.0
    • Engine Dart version 2.0.0-edge.d8ae797298c3a6cf8dc9f4558707bd2672224d3e

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/philipp/Library/Android/sdk
    • Android NDK at /Users/philipp/Library/Android/sdk/ndk-bundle
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[-] iOS toolchain - develop for iOS devices (Xcode 9.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.2, Build version 9C40b
    ✗ Verify that all connected devices have been paired with this computer in Xcode.
      If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
      To update, run:
        brew uninstall --ignore-dependencies libimobiledevice
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    • ios-deploy 1.9.2
    • CocoaPods version 1.4.0.beta.2

[✓] Android Studio
    • Android Studio at /Applications/Android Studio 3.1 Preview.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1012-b01)

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.2.5)
    • Flutter plugin version 18.4
    • Dart plugin version 172.4343.25

Metadata

Metadata

Assignees

Labels

customer: mulligan (g3)d: api docsIssues with https://api.flutter.dev/platform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions