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): |