[Pkg-sugar-commit] [sugar-toolkit-gtk3] 06/08: Remove new line chars when create linfo files

Jonas Smedegaard dr at jones.dk
Sat May 30 09:38:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v0.105.0
in repository sugar-toolkit-gtk3.

commit 954be953ca37ffee552e54c445daf7102c3d7d42
Author: Gonzalo Odiard <godiard at gmail.com>
Date:   Tue Apr 14 09:57:23 2015 -0300

    Remove new line chars when create linfo files
    
    If a translator add a '\n' char in the summary translation
    ConfigParser can't parse the linfo file.
    Remove them when the file is created and show a message to warning
    to the developer.
---
 src/sugar3/activity/bundlebuilder.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/sugar3/activity/bundlebuilder.py b/src/sugar3/activity/bundlebuilder.py
index d1095aa..23a1ad6 100644
--- a/src/sugar3/activity/bundlebuilder.py
+++ b/src/sugar3/activity/bundlebuilder.py
@@ -144,6 +144,11 @@ class Builder(object):
             cat = gettext.GNUTranslations(open(mo_file, 'r'))
             translated_name = cat.gettext(self.config.activity_name)
             translated_summary = cat.gettext(self.config.summary)
+            if translated_summary.find('\n') > -1:
+                translated_summary = translated_summary.replace('\n', '')
+                logging.warn(
+                    'Translation of summary on file %s have \\n chars. '
+                    'Should be removed' % file_name)
             linfo_file = os.path.join(localedir, 'activity.linfo')
             f = open(linfo_file, 'w')
             f.write('[Activity]\nname = %s\n' % translated_name)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit-gtk3.git



More information about the pkg-sugar-commit mailing list