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

Unified Diff: remoting/tools/build/remoting_localize.py

Issue 21059003: Localized Chromoting Host on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 5 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 | « remoting/tools/build/remoting_copy_locales.py ('k') | remoting/tools/verify_resources.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/tools/build/remoting_localize.py
diff --git a/remoting/tools/build/remoting_localize.py b/remoting/tools/build/remoting_localize.py
index 8dc05386790715aaf71f7954d7aab0a74eb09494..6a88884f29292f5e829aec9dd8b083d679237c88 100755
--- a/remoting/tools/build/remoting_localize.py
+++ b/remoting/tools/build/remoting_localize.py
@@ -542,7 +542,10 @@ def IsRtlLanguage(language):
def NormalizeLanguageCode(language):
- return language.replace('_', '-', 1)
+ lang = language.replace('_', '-', 1)
+ if lang == 'en-US':
+ lang = 'en'
+ return lang
def GetDataPackageSuffix(language):
@@ -639,6 +642,12 @@ class MessageMap:
return lambda message: self.GetText(message)
+# Use '@' as a delimiter for string templates instead of '$' to avoid unintended
+# expansion when passing the string from GYP.
+class GypTemplate(Template):
+ delimiter = '@'
+
+
def Localize(source, locales, options):
# Set the list of languages to use.
languages = map(NormalizeLanguageCode, locales)
@@ -701,12 +710,13 @@ def Localize(source, locales, options):
# Generate a separate file per each locale if requested.
outputs = []
if options.locale_output:
- target = Template(options.locale_output)
+ target = GypTemplate(options.locale_output)
for lang in languages:
context['languages'] = [ lang ]
context['language'] = lang
context['pak_suffix'] = GetDataPackageSuffix(lang)
context['json_suffix'] = GetJsonSuffix(lang)
+ message_map.SelectLanguage(lang)
template_file_name = target.safe_substitute(context)
outputs.append(template_file_name)
« no previous file with comments | « remoting/tools/build/remoting_copy_locales.py ('k') | remoting/tools/verify_resources.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698