From ba6d84c917c9b562a417110f6d58424e54721a66 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 8 May 2016 22:08:17 +0200 Subject: [PATCH] Always use unix line ends in .pot files Otherwise gettext creates files with stray '\r' in comment lines on windows. --- po/lyx_pot.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/po/lyx_pot.py b/po/lyx_pot.py index 500185fdba..a58d8bfe06 100755 --- a/po/lyx_pot.py +++ b/po/lyx_pot.py @@ -44,7 +44,7 @@ def writeString(outfile, infile, basefile, lineno, string): def ui_l10n(input_files, output, base): '''Generate pot file from lib/ui/*''' - output = io.open(output, 'w', encoding='utf_8') + output = io.open(output, 'w', encoding='utf_8', newline='\n') Submenu = re.compile(r'^[^#]*Submenu\s+"([^"]*)"', re.IGNORECASE) Popupmenu = re.compile(r'^[^#]*PopupMenu\s+"[^"]+"\s+"([^"]*)"', re.IGNORECASE) IconPalette = re.compile(r'^[^#]*IconPalette\s+"[^"]+"\s+"([^"]*)"', re.IGNORECASE) @@ -166,7 +166,10 @@ def layouts_l10n(input_files, output, base, layouttranslations): if 'wa' in languages: languages.remove('wa') - out = io.open(output, 'w', encoding='utf_8') + if layouttranslations: + out = io.open(output, 'w', encoding='utf_8') + else: + out = io.open(output, 'w', encoding='utf_8', newline='\n') for src in input_files: readingDescription = False readingI18nPreamble = False @@ -433,7 +436,7 @@ def layouts_l10n(input_files, output, base, layouttranslations): def qt4_l10n(input_files, output, base): '''Generate pot file from src/frontends/qt4/ui/*.ui''' - output = io.open(output, 'w', encoding='utf_8') + output = io.open(output, 'w', encoding='utf_8', newline='\n') pat = re.compile(r'\s*(.*)') prop = re.compile(r'\s*