Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Don't update settings.locale with our detected locale from OS to avoi…
Browse files Browse the repository at this point in the history
…d the crash caused by CEF loading the resources.

Also remove the mappings that we put in before to fix crashes for Chinese OSes and Brazilian Portuguese.
  • Loading branch information
RaymondLim committed Oct 10, 2012
1 parent 5f4cf3c commit 6d738fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
5 changes: 4 additions & 1 deletion appshell/cefclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app) {
}
}

CefString(&settings.locale) = app->GetCurrentLanguage();
// Don't update the settings.locale with the locale that we detected from the OS.
// Otherwise, CEF will use it to find the resources and when it fails in finding resources
// for some locales that are not available in resources, it crashes.
//CefString(&settings.locale) = app->GetCurrentLanguage( );

CefString(&settings.javascript_flags) =
g_command_line->GetSwitchValue(cefclient::kJavascriptFlags);
Expand Down
11 changes: 0 additions & 11 deletions appshell/client_app_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@

NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0];

// Remap zh-Hans --> zh-CN and zh-Hant --> zh-TW so that CEF3 can find the corresponding localized resources.
// We may need to remove these two lines in the future if CEF3 switches to the newer locale names.
language = [language stringByReplacingOccurrencesOfString:@"Hans" withString:@"CN"];
language = [language stringByReplacingOccurrencesOfString:@"Hant" withString:@"TW"];

// Remap pt --> pt-BR so that we can load the CEF3 resource for Brazilian Portuguese.
// [rlim] I believe this is the last one that we have to remap. If we find any to reamp again,
// then we should just switch to CFLocaleCopyPreferredLanguages() instead of [[NSLocale preferredLanguages].
if ([language isEqualToString:@"pt"])
language = [language stringByReplacingOccurrencesOfString:@"pt" withString:@"pt-BR"];

CefString result = [language UTF8String];
return result;
}
Expand Down

0 comments on commit 6d738fa

Please sign in to comment.