Closed Giz closed 4 years ago
Hi i have the same problem. The local is not picking up the Iphone language settings. I tried to delay the loading but still. It only returns 'en'.
[β] Flutter (Channel dev, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-GB)
β’ Flutter version 1.2.1 at /Users/aroba/flutter
β’ Framework revision 8661d8aecd (6 days ago), 2019-02-14 19:19:53 -0800
β’ Engine revision 3757390fa4
β’ Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
[β] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
β’ Android SDK at /Users/aroba/Library/Android/sdk
β’ Android NDK location not configured (optional; useful for native profiling support)
β’ Platform android-28, build-tools 28.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_152-release-1248-b01)
β’ All Android licenses accepted.
[β] iOS toolchain - develop for iOS devices (Xcode 10.1)
β’ Xcode at /Applications/Xcode.app/Contents/Developer
β’ Xcode 10.1, Build version 10B61
β’ ios-deploy 1.9.4
β’ CocoaPods version 1.6.0
[β] Android Studio (version 3.3)
β’ Android Studio at /Applications/Android Studio.app/Contents
β’ Flutter plugin version 32.0.1
β’ Dart plugin version 182.5124
β’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[β] IntelliJ IDEA Ultimate Edition (version 2018.3.4)
β’ IntelliJ at /Users/aroba/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
β’ Flutter plugin version 33.0.6
β’ Dart plugin version 183.5901
[β] VS Code (version 1.31.1)
β’ VS Code at /Applications/Visual Studio Code.app/Contents
β’ Flutter extension version 2.23.0
[β] Connected device (2 available)
β’ Alexandre Robaβs iPhone β’ 00008020-001324C11450003A β’ ios β’ iOS 12.1.4
β’ iPhone XR β’ F58CB8C8-524D-46EB-9146-19790506D875 β’ ios β’ iOS 12.1 (simulator)
β’ No issues found!
For the moment we tried to solve the problem with this workaround:
static Future<void> _prev;
@override
Future<SystemLocalizations> load(Locale locale) async {
SystemLocalizations localizations = new SystemLocalizations(locale);
print("Loading ${locale.languageCode}");
final current = localizations.load();
final prev = _prev;
_prev = current;
await current;
print("Loaded ${locale.languageCode}");
// workaround
if (prev != null) {
await prev;
await Future.delayed(Duration(milliseconds: 250)); // I don't know if this is necessary
}
print("Returning ${locale.languageCode}");
return localizations;
}
Hi @Giz, Can you please confirm if you still experience this issue on latest Flutter versions (eg: dev, master, stable) ? Thanks.
Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v
.
All system setups can be slightly different, so it's always better to open new issues and reference related issues.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
When the app starts on iOS,
_WidgetsAppState._resolveLocales
is called a first time with an empty list, so the delegates are called to load English resources (the first language). After a while_WidgetsAppState._resolveLocales
is called a second time with the actual local list and the delegates start to load the resources for the required language, e.g. Spanish. The problem is that the UI is shown in the language whose resources required a longer loading time: if the loading of English resources completes after that of Spanish ones, the app is in English even if the system is configured in Spanish.Steps to Reproduce
To reproduce the problem you can start with the minimal internationalization example https://github.com/flutter/website/tree/master/examples/internationalization/minimal and replace method
DemoLocalizationsDelegate.load
with something likeThen set Spanish before English in the phone settings and start the app: the app shows text in Spanish for a moment and immediately switch to English.
Logs