localization update

* fix pom_merger
* pom_merger now sort the entries, add a header to localization .po file
so the utf-8 encoding is correctly detected by the gettext util, and can
delete comments
* update ru, it & fr files
This commit is contained in:
supermerill 2021-05-26 17:07:35 +02:00 committed by remi durand
parent 2058eeb964
commit 1147813292
17 changed files with 20040 additions and 30715 deletions

View File

@ -1,4 +1,18 @@
# Translation file for czech
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

View File

@ -1,4 +1,18 @@
# Translation file for deutch
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

View File

@ -1,3 +1,18 @@
# Translation file for english
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"
#: src/slic3r/GUI/ButtonsDescription.cpp:16 #: src/slic3r/GUI/ButtonsDescription.cpp:16

View File

@ -1,3 +1,18 @@
# Translation file for espagnol
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,18 @@
# Translation file for japanese
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: jp\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

View File

@ -1,4 +1,18 @@
# Translation file for korean
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ko\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

View File

@ -1,4 +1,18 @@
# Translation file for flemish
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nl\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

View File

@ -1,4 +1,18 @@
# Poland can into Translation file
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: po\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

View File

@ -1,4 +1,5 @@
import re import re
from datetime import date
datastore = dict(); datastore = dict();
datastore_trim = dict();# key:string -> TranslationLine datastore_trim = dict();# key:string -> TranslationLine
@ -6,6 +7,7 @@ datastore_trim = dict();# key:string -> TranslationLine
regex_only_letters = re.compile(r"[^a-zA-Z]") regex_only_letters = re.compile(r"[^a-zA-Z]")
allow_msgctxt = True; allow_msgctxt = True;
ignore_case = False; ignore_case = False;
remove_comment = False;
def trim(str): def trim(str):
redo = True; redo = True;
@ -45,7 +47,7 @@ class TranslationLine:
multivalue = False multivalue = False
def main(): def main():
global datastore, datastore_trim, regex_only_letters, allow_msgctxt, ignore_case; global datastore, datastore_trim, regex_only_letters, allow_msgctxt, ignore_case, remove_comment;
data_files = list(); # list of file paths data_files = list(); # list of file paths
ui_dir = ""; ui_dir = "";
operations = list(); # list of TranslationFiles operations = list(); # list of TranslationFiles
@ -72,10 +74,14 @@ def main():
allow_msgctxt = (line[line.index('=')+1:].strip().lower() == "true"); allow_msgctxt = (line[line.index('=')+1:].strip().lower() == "true");
print("Don't comment msgctxt" if allow_msgctxt else "Commenting msgctxt"); print("Don't comment msgctxt" if allow_msgctxt else "Commenting msgctxt");
if line.startswith("ignore_case"): if line.startswith("allow_msgctxt"):
ignore_case = (line[line.index('=')+1:].strip().lower() == "true"); allow_msgctxt = (line[line.index('=')+1:].strip().lower() == "true");
if ignore_case: print("Don't comment msgctxt" if allow_msgctxt else "Commenting msgctxt");
print("If the string is not found, try by ignoring the case");
if line.startswith("remove_comment"):
remove_comment = (line[line.index('=')+1:].strip().lower() == "true");
if remove_comment:
print("Will not output the comments");
# all_lines = list(); # all_lines = list();
@ -95,8 +101,8 @@ def main():
# if already exist, only change it if the previous was lower than 3 char # if already exist, only change it if the previous was lower than 3 char
if length_new > length_old and length_old < 3: if length_new > length_old and length_old < 3:
print(str_old_val.replace('\n', ' ')+" replaced by "+str_test_val.replace('\n', ' ')); print(str_old_val.replace('\n', ' ')+" replaced by "+str_test_val.replace('\n', ' '));
datastore.put(id, str_test_val); datastore[dataline.msgid].msgstr = str_test_val;
datastore_trim.put(trim(id), str_test_val); datastore_trim[trim(dataline.msgid)].msgstr = str_test_val;
print("finish reading" + data_file + " of size "+ str(len(new_data)) + ", now we had "+ str(len(datastore)) + " items"); print("finish reading" + data_file + " of size "+ str(len(new_data)) + ", now we had "+ str(len(datastore)) + " items");
if ignore_case: if ignore_case:
@ -304,7 +310,7 @@ def outputUntranslated(data_to_translate, file_path_out):
# idealy, they shoud be grouped by proximity, but it's abit more complicated to code # idealy, they shoud be grouped by proximity, but it's abit more complicated to code
sorted_lines = list() sorted_lines = list()
for dataline in data_to_translate: for dataline in data_to_translate:
if not dataline.msgstr and dataline.msgid and len(getTranslation(dataline)) == 0: if not dataline.msgstr.strip() and dataline.msgid and len(getTranslation(dataline).strip()) == 0:
sorted_lines.append(dataline); sorted_lines.append(dataline);
sorted_lines.sort(key=lambda x:x.msgid.lower()) sorted_lines.sort(key=lambda x:x.msgid.lower())
@ -326,13 +332,31 @@ def outputUntranslated(data_to_translate, file_path_out):
def translate(data_to_translate, file_path_out): def translate(data_to_translate, file_path_out):
# try: # try:
file_out_stream = open(file_path_out, mode="w", encoding="utf-8") file_out_stream = open(file_path_out, mode="w", encoding="utf-8")
file_out_stream.write("# Translation file for ???\n");
file_out_stream.write("# Copyright (C) 2021\n");
file_out_stream.write("# This file is distributed under the same license as Slic3r.\n");
file_out_stream.write("#\n");
file_out_stream.write("msgid \"\"\n");
file_out_stream.write("msgstr \"\"\n");
file_out_stream.write("\"Project-Id-Version: Slic3r\\n\"\n");
file_out_stream.write("\"POT-Creation-Date: "+date.today().strftime('%Y-%m-%d %H:%M%z')+"\\n\"\n");
file_out_stream.write("\"PO-Revision-Date: "+date.today().strftime('%Y-%m-%d %H:%M%z')+"\\n\"\n");
file_out_stream.write("\"Last-Translator:\\n\"\n");
file_out_stream.write("\"Language-Team:\\n\"\n");
file_out_stream.write("\"MIME-Version: 1.0\\n\"\n");
file_out_stream.write("\"Content-Type: text/plain; charset=UTF-8\\n\"\n");
file_out_stream.write("\"Content-Transfer-Encoding: 8bit\\n\"\n");
file_out_stream.write("\"Language:\\n\"\n");
nb_lines = 0; nb_lines = 0;
data_to_translate.sort(key=lambda x:x.msgid.lower().strip())
# translate bits that are empty # translate bits that are empty
for dataline in data_to_translate: for dataline in data_to_translate:
if not dataline.msgstr: if not dataline.msgstr.strip():
transl = getTranslation(dataline) transl = getTranslation(dataline)
if len(transl) > 0: if len(transl) > 9 or ( len(transl) > 3 and not transl.startswith('msgstr "')):
file_out_stream.write(dataline.header_comment) file_out_stream.write("\n")
if not remove_comment:
file_out_stream.write(dataline.header_comment.strip())
file_out_stream.write("\n") file_out_stream.write("\n")
file_out_stream.write(dataline.raw_msgid) file_out_stream.write(dataline.raw_msgid)
file_out_stream.write("\n") file_out_stream.write("\n")
@ -343,7 +367,9 @@ def translate(data_to_translate, file_path_out):
print("WARNING: not same number of '%' ( "+ str(dataline.raw_msgid.count('%')) + " => " + str(transl.count('%')) + ")" print("WARNING: not same number of '%' ( "+ str(dataline.raw_msgid.count('%')) + " => " + str(transl.count('%')) + ")"
+"\n for string:'" + dataline.msgid + " '\n=>'"+transl[8:]); +"\n for string:'" + dataline.msgid + " '\n=>'"+transl[8:]);
else: else:
file_out_stream.write(dataline.header_comment) file_out_stream.write("\n")
if not remove_comment:
file_out_stream.write(dataline.header_comment.strip())
file_out_stream.write("\n") file_out_stream.write("\n")
file_out_stream.write(dataline.raw_msgid) file_out_stream.write(dataline.raw_msgid)
file_out_stream.write("\n") file_out_stream.write("\n")
@ -371,7 +397,7 @@ def parse_ui_file(file_path):
if len(items) > 1: if len(items) > 1:
if items[0]=="page" or items[0]=="group" or items[0]=="line": if items[0]=="page" or items[0]=="group" or items[0]=="line":
current_line = TranslationLine(); current_line = TranslationLine();
current_line.header_comment = "\n#: "+file_path+" : l"+str(line_idx); current_line.header_comment = "\n#: "+file_path;#+":"+str(line_idx);
current_line.raw_msgid = "msgid \""+items[-1]+"\""; current_line.raw_msgid = "msgid \""+items[-1]+"\"";
current_line.msgid = items[-1]; current_line.msgid = items[-1];
current_line.raw_msgstr = "msgstr \"\""; current_line.raw_msgstr = "msgstr \"\"";

