| Index: grit/clique.py
|
| diff --git a/grit/clique.py b/grit/clique.py
|
| index da023288702732d406000b320ad8563a5996b996..64bbdb56ebcd10e08680d0c4979f81b5fe602f74 100644
|
| --- a/grit/clique.py
|
| +++ b/grit/clique.py
|
| @@ -11,6 +11,7 @@ import types
|
|
|
| from grit import constants
|
| from grit import exception
|
| +from grit import lazy_re
|
| from grit import pseudo
|
| from grit import pseudo_rtl
|
| from grit import tclib
|
| @@ -281,9 +282,15 @@ class MessageClique(object):
|
| # special language constants.CONSTANT_LANGUAGE.
|
| CONSTANT_TRANSLATION = tclib.Translation(text='TTTTTT')
|
|
|
| + # A pattern to match messages that are empty or whitespace only.
|
| + WHITESPACE_MESSAGE = lazy_re.compile(u'^( |\t|\n|\r|\xa0)*$')
|
| +
|
| def __init__(self, uber_clique, message, translateable=True, custom_type=None):
|
| '''Create a new clique initialized with just a message.
|
|
|
| + Note that messages with a body comprised only of whitespace will implicitly
|
| + be marked non-translatable.
|
| +
|
| Args:
|
| uber_clique: Our uber-clique (collection of cliques)
|
| message: tclib.Message()
|
| @@ -294,6 +301,12 @@ class MessageClique(object):
|
| self.uber_clique = uber_clique
|
| # If not translateable, we only store the original message.
|
| self.translateable = translateable
|
| +
|
| + # We implicitly mark messages that have a whitespace-only body as
|
| + # non-translateable.
|
| + if MessageClique.WHITESPACE_MESSAGE.match(message.GetRealContent()):
|
| + self.translateable = False
|
| +
|
| # A mapping of language identifiers to tclib.BaseMessage and its
|
| # subclasses (i.e. tclib.Message and tclib.Translation).
|
| self.clique = { MessageClique.source_language : message }
|
|
|