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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/web_applications/web_app_mac.h" 5 #import "chrome/browser/web_applications/web_app_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 switches::kEnableAppsFileAssociations)) { 890 switches::kEnableAppsFileAssociations)) {
891 UpdateFileTypes(plist, file_handlers_info_); 891 UpdateFileTypes(plist, file_handlers_info_);
892 } 892 }
893 893
894 return [plist writeToFile:plist_path 894 return [plist writeToFile:plist_path
895 atomically:YES]; 895 atomically:YES];
896 } 896 }
897 897
898 bool WebAppShortcutCreator::UpdateDisplayName( 898 bool WebAppShortcutCreator::UpdateDisplayName(
899 const base::FilePath& app_path) const { 899 const base::FilePath& app_path) const {
900 // OSX searches for the best language in the order of preferred languages. 900 // Localization is used to display the app name (rather than the bundle
901 // Since we only have one localization directory, it will choose this one. 901 // filename). OSX searches for the best language in the order of preferred
902 base::FilePath localized_dir = GetResourcesPath(app_path).Append("en.lproj"); 902 // languages, but one of them must be found otherwise it will default to
903 // the filename.
904 NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0];
tapted 2015/05/14 07:53:14 should it use l10n_util::NormalizeLocale(l10n_util
jackhou1 2015/05/15 00:41:08 With the app shim, we don't actually care what lan
905 base::FilePath localized_dir = GetResourcesPath(app_path).Append(
906 base::SysNSStringToUTF8(language) + ".lproj");
903 if (!base::CreateDirectory(localized_dir)) 907 if (!base::CreateDirectory(localized_dir))
904 return false; 908 return false;
905 909
906 NSString* bundle_name = base::SysUTF16ToNSString(info_->title); 910 NSString* bundle_name = base::SysUTF16ToNSString(info_->title);
907 NSString* display_name = base::SysUTF16ToNSString(info_->title); 911 NSString* display_name = base::SysUTF16ToNSString(info_->title);
908 if (HasExistingExtensionShim(GetApplicationsDirname(), info_->extension_id, 912 if (HasExistingExtensionShim(GetApplicationsDirname(), info_->extension_id,
909 app_path.BaseName())) { 913 app_path.BaseName())) {
910 display_name = [bundle_name 914 display_name = [bundle_name
911 stringByAppendingString:base::SysUTF8ToNSString( 915 stringByAppendingString:base::SysUTF8ToNSString(
912 " (" + info_->profile_name + ")")]; 916 " (" + info_->profile_name + ")")];
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 web_app::GetShortcutInfoForApp( 1212 web_app::GetShortcutInfoForApp(
1209 app, 1213 app,
1210 profile, 1214 profile,
1211 base::Bind(&web_app::CreateAppShortcutInfoLoaded, 1215 base::Bind(&web_app::CreateAppShortcutInfoLoaded,
1212 profile, 1216 profile,
1213 app, 1217 app,
1214 close_callback)); 1218 close_callback));
1215 } 1219 }
1216 1220
1217 } // namespace chrome 1221 } // namespace chrome
OLDNEW
« 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