diff --git a/CMakeLists.txt b/CMakeLists.txt index c29e4fa48d878a4d2da264d43c6ba0f8715cea04..dc6eadd19325181ef7feca2ac16f0f60dec06d6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,7 +208,7 @@ include(cmake/rcc.cmake) # Simple command calling the python script add_custom_command( OUTPUT retrievePoFilesFromSvn - COMMAND python2 tools/l10n-fetch-po-files.py + COMMAND python tools/l10n-fetch-po-files.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) # Install translations @@ -217,7 +217,7 @@ add_custom_target(getSvnTranslations COMMENT "Re-run cmake after this to be able to run BuildTranslations with the latest files" ) -# Get all po files in po/. You can get them doing: python2 tools/l10n-fetch-po-files.py +# Get all po files in po/. You can get them doing: python tools/l10n-fetch-po-files.py file(GLOB TRANSLATIONS_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "po/*.po") # Set the output dir for the translation files to /bin foreach(PoSource ${TRANSLATIONS_FILES}) diff --git a/tools/convertPoToTsFiles/mergePo.py b/tools/convertPoToTsFiles/mergePo.py index 12f7d000d9658fc78f9cc82dea6ddca3edc53574..6c5d5fffd718326ed8e930af0306bae076287390 100755 --- a/tools/convertPoToTsFiles/mergePo.py +++ b/tools/convertPoToTsFiles/mergePo.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python # # GCompris - mergePo.py # @@ -19,12 +19,12 @@ # Using polib.py from https://bitbucket.org/izi/polib/wiki/Home -# Usage : python2 mergePo.py qt.po gtk.po +# Usage : python mergePo.py qt.po gtk.po # Find in the first argument po file the translated lines of the gtk po file # (if existing) and replace the translation for the po file. # For those not found, no translation is provided. -# something like: python2 mergePo.py gcompris_fi.po fi.po && sed '/^#|/ d' < gcompris_fi.po > qtgl.po && mv qtgl.po gcompris_fi.po +# something like: python mergePo.py gcompris_fi.po fi.po && sed '/^#|/ d' < gcompris_fi.po > qtgl.po && mv qtgl.po gcompris_fi.po import sys import polib diff --git a/tools/l10n-fetch-po-files.py b/tools/l10n-fetch-po-files.py index bc7f06cfa4c8b7dd03da184db99783973831add5..7429aa784dd7f68b8dbd77af51a030894d59f3c2 100644 --- a/tools/l10n-fetch-po-files.py +++ b/tools/l10n-fetch-po-files.py @@ -43,13 +43,13 @@ if not os.path.exists(OUTPUT_PO_PATH): all_languages = subprocess.check_output(['svn', 'cat', SVN_PATH + 'subdirs'], stderr=subprocess.STDOUT) -all_languages = [x.strip() for x in all_languages.split("\n") if len(x)] +all_languages = [x.strip() for x in all_languages.decode().split("\n") if len(x)] all_languages.remove("x-test") for lang in all_languages: try: raw_data = subprocess.check_output(['svn', 'cat', SVN_PATH + lang + SOURCE_PO_PATH], stderr=subprocess.PIPE) - (transformed, subs) = fixer.subn('# ~| ', raw_data) + (transformed, subs) = fixer.subn('# ~| ', raw_data.decode()) pos1 = re_empty_msgid.search(transformed).start() pos2 = re_empty_line.search(transformed).start() if re_has_qt_contexts.search(transformed, pos1, pos2) is None: @@ -58,12 +58,13 @@ for lang in all_languages: transformed[pos2:] subs = subs + 1 if (subs > 0): - print "Fetched %s (and performed %d cleanups)" % (lang, subs) + print("Fetched %s (and performed %d cleanups)" % (lang, subs)) else: - print "Fetched %s" % lang - file(OUTPUT_PO_PATH + OUTPUT_PO_PATTERN % lang, "wb").write(transformed) + print("Fetched %s" % lang) + out_file = open(OUTPUT_PO_PATH + OUTPUT_PO_PATTERN % lang, "wb") + out_file.write(transformed.encode()) except subprocess.CalledProcessError: - print "No data for %s" % lang + print ("No data for %s" % lang) # Inform qmake about the updated file list #os.utime("CMakeLists.txt", None)