Skip to content

Commit

Permalink
Pass scriptCode into Locale on initialization. (flutter#6711)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryQian authored Nov 7, 2018
1 parent e61f052 commit 6fa5c0a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/ui/hooks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ void _updateLocales(List<String> locales) {
final int numLocales = locales.length ~/ stringsPerLocale;
window._locales = new List<Locale>(numLocales);
for (int localeIndex = 0; localeIndex < numLocales; localeIndex++) {
window._locales[localeIndex] = new Locale(locales[localeIndex * stringsPerLocale],
locales[localeIndex * stringsPerLocale + 1]);
final String countryCode = locales[localeIndex * stringsPerLocale + 1];
final String scriptCode = locales[localeIndex * stringsPerLocale + 2];

window._locales[localeIndex] = new Locale.fromSubtags(
languageCode: locales[localeIndex * stringsPerLocale],
countryCode: countryCode.isEmpty ? null : countryCode,
scriptCode: scriptCode.isEmpty ? null : scriptCode,
);
}
_invoke(window.onLocaleChanged, window._onLocaleChangedZone);
}
Expand Down

0 comments on commit 6fa5c0a

Please sign in to comment.