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

Unified Diff: grit/format/chrome_messages_json.py

Issue 1410023007: Skip missing translations when generating JSON resources. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Created 5 years, 2 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
Index: grit/format/chrome_messages_json.py
diff --git a/grit/format/chrome_messages_json.py b/grit/format/chrome_messages_json.py
index be934ab1175924657a79796dbf0def4c2464ec5f..4c3a473a573afc7daa3452cd224ee5db23beb344 100644
--- a/grit/format/chrome_messages_json.py
+++ b/grit/format/chrome_messages_json.py
@@ -28,8 +28,18 @@ def Format(root, lang='en', output_dir='.'):
if id.startswith('IDR_') or id.startswith('IDS_'):
id = id[4:]
- loc_message = encoder.encode(child.ws_at_start + child.Translate(lang) +
- child.ws_at_end)
+ cliques = child.GetCliques()
+ assert cliques
+ translation = cliques[0].MessageForLanguage(
+ lang, pseudo_if_no_match=child.PseudoIsAllowed(),
+ fallback_to_english=False, none_if_no_match=True)
+
+ # Skip the string if it's not translated.
+ if translation == None:
Jamie 2015/10/27 19:25:13 Prefer "translation is not None" (https://google-s
Sergey Ulanov 2016/02/06 01:03:17 Done.
+ continue;
+
+ loc_message = encoder.encode(
+ child.ws_at_start + translation.GetRealContent() + child.ws_at_end)
if not first:
yield ',\n'

Powered by Google App Engine
This is Rietveld 408576698