def test_comments_text_representation_multiline(self): # Comments with newlines should be correctly exported. data = TranslationMessageData() data.comment = "Line One\nLine Two" self.assertEqual("#Line One\n#Line Two", comments_text_representation(data)) # It works the same when there's a final newline as well. data.comment = "Line One\nLine Two\n" self.assertEqual("#Line One\n#Line Two", comments_text_representation(data)) # And similar processing happens for source comments. data = TranslationMessageData() data.source_comment = "Line One\nLine Two" self.assertEqual("#. Line One\n#. Line Two", comments_text_representation(data)) # It works the same when there's a final newline as well. data.source_comment = "Line One\nLine Two\n" self.assertEqual("#. Line One\n#. Line Two", comments_text_representation(data))
def _makeExportedHeader(self, translation_file): """Create a standard gettext PO header, encoded as a message. :return: The header message as a unicode string. """ header_translation_message = TranslationMessageData() header_translation_message.addTranslation( TranslationConstants.SINGULAR_FORM, translation_file.header.getRawContent()) header_translation_message.comment = (translation_file.header.comment) if translation_file.is_template: header_translation_message.flags.update(['fuzzy']) exported_header = self.exportTranslationMessageData( header_translation_message) return exported_header
def _makeExportedHeader(self, translation_file): """Create a standard gettext PO header, encoded as a message. :return: The header message as a unicode string. """ header_translation_message = TranslationMessageData() header_translation_message.addTranslation( TranslationConstants.SINGULAR_FORM, translation_file.header.getRawContent()) header_translation_message.comment = ( translation_file.header.comment) if translation_file.is_template: header_translation_message.flags.update(['fuzzy']) exported_header = self.exportTranslationMessageData( header_translation_message) return exported_header