Part of lp.translations.utilities.sanitize View In Hierarchy
Method | __init__ | Extract information from the English singular. |
Method | sanitize | Return 'translation_text' or None after doing some sanitization. |
Method | convertDotToSpace | Return 'translation_text' with the 'dot' char exchanged with a |
Method | normalizeWhitespace | Return 'translation_text' with the same trailing and leading |
Method | normalizeNewlines | Return 'translation_text' with newlines sync with english_singular. |
Class Method | _getNewlineStyle | Find out which newline style is used in text. |
The text is sanitized through the following filters:
self.convertDotToSpace self.normalizeWhitespaces self.normalizeNewlines
If the resulting string after these operations is an empty string, it returns None.
Parameters | english_singular | The text of the singular MsgId that this translation is for. |
translation_text | A unicode text that needs to be sanitized. |
If the english_singular contains that character, 'translation_text' is returned without changes as it's a valid char instead of our way to represent a normal space to the user.
If 'translation_text' has only whitespace but english_singular has other characters, the empty string (u'') is returned to note it as an untranslated string.