Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -956,27 +956,8 @@ - (void)setIsGpuDisabled:(BOOL)value {
#pragma mark - Locale updates

- (void)onLocaleUpdated:(NSNotification*)notification {
// [NSLocale currentLocale] provides an iOS resolved locale if the
// supported locales are exposed to the iOS embedder. Here, we get
// currentLocale and pass it to dart:ui
// Get and pass the user's preferred locale list to dart:ui.
NSMutableArray<NSString*>* localeData = [[[NSMutableArray alloc] init] autorelease];
NSLocale* platformResolvedLocale = [NSLocale currentLocale];
NSString* languageCode = [platformResolvedLocale objectForKey:NSLocaleLanguageCode];
NSString* countryCode = [platformResolvedLocale objectForKey:NSLocaleCountryCode];
NSString* scriptCode = [platformResolvedLocale objectForKey:NSLocaleScriptCode];
NSString* variantCode = [platformResolvedLocale objectForKey:NSLocaleVariantCode];
if (languageCode) {
[localeData addObject:languageCode];
[localeData addObject:(countryCode ? countryCode : @"")];
[localeData addObject:(scriptCode ? scriptCode : @"")];
[localeData addObject:(variantCode ? variantCode : @"")];
}
if (localeData.count != 0) {
[self.localizationChannel invokeMethod:@"setPlatformResolvedLocale" arguments:localeData];
}

// Get and pass the user's preferred locale list to dart:ui
localeData = [[[NSMutableArray alloc] init] autorelease];
NSArray<NSString*>* preferredLocales = [NSLocale preferredLanguages];
for (NSString* localeID in preferredLocales) {
NSLocale* locale = [[[NSLocale alloc] initWithLocaleIdentifier:localeID] autorelease];
Expand Down