-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
I think there is an error with support for the Norwegian language in Flutter/Dart. The documentation says that Norwegian is supported, but it lists the language code as "no". The most common form of Norwegian is Norsk Bokmål, and when running Platform.localeName with the device in Norwegian, you get the language code "nb_NO".
I have added supported locales to my app like so:
supportedLocales: [
const Locale('en', ''),
const Locale('nb', ''),
],
When using 'no' instead of 'nb' the app just thinks it is in English and shows all English strings. When I use 'nb', the Norwegian strings are shown but a lot of platform things seem to be wrong. When the device is in English, everything runs fine as expected. But with no code changes and just switching the device to Norwegian, I start seeing other errors. For just two examples, in Norwegian, opening my app immediately throws
I/flutter ( 5566): The following NoSuchMethodError was thrown building TabBar(dirty, state: _TabBarState#b4d87):
I/flutter ( 5566): The method 'tabLabel' was called on null.
I just use a DefaultTabController with two Tabs inside of a TabBar
When I try opening an AlertDialog in Norwegian, I get
E/flutter ( 5566): NoSuchMethodError: The getter 'modalBarrierDismissLabel' was called on null. and no dialog shows.
I do think the problem has to do with Flutter/Dart expecting 'no' instead of 'nb'. I am not sure if any vendors actually use the ISO 639-1 code for "Norsk" but I have tested on a Samsung Galaxy S8+, Pixel 2 XL, Nexus 5, and an API 27 x86 emulator and all of those return a locale as 'nb_NO'. I tried switching the language to Nynorsk (the other Norwegian language, 'nn') but Android itself doesn't seem to really support that one.
This project is still WIP and I am learning Flutter, but if you want a project that can reproduce these bugs easily, you can find my small app here.
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.3.2, on Microsoft Windows [Version 10.0.17134.48], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)
• No issues found!