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

Unified Diff: grit/clique.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
« no previous file with comments | « no previous file | grit/format/chrome_messages_json.py » ('j') | grit/format/chrome_messages_json.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/clique.py
diff --git a/grit/clique.py b/grit/clique.py
index 3a979890b8eab9c8aa4d2046f73b896d6766b934..f86aadfac5e9136e8b8433486cc1afffeb5c37a8 100644
--- a/grit/clique.py
+++ b/grit/clique.py
@@ -365,7 +365,8 @@ class MessageClique(object):
if custom_type and not custom_type.Validate(self.GetMessage()):
raise exception.InvalidMessage(self.GetMessage().GetRealContent())
- def MessageForLanguage(self, lang, pseudo_if_no_match=True, fallback_to_english=False):
+ def MessageForLanguage(self, lang, pseudo_if_no_match=True,
+ fallback_to_english=False, none_if_no_match=False):
Jamie 2015/10/27 19:25:13 Optional: AFAICT, the final three parameters to th
Sergey Ulanov 2016/02/06 01:03:17 The existing two flags are specified as booleans i
'''Returns the message/translation for the specified language, providing
a pseudotranslation if there is no available translation and a pseudo-
translation is requested.
@@ -377,6 +378,7 @@ class MessageClique(object):
lang: 'en'
pseudo_if_no_match: True
fallback_to_english: False
+ none_if_no_match: False
Return:
tclib.BaseMessage
@@ -401,9 +403,13 @@ class MessageClique(object):
# If we're not supposed to generate pseudotranslations, we add an error
# report to a list of errors, then fail at a higher level, so that we
# get a list of all messages that are missing translations.
Jamie 2015/10/27 19:25:13 This comment is a bit misleading now that there's
Sergey Ulanov 2016/02/06 01:03:17 Done.
- if not pseudo_if_no_match:
- self.uber_clique._AddMissingTranslation(lang, self, is_error=True)
+ if pseudo_if_no_match:
+ return pseudo.PseudoMessage(self.GetMessage())
+ if none_if_no_match:
+ return None
+
+ self.uber_clique._AddMissingTranslation(lang, self, is_error=True)
return pseudo.PseudoMessage(self.GetMessage())
def AllMessagesThatMatch(self, lang_re, include_pseudo = True):
« no previous file with comments | « no previous file | grit/format/chrome_messages_json.py » ('j') | grit/format/chrome_messages_json.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698