forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Localized Chromoting Host on Mac and Linux.
This CL implements generation of localizable strings from remoting_strings.grd file. Depending on the platform the localized resources are placed to: - Mac: localized .string and .pak resources are added to each application bundle under 'Resources/<locale>.lproj' - Linux: localized .pak files are placed under 'remoting_locales' directory next to the binary locading them. - Windows: .rc resources are generated from .jinja2 templates and embedded into a relevant binary. Chrome l10n and i18n APIs are used to retrieve the current locale and RTL flag (Mac & Linux). The it2me plugin sets the locale to match the locale of the browser. Collateral changes: - UiString is not used any more. - Increased width of disconnect window message on Mac. - The host plugin version is correctly reported on Mac. - Dialogs use RTL templates in case of RTL languages. No more updating the templates dynamically (Windows). - remoting_unittests.ResourcesTest row runs on Mac, LInux and Windows. - '@' is used for variable substitutions by remoting_localize.py. - HOST_PLUGIN_MIME_TYPE is defined in one place now. - Deleted unused commong_resources.grd. Mac installer and preference panel are not localized yet. BUG=155204 Review URL: https://chromiumcodereview.appspot.com/19803010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213997 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
alexeypa@chromium.org
committed
Jul 26, 2013
1 parent
8d9ba45
commit 40f4268
Showing
54 changed files
with
774 additions
and
590 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "remoting/base/resources.h" | ||
|
||
#include <dlfcn.h> | ||
|
||
#include "base/files/file_path.h" | ||
#include "base/logging.h" | ||
#include "base/path_service.h" | ||
#include "ui/base/resource/resource_bundle.h" | ||
#include "ui/base/ui_base_paths.h" | ||
|
||
namespace remoting { | ||
|
||
namespace { | ||
const char kLocaleResourcesDirName[] = "remoting_locales"; | ||
} // namespace | ||
|
||
bool LoadResources(const std::string& pref_locale) { | ||
if (ui::ResourceBundle::HasSharedInstance()) { | ||
ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources(pref_locale); | ||
} else { | ||
// Retrive the path to the module containing this function. | ||
Dl_info info; | ||
CHECK(dladdr(reinterpret_cast<void*>(&LoadResources), &info) != 0); | ||
|
||
// Point DIR_LOCALES to 'remoting_locales'. | ||
base::FilePath path = base::FilePath(info.dli_fname).DirName(); | ||
PathService::Override(ui::DIR_LOCALES, | ||
path.AppendASCII(kLocaleResourcesDirName)); | ||
|
||
ui::ResourceBundle::InitSharedInstanceLocaleOnly(pref_locale, NULL); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void UnloadResources() { | ||
ui::ResourceBundle::CleanupSharedInstance(); | ||
} | ||
|
||
} // namespace remoting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
#include "remoting/base/resources.h" | ||
#include "base/mac/bundle_locations.h" | ||
#include "ui/base/l10n/l10n_util_mac.h" | ||
#include "ui/base/resource/resource_bundle.h" | ||
|
||
// A dummy class used to locate the host plugin's bundle. | ||
@interface NSBundleLocator : NSObject | ||
@end | ||
|
||
@implementation NSBundleLocator | ||
@end | ||
|
||
namespace remoting { | ||
|
||
bool LoadResources(const std::string& pref_locale) { | ||
if (ui::ResourceBundle::HasSharedInstance()) { | ||
ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources(pref_locale); | ||
} else { | ||
// Use the plugin's bundle instead of the hosting app bundle. | ||
base::mac::SetOverrideFrameworkBundle( | ||
[NSBundle bundleForClass:[NSBundleLocator class]]); | ||
|
||
// Override the locale with the value from Cocoa. | ||
if (pref_locale.empty()) | ||
l10n_util::OverrideLocaleWithCocoaLocale(); | ||
|
||
ui::ResourceBundle::InitSharedInstanceLocaleOnly(pref_locale, NULL); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void UnloadResources() { | ||
ui::ResourceBundle::CleanupSharedInstance(); | ||
} | ||
|
||
} // namespace remoting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "remoting/base/resources.h" | ||
|
||
namespace remoting { | ||
|
||
bool LoadResources(const std::string& pref_locale) { | ||
// Do nothing since .pak files are not used on Windows. | ||
return false; | ||
} | ||
|
||
void UnloadResources() { | ||
} | ||
|
||
} // namespace remoting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
COPYRIGHT=Copyright 2013 Google Inc. All Rights Reserved. | ||
HOST_PLUGIN_FILE_NAME=Chrome Remote Desktop Host | ||
HOST_PLUGIN_DESCRIPTION=Allow another user to access your computer securely over the Internet. | ||
DAEMON_FILE_NAME=Chrome Remote Desktop Host Service | ||
MAC_BUNDLE_ID=com.google.Chrome | ||
MAC_CREATOR=rimZ | ||
MAC_HOST_BUNDLE_ID=com.google.chrome_remote_desktop.remoting_me2me_host | ||
MAC_UNINSTALLER_NAME=Chrome Remote Desktop Host Uninstaller | ||
MAC_UNINSTALLER_BUNDLE_PREFIX=com.google.pkg | ||
MAC_UNINSTALLER_BUNDLE_ID=com.google.chromeremotedesktop.host_uninstaller | ||
MAC_UNINSTALLER_BUNDLE_NAME=Chrome Remote Desktop Host Uninstaller | ||
MAC_PREFPANE_BUNDLE_ID=com.google.chromeremotedesktop.preferences | ||
MAC_PREFPANE_BUNDLE_NAME=Chrome Remote Desktop Host Preferences | ||
MAC_PREFPANE_ICON_LABEL=Chrome Remote
Desktop Host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
COPYRIGHT=Copyright 2013 The Chromium Authors. All Rights Reserved. | ||
HOST_PLUGIN_FILE_NAME=Chromoting Host | ||
HOST_PLUGIN_DESCRIPTION=Allow another user to access your computer securely over the Internet. | ||
DAEMON_FILE_NAME=Chromoting Host Service | ||
MAC_BUNDLE_ID=org.chromium.Chromium | ||
MAC_CREATOR=Cr24 | ||
MAC_HOST_BUNDLE_ID=org.chromium.chromoting.remoting_me2me_host | ||
MAC_UNINSTALLER_NAME=Chromoting Host Uninstaller | ||
MAC_UNINSTALLER_BUNDLE_PREFIX=org.chromium.pkg | ||
MAC_UNINSTALLER_BUNDLE_ID=org.chromium.remoting.host_uninstaller | ||
MAC_UNINSTALLER_BUNDLE_NAME=Chromoting Host Uninstaller | ||
MAC_PREFPANE_BUNDLE_ID=org.chromium.remoting.preferences | ||
MAC_PREFPANE_BUNDLE_NAME=Chromoting Host Preferences | ||
MAC_PREFPANE_ICON_LABEL=Chromoting
Host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.