l10n: Fix exception when switching to Norsk

Exception:

exception = {FlutterError} No MaterialLocalizations found.
  AlertDialog widgets require MaterialLocalizations to be provided by a Localizations widget ances
context = {StatelessElement} AlertDialog(dirty, dependencies:
  [MediaQuery, _LocalizationsScope-[GlobalKey#5646e], Directionality, _InheritedTheme])

Reference:
https://blog.csdn.net/wangyajuncsd/article/details/106930365
https://github.com/flutter/flutter/blob/master/packages/flutter_localizations/lib/src/l10n/generated_material_localizations.dart Line 18605
This commit is contained in:
Calcitem 2021-10-30 12:57:17 +08:00
parent 2e48f98f2a
commit bd2d123225
No known key found for this signature in database
GPG Key ID: F67E4F8CB7B5EED2
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
{
"@@locale": "nn",
"@@locale": "nb",
"appName": "Mølle",
"@appName": {
"description": "The app name"

View File

@ -43,8 +43,8 @@ import 'package:sanmill/generated/intl/l10n_lt.dart';
import 'package:sanmill/generated/intl/l10n_lv.dart';
import 'package:sanmill/generated/intl/l10n_mk.dart';
import 'package:sanmill/generated/intl/l10n_ms.dart';
import 'package:sanmill/generated/intl/l10n_nb.dart';
import 'package:sanmill/generated/intl/l10n_nl.dart';
import 'package:sanmill/generated/intl/l10n_nn.dart';
import 'package:sanmill/generated/intl/l10n_pl.dart';
import 'package:sanmill/generated/intl/l10n_pt.dart';
import 'package:sanmill/generated/intl/l10n_ro.dart';
@ -68,7 +68,7 @@ Map<Locale, String> languageCodeToStrings = {
const Locale('cs'): SCs().languageName,
const Locale('da'): SDa().languageName,
const Locale('de'): SDe().languageName,
const Locale('de','CH'): SDeCh().languageName,
const Locale('de', 'CH'): SDeCh().languageName,
const Locale('el'): SEl().languageName,
const Locale('en'): SEn().languageName,
const Locale('es'): SEs().languageName,
@ -90,7 +90,7 @@ Map<Locale, String> languageCodeToStrings = {
const Locale('mk'): SMk().languageName,
const Locale('ms'): SMs().languageName,
const Locale('nl'): SNl().languageName,
const Locale('nn'): SNn().languageName,
const Locale('nb'): SNb().languageName,
const Locale('pl'): SPl().languageName,
const Locale('pt'): SPt().languageName,
const Locale('ro'): SRo().languageName,
@ -106,7 +106,8 @@ Map<Locale, String> languageCodeToStrings = {
const Locale('uz'): SUz().languageName,
const Locale('vi'): SVi().languageName,
const Locale('zh'): SZh().languageName,
const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'): SZhHant().languageName,
const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'):
SZhHant().languageName,
};
String specialCountryAndRegion = "";