View File

@ -1,4 +1,21 @@
# Translation file for brasilian
# Don't hit!
# ouch!
# Translation file for portugese
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_br\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

File diff suppressed because it is too large Load Diff

View File

@ -2,14 +2,14 @@
#data = C:/local/Slic3r/resources/localization/lang/TODO.po #data = C:/local/Slic3r/resources/localization/lang/TODO.po
#data = C:/local/Slic3r/resources/localization/lang/Slic3r.po #data = C:/local/Slic3r/resources/localization/lang/Slic3r.po
#data = Slic3r++.po #data = Slic3r++.po
data = ./PrusaSlicer_fr.po data = it/TODO.po
data = ./my_current.po data = it/Slic3r.po
data = ./Slic3r.po
ui_dir = ../ui_layout ui_dir = ../ui_layout
allow_msgctxt = false allow_msgctxt = false
ignore_case = false ignore_case = false
remove_comment = true
input = Slic3r.pot input = Slic3r.pot
todo = TODO.po todo = it/TODO.po
output = Slic3r.po output = it/Slic3r.po

View File

@ -1,4 +1,18 @@
# Translation file for turkish
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: tr\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

View File

@ -1,4 +1,18 @@
# Translation file for Chinese (S)
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
#: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310 #: src/slic3r/GUI/AboutDialog.cpp:45 src/slic3r/GUI/AboutDialog.cpp:310
msgid "Portions copyright" msgid "Portions copyright"

View File

@ -1,4 +1,18 @@
# Translation file for Taiwanese Mandarin
# Copyright (C) 2021
# This file is distributed under the same license as Slic3r.
#
msgid ""
msgstr ""
"Project-Id-Version: Slic3r\n"
"POT-Creation-Date: 2021-05-26 00:00+0200\n"
"PO-Revision-Date: 2021-05-26 00:00+0200\n"
"Last-Translator: Prusa\n"
"Language-Team:\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_tw\n"
#: src/slic3r/GUI/AboutDialog.cpp:242 src/slic3r/GUI/AboutDialog.cpp:372 #: src/slic3r/GUI/AboutDialog.cpp:242 src/slic3r/GUI/AboutDialog.cpp:372
#: src/slic3r/GUI/GUI_App.cpp:261 src/slic3r/GUI/MainFrame.cpp:151 #: src/slic3r/GUI/GUI_App.cpp:261 src/slic3r/GUI/MainFrame.cpp:151