Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7495)

Unified Diff: chrome/browser/web_applications/web_app_mac.mm

Issue 1137373003: [Mac] Localize app shims with the OS preferred language. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete existing shims in CreateShortcuts. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_applications/web_app_mac.mm
diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm
index aaa84468fc4000a01a92bcbb37aec064e106ef7b..091a667ba8cafbd52080c97221cdb189fcd3069f 100644
--- a/chrome/browser/web_applications/web_app_mac.mm
+++ b/chrome/browser/web_applications/web_app_mac.mm
@@ -743,13 +743,16 @@ bool WebAppShortcutCreator::CreateShortcuts(
path_to_add_to_dock = base::SysUTF8ToNSString(
applications_dir.Append(GetShortcutBasename()).AsUTF8Unsafe());
} else {
+ base::DeleteFile(GetInternalShortcutPath(), true);
paths.push_back(app_data_dir_);
}
bool shortcut_visible =
creation_locations.applications_menu_location != APP_MENU_LOCATION_HIDDEN;
- if (shortcut_visible)
+ if (shortcut_visible) {
+ base::DeleteFile(GetApplicationsShortcutPath(), true);
paths.push_back(applications_dir);
+ }
DCHECK(!paths.empty());
size_t success_count = CreateShortcutsIn(paths);
@@ -897,9 +900,13 @@ bool WebAppShortcutCreator::UpdatePlist(const base::FilePath& app_path) const {
bool WebAppShortcutCreator::UpdateDisplayName(
const base::FilePath& app_path) const {
- // OSX searches for the best language in the order of preferred languages.
- // Since we only have one localization directory, it will choose this one.
- base::FilePath localized_dir = GetResourcesPath(app_path).Append("en.lproj");
+ // Localization is used to display the app name (rather than the bundle
+ // filename). OSX searches for the best language in the order of preferred
+ // languages, but one of them must be found otherwise it will default to
+ // the filename.
+ NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0];
+ base::FilePath localized_dir = GetResourcesPath(app_path).Append(
+ base::SysNSStringToUTF8(language) + ".lproj");
if (!base::CreateDirectory(localized_dir))
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698