diff --git a/.gitignore b/.gitignore index 5e6b34154..e85ad96de 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ build/ coverage.xml dist/ installer/picard-setup.nsi +installer/i18n/out/*.nsh locale/ org.musicbrainz.Picard.appdata.xml picard.egg-info diff --git a/.tx/config b/.tx/config index 39904eb41..7bb5bad67 100644 --- a/.tx/config +++ b/.tx/config @@ -15,6 +15,12 @@ source_file = po/appstream/picard-appstream.pot source_lang = en type = PO +[musicbrainz.picard_installer] +file_filter = installer/i18n/sources/.json +source_file = installer/i18n/sources/en.json +source_lang = en +type = KEYVALUEJSON + [musicbrainz.countries] file_filter = po/countries/.po source_file = po/countries/countries.pot diff --git a/RELEASING.md b/RELEASING.md index f974f4e84..496ad1753 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -52,7 +52,7 @@ git ls-tree --full-tree -r HEAD --name-only |while read f; do sed -i '1s/^\xEF\x ## Get latest translations from Transifex ```bash -python setup.py get_po_files && git diff --quiet || git commit -m 'Update .po files' -- po/ +python setup.py pull_translations && git diff --quiet || git commit -m 'Update .po files' -- po/ ``` ## Synchronize generated consts diff --git a/installer/i18n/json2nsh.py b/installer/i18n/json2nsh.py new file mode 100755 index 000000000..831e14566 --- /dev/null +++ b/installer/i18n/json2nsh.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# +# Copyright (C) 2020 Philipp Wolfer +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +import glob +import json +import os.path + +import nshutil as nsh + + +def language_from_filename(path): + lang = os.path.splitext(os.path.basename(path))[0] + return (nsh.code_to_language(lang), lang) + + +def write_langstring(f, language, identifier, text): + langstring = nsh.make_langstring(language, identifier, text) + f.write(langstring) + + +def merge_translations(*translations): + merged = {} + for trans in translations: + for k, v in trans.items(): + if v: + merged[k] = v + return merged + + +def main(): + scriptdir = os.path.dirname(os.path.abspath(__file__)) + sourcesdir = os.path.join(scriptdir, 'sources') + outdir = os.path.join(scriptdir, 'out') + os.makedirs(outdir, exist_ok=True) + + # Read the english sources for defaults + with open(os.path.join(sourcesdir, 'en.json'), 'r', encoding='utf-8') as infile: + data_en = json.loads(infile.read()) + + for path in glob.glob(os.path.join(sourcesdir, '*.json')): + language, language_code = language_from_filename(path) + if not language: + print(f'Unknown language code "{language_code}", skipping') + continue + target_file = os.path.join(outdir, f'{language}.nsh') + print(f'{path} => {target_file}') + with open(path, 'r', encoding='utf-8') as infile: + data = json.loads(infile.read()) + data = merge_translations(data_en, data) + with open(target_file, 'w+', encoding='utf-8') as outfile: + for identifier, text in data.items(): + write_langstring(outfile, language, identifier, text) + + +if __name__ == "__main__": + main() diff --git a/installer/i18n/nsh2json.py b/installer/i18n/nsh2json.py new file mode 100755 index 000000000..2f18d3920 --- /dev/null +++ b/installer/i18n/nsh2json.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# +# Copyright (C) 2020 Philipp Wolfer +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +import glob +import json +import os.path + +import nshutil as nsh + + +def language_from_filename(path): + lang = os.path.splitext(os.path.basename(path))[0] + return (lang, nsh.language_to_code(lang)) + + +def extract_strings(f): + for line in f: + parsed = nsh.parse_langstring(line) + if parsed: + yield parsed + + +def main(): + scriptdir = os.path.dirname(os.path.abspath(__file__)) + sourcesdir = os.path.join(scriptdir, 'sources') + outdir = os.path.join(scriptdir, 'out') + + for path in glob.glob(os.path.join(outdir, '*.nsh')): + language, language_code = language_from_filename(path) + if not language_code: + print(f'Unknown language "{language}", skipping') + continue + target_file = os.path.join(sourcesdir, f'{language_code}.json') + print(f'{path} => {target_file}') + with open(path, 'r', encoding='utf-8') as infile: + output = {} + for identifier, text in extract_strings(infile): + output[identifier] = text + + with open(target_file, 'w+', encoding='utf-8') as outfile: + outfile.write(json.dumps(output, ensure_ascii=False, indent=4)) + + +if __name__ == "__main__": + main() diff --git a/installer/i18n/nshutil.py b/installer/i18n/nshutil.py new file mode 100644 index 000000000..c9a71cb8d --- /dev/null +++ b/installer/i18n/nshutil.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# +# Copyright (C) 2020 Philipp Wolfer +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +import re + + +# See list of available NSIS languages at +# https://sourceforge.net/p/nsis/code/HEAD/tree/NSIS/trunk/Contrib/Language%20files/ +LANGUAGES = { + 'Afrikaans': 'af', + 'Albanian': 'sq', + 'Arabic': 'ar', + 'Asturian': 'ast', + 'Basque': 'eu', + 'Belarusian': 'be', + 'Bosnian': 'bs', + 'Breton': 'br', + 'Bulgarian': 'bg', + 'Catalan': 'ca', + 'Cibemba': 'bem', + 'Corsican': 'co', + 'Croation': 'hr', + 'Czech': 'cs', + 'Danish': 'da', + 'Dutch': 'nl', + 'English': 'en', + 'Esperanto': 'eo', + 'Estonian': 'et', + 'Farsi': 'fa', + 'Finnish': 'fi', + 'French': 'fr', + 'Galician': 'gl', + 'Georgian': 'ka', + 'German': 'de', + 'Greek': 'el', + 'Hebrew': 'he', + 'Hindi': 'hi', + 'Hungarian': 'hu', + 'Icelandic': 'is', + 'Igbo': 'ig', + 'Indonesian': 'id', + 'Irish': 'ga', + 'Italian': 'it', + 'Japanese': 'ja', + 'Khmer': 'km', + 'Korean': 'ko', + 'Kurdish': 'ku', + 'Latvian': 'lv', + 'Lithuanian': 'lt', + 'Luxembourgish': 'lb', + 'Macedonian': 'mk', + 'Malagasy': 'mg', + 'Malay': 'ms_MY', + 'Mongolian': 'mn', + 'Norwegian': 'nb', + 'NorwegianNynorsk': 'nn', + 'Polish': 'pl', + 'Portuguese': 'pt', + 'PortugueseBR': 'pt_BR', + 'Romanian': 'ro', + 'Russian': 'ru', + 'ScotsGaelic': 'sco', + 'Serbian': 'sr', + 'SimpChinese': 'zh-Hans', + 'Slovak': 'sk', + 'Slovenian': 'sl', + 'Spanish': 'es', + 'Swahili': 'sw', + 'Swedish': 'sv', + 'Tatar': 'tt', + 'Thai': 'th', + 'TradChinese': 'zh-Hant', + 'Turkish': 'tr', + 'Ukrainian': 'uk', + 'Uzbek': 'uz', + 'Vietnamese': 'vi', + 'Welsh': 'cy', + 'Yoruba': 'yo', +} + +_R_LANGUAGES = dict([(code, name) for name, code in LANGUAGES.items()]) + +# See https://nsis.sourceforge.io/Docs/Chapter4.html#varstrings +ESCAPE_CHARS = { + r'$\r': '\r', + r'$\n': '\n', + r'$\t': '\t', + r'$\"': '"', + r'$\'': "'", + r'$\`': '`', +} + +RE_LANGSTRING_LINE = re.compile(r'LangString\s+(?P[A-Za-z0-9_]+)\s+\${LANG_[A-Z]+}\s+["\'`](?P.*)["\'`]$') + + +def language_to_code(language): + return LANGUAGES.get(language) + + +def code_to_language(language_code): + return _R_LANGUAGES.get(language_code) + + +def escape_string(text): + for escape, char in ESCAPE_CHARS.items(): + if char in ("'", "`"): # No need to escape quotes other than "" + continue + text = text.replace(char, escape) + return text + + +def unescape_string(text): + for escape, char in ESCAPE_CHARS.items(): + text = text.replace(escape, char) + return text + + +def parse_langstring(line): + match = RE_LANGSTRING_LINE.match(line) + if match: + return ( + match.group('identifier'), + unescape_string(match.group('text')) + ) + else: + return None + + +def make_langstring(language, identifier, text): + language = language.upper() + text = escape_string(text) + return f'LangString {identifier} ${{LANG_{language}}} "{text}"\n' diff --git a/installer/i18n/sources/de.json b/installer/i18n/sources/de.json new file mode 100644 index 000000000..180f347f2 --- /dev/null +++ b/installer/i18n/sources/de.json @@ -0,0 +1,16 @@ +{ + "MsgAlreadyInstalled": "${PRODUCT_NAME} ist bereits installiert. \n\nKlicken Sie „OK“ um die vorherige Version zu deinstallieren oder „Abbrechen“ um das Update abzubrechen.", + "MsgApplicationRunning": "Die Anwendung ${PRODUCT_NAME} wird ausgeführt. Bitte schließen und erneut versuchen.", + "MsgRequires64Bit": "Diese Version von ${PRODUCT_NAME} erfordert ein 64-bit Windows-System.", + "MuiDescriptionRequired": "Installiert ${PRODUCT_NAME} mit den für die Ausführung erforderlichen Dateien.", + "MuiDescriptionLang": "Installiert Übersetzungen von ${PRODUCT_NAME} in verschiedenen Sprachen.", + "MuiDescriptionShortcuts": "Installiert Verknüpfungen, um ${PRODUCT_NAME} zu starten.", + "MuiDescriptionDesktop": "Installiert eine Verknüpfung auf dem Desktop.", + "MuiDescriptionStarteMenu": "Installiert eine Verknüpfung im Startmenü.", + "OptionRemoveSettings": "Einstellungen und persönliche Daten entfernen", + "SectionDesktop": "Desktop", + "SectionLanguages": "Sprachen", + "SectionRequired": "Programmdateien (erforderlich)", + "SectionShortcuts": "Verknüpfungen", + "SectionStartMenu": "Startmenü" +} \ No newline at end of file diff --git a/installer/i18n/sources/en.json b/installer/i18n/sources/en.json new file mode 100644 index 000000000..863c26d68 --- /dev/null +++ b/installer/i18n/sources/en.json @@ -0,0 +1,16 @@ +{ + "MsgAlreadyInstalled": "${PRODUCT_NAME} is already installed. \n\nClick \"OK\" to uninstall the previous version or \"Cancel\" to cancel this upgrade.", + "MsgApplicationRunning": "The application ${PRODUCT_NAME} is running. Please close it and try again.", + "MsgRequires64Bit": "This version of ${PRODUCT_NAME} requires a 64-bit Windows system.", + "MuiDescriptionRequired": "Installs ${PRODUCT_NAME} along with the necessary files for it run.", + "MuiDescriptionLang": "Installs translations of ${PRODUCT_NAME} in different languages.", + "MuiDescriptionShortcuts": "Installs shortcuts to launch ${PRODUCT_NAME}.", + "MuiDescriptionDesktop": "Installs a shortcut on the desktop.", + "MuiDescriptionStarteMenu": "Installs a shortcut in the Start Menu.", + "OptionRemoveSettings": "Remove settings and personal data", + "SectionDesktop": "Desktop", + "SectionLanguages": "Languages", + "SectionRequired": "Program files (required)", + "SectionShortcuts": "Shortcuts", + "SectionStartMenu": "Start menu" +} \ No newline at end of file diff --git a/installer/i18n/sources/es.json b/installer/i18n/sources/es.json new file mode 100644 index 000000000..9de0c099d --- /dev/null +++ b/installer/i18n/sources/es.json @@ -0,0 +1,16 @@ +{ + "MsgAlreadyInstalled": "${PRODUCT_NAME} ya está instalado . \n\nClick \"OK\" para desinstalar la versión anterior o \"Cancel\" para cancelar esta actualización. ", + "MsgApplicationRunning": "La aplicación ${PRODUCT_NAME} está en marcha. Por favor cierrelo e inténtelo de nuevo.", + "MsgRequires64Bit": "La versión de ${PRODUCT_NAME} requiere un Windows de 64-bits.", + "MuiDescriptionRequired": "Instalar ${PRODUCT_NAME} junto con los archivos necesarios para que funcione.", + "MuiDescriptionLang": "Instalar traducciones de ${PRODUCT_NAME} en diferentes lenguajes.", + "MuiDescriptionShortcuts": "Instalar atajos para iniciar ${PRODUCT_NAME}.", + "MuiDescriptionDesktop": "Instalar un atajo en el escritorio", + "MuiDescriptionStarteMenu": "Instalar un atajo en el Menú de Inicio", + "OptionRemoveSettings": "Remover ajustes e información personal", + "SectionDesktop": "Escritorio", + "SectionLanguages": "Idiomas", + "SectionRequired": "Archivos de programa (requerido)", + "SectionShortcuts": "Atajos", + "SectionStartMenu": "Menú de inicio" +} \ No newline at end of file diff --git a/installer/i18n/sources/fr.json b/installer/i18n/sources/fr.json new file mode 100644 index 000000000..1d84a813f --- /dev/null +++ b/installer/i18n/sources/fr.json @@ -0,0 +1,16 @@ +{ + "MsgAlreadyInstalled": "${PRODUCT_NAME} est déjà installé. \n\nCliquez sur « OK » pour désinstaller la version précédente ou « Annuler » pour annuler cette mise à jour.", + "MsgApplicationRunning": "L’application ${PRODUCT_NAME} est en cours d’exécution. Veuillez la stopper et essayer à nouveau.", + "MsgRequires64Bit": "Cette version de ${PRODUCT_NAME} requiert un système Windows 64 bits.", + "MuiDescriptionRequired": "Installe ${PRODUCT_NAME} ainsi que les fichiers nécessaires à son exécution.", + "MuiDescriptionLang": "Installe les traductions de ${PRODUCT_NAME} dans différentes langues.", + "MuiDescriptionShortcuts": "Installe les raccourcis pour lancer ${PRODUCT_NAME}.", + "MuiDescriptionDesktop": "Installe un raccourci sur le bureau.", + "MuiDescriptionStarteMenu": "Installe un raccourci dans le menu Démarrer.", + "OptionRemoveSettings": "Supprimer les préférences et les données personnelles", + "SectionDesktop": "Bureau", + "SectionLanguages": "Langues", + "SectionRequired": "Fichiers du programme (requis)", + "SectionShortcuts": "Raccourcis", + "SectionStartMenu": "Menu Démarrer" +} \ No newline at end of file diff --git a/installer/i18n/sources/it.json b/installer/i18n/sources/it.json new file mode 100644 index 000000000..564334a6c --- /dev/null +++ b/installer/i18n/sources/it.json @@ -0,0 +1,16 @@ +{ + "MsgAlreadyInstalled": "${PRODUCT_NAME} è già installato.\n\nFai clic su 'OK' per disinstallare la versione installata o su 'Annulla' per annullare l'aggiornamento.", + "MsgApplicationRunning": "L'applicazione ${PRODUCT_NAME} è in esecuzione.\nChiudi l'applicazione e riprova.", + "MsgRequires64Bit": "Questa versione di ${PRODUCT_NAME} richiede un sistema Windows a 64bit.", + "MuiDescriptionRequired": "Installa ${PRODUCT_NAME} e i relativi file necessari alla sua esecuzione.", + "MuiDescriptionLang": "Installa le traduzioni di ${PRODUCT_NAME} per le differenti lingue.", + "MuiDescriptionShortcuts": "Installa collegamenti per eseguire ${PRODUCT_NAME}.", + "MuiDescriptionDesktop": "Installa collegamento sul desktop.", + "MuiDescriptionStarteMenu": "Installa collegamento nel menu Start.", + "OptionRemoveSettings": "Elimina impostazioni e dati personali", + "SectionDesktop": "Desktop", + "SectionLanguages": "Lingue", + "SectionRequired": "File programma (richiesti)", + "SectionShortcuts": "Collegamenti", + "SectionStartMenu": "Menu Start" +} \ No newline at end of file diff --git a/installer/i18n/sources/nl.json b/installer/i18n/sources/nl.json new file mode 100644 index 000000000..9b182911a --- /dev/null +++ b/installer/i18n/sources/nl.json @@ -0,0 +1,16 @@ +{ + "MsgAlreadyInstalled": "${PRODUCT_NAME} is al geïnstalleerd. \n\nKlik op “OK” om de vorige versie te verwijderen of op “Annuleren” om de installatie te annuleren.", + "MsgApplicationRunning": "De applicatie ${PRODUCT_NAME} is nog actief. Sluit haar af en probeer het opnieuw.", + "MsgRequires64Bit": "Voor deze versie van ${PRODUCT_NAME} heb je een 64 bitssysteem nodig.", + "MuiDescriptionRequired": "Installeert ${PRODUCT_NAME} en de bestanden die het nodig heeft om te draaien.", + "MuiDescriptionLang": "Installeert vertalingen van ${PRODUCT_NAME}.", + "MuiDescriptionShortcuts": "Installeert snelkoppelingen om ${PRODUCT_NAME} te starten.", + "MuiDescriptionDesktop": "Installeert een snelkoppeling op het bureaublad.", + "MuiDescriptionStarteMenu": "Installeert een snelkoppeling in het startmenu.", + "OptionRemoveSettings": "Verwijder instellingen en persoonlijke gegevens", + "SectionDesktop": "Bureaublad", + "SectionLanguages": "Talen", + "SectionRequired": "Programmabestanden (vereist)", + "SectionShortcuts": "Snelkoppelingen", + "SectionStartMenu": "Startmenu" +} \ No newline at end of file diff --git a/installer/languages/Dutch.nsh b/installer/languages/Dutch.nsh deleted file mode 100644 index 293d36c46..000000000 --- a/installer/languages/Dutch.nsh +++ /dev/null @@ -1,14 +0,0 @@ -LangString MsgAlreadyInstalled ${LANG_DUTCH} '${PRODUCT_NAME} is al geïnstalleerd. $\n$\nKlik op “OK” om de vorige versie te verwijderen of op “Annuleren” om de installatie te annuleren.' -LangString MsgApplicationRunning ${LANG_DUTCH} "De applicatie ${PRODUCT_NAME} is nog actief. Sluit haar af en probeer het opnieuw." -LangString MsgRequires64Bit ${LANG_DUTCH} "Voor deze versie van ${PRODUCT_NAME} heb je een 64 bitssysteem nodig." -LangString MuiDescriptionRequired ${LANG_DUTCH} "Installeert ${PRODUCT_NAME} en de bestanden die het nodig heeft om te draaien." -LangString MuiDescriptionLang ${LANG_DUTCH} "Installeert vertalingen van ${PRODUCT_NAME}." -LangString MuiDescriptionShortcuts ${LANG_DUTCH} "Installeert snelkoppelingen om ${PRODUCT_NAME} te starten." -LangString MuiDescriptionDesktop ${LANG_DUTCH} "Installeert een snelkoppeling op het bureaublad." -LangString MuiDescriptionStarteMenu ${LANG_DUTCH} "Installeert een snelkoppeling in het startmenu." -LangString OptionRemoveSettings ${LANG_DUTCH} "Verwijder instellingen en persoonlijke gegevens" -LangString SectionDesktop ${LANG_DUTCH} "Bureaublad" -LangString SectionLanguages ${LANG_DUTCH} "Talen" -LangString SectionRequired ${LANG_DUTCH} "Programmabestanden (vereist)" -LangString SectionShortcuts ${LANG_DUTCH} "Snelkoppelingen" -LangString SectionStartMenu ${LANG_DUTCH} "Startmenu" diff --git a/installer/languages/English.nsh b/installer/languages/English.nsh deleted file mode 100644 index d2d9f5ea1..000000000 --- a/installer/languages/English.nsh +++ /dev/null @@ -1,14 +0,0 @@ -LangString MsgAlreadyInstalled ${LANG_ENGLISH} '${PRODUCT_NAME} is already installed. $\n$\nClick "OK" to uninstall the previous version or "Cancel" to cancel this upgrade.' -LangString MsgApplicationRunning ${LANG_ENGLISH} "The application ${PRODUCT_NAME} is running. Please close it and try again." -LangString MsgRequires64Bit ${LANG_ENGLISH} "This version of ${PRODUCT_NAME} requires a 64-bit Windows system." -LangString MuiDescriptionRequired ${LANG_ENGLISH} "Installs ${PRODUCT_NAME} along with the necessary files for it run." -LangString MuiDescriptionLang ${LANG_ENGLISH} "Installs translations of ${PRODUCT_NAME} in different languages." -LangString MuiDescriptionShortcuts ${LANG_ENGLISH} "Installs shortcuts to launch ${PRODUCT_NAME}." -LangString MuiDescriptionDesktop ${LANG_ENGLISH} "Installs a shortcut on the desktop." -LangString MuiDescriptionStarteMenu ${LANG_ENGLISH} "Installs a shortcut in the Start Menu." -LangString OptionRemoveSettings ${LANG_ENGLISH} "Remove settings and personal data" -LangString SectionDesktop ${LANG_ENGLISH} "Desktop" -LangString SectionLanguages ${LANG_ENGLISH} "Languages" -LangString SectionRequired ${LANG_ENGLISH} "Program files (required)" -LangString SectionShortcuts ${LANG_ENGLISH} "Shortcuts" -LangString SectionStartMenu ${LANG_ENGLISH} "Start menu" diff --git a/installer/languages/French.nsh b/installer/languages/French.nsh deleted file mode 100644 index 2d2dcbe97..000000000 --- a/installer/languages/French.nsh +++ /dev/null @@ -1,14 +0,0 @@ -LangString MsgAlreadyInstalled ${LANG_FRENCH} '${PRODUCT_NAME} est déjà installé. $\n$\nCliquez sur « OK » pour désinstaller la version précédente ou « Annuler » pour annuler cette mise à jour.' -LangString MsgApplicationRunning ${LANG_FRENCH} "L’application ${PRODUCT_NAME} est en cours d’exécution. Veuillez la stopper et essayer à nouveau." -LangString MsgRequires64Bit ${LANG_FRENCH} "Cette version de ${PRODUCT_NAME} requiert un système Windows 64 bits." -LangString MuiDescriptionRequired ${LANG_FRENCH} "Installe ${PRODUCT_NAME} ainsi que les fichiers nécessaires à son exécution." -LangString MuiDescriptionLang ${LANG_FRENCH} "Installe les traductions de ${PRODUCT_NAME} dans différentes langues." -LangString MuiDescriptionShortcuts ${LANG_FRENCH} "Installe les raccourcis pour lancer ${PRODUCT_NAME}." -LangString MuiDescriptionDesktop ${LANG_FRENCH} "Installe un raccourci sur le bureau." -LangString MuiDescriptionStarteMenu ${LANG_FRENCH} "Installe un raccourci dans le menu Démarrer." -LangString OptionRemoveSettings ${LANG_FRENCH} "Supprimer les préférences et les données personnelles" -LangString SectionDesktop ${LANG_FRENCH} "Bureau" -LangString SectionLanguages ${LANG_FRENCH} "Langues" -LangString SectionRequired ${LANG_FRENCH} "Fichiers du programme (requis)" -LangString SectionShortcuts ${LANG_FRENCH} "Raccourcis" -LangString SectionStartMenu ${LANG_FRENCH} "Menu Démarrer" diff --git a/installer/languages/German.nsh b/installer/languages/German.nsh deleted file mode 100644 index 0a16e4c7f..000000000 --- a/installer/languages/German.nsh +++ /dev/null @@ -1,14 +0,0 @@ -LangString MsgAlreadyInstalled ${LANG_GERMAN} "${PRODUCT_NAME} ist bereits installiert. $\n$\nKlicken Sie „OK“ um die vorherige Version zu deinstallieren oder „Abbrechen“ um das Update abzubrechen." -LangString MsgApplicationRunning ${LANG_GERMAN} "Die Anwendung ${PRODUCT_NAME} wird ausgeführt. Bitte schließen und erneut versuchen." -LangString MsgRequires64Bit ${LANG_GERMAN} "Diese Version von ${PRODUCT_NAME} erfordert ein 64-bit Windows-System." -LangString MuiDescriptionRequired ${LANG_GERMAN} "Installiert ${PRODUCT_NAME} mit den für die Ausführung erforderlichen Dateien." -LangString MuiDescriptionLang ${LANG_GERMAN} "Installiert Übersetzungen von ${PRODUCT_NAME} in verschiedenen Sprachen." -LangString MuiDescriptionShortcuts ${LANG_GERMAN} "Installiert Verknüpfungen, um ${PRODUCT_NAME} zu starten." -LangString MuiDescriptionDesktop ${LANG_GERMAN} "Installiert eine Verknüpfung auf dem Desktop." -LangString MuiDescriptionStarteMenu ${LANG_GERMAN} "Installiert eine Verknüpfung im Startmenü." -LangString OptionRemoveSettings ${LANG_GERMAN} "Einstellungen und persönliche Daten entfernen" -LangString SectionDesktop ${LANG_GERMAN} "Desktop" -LangString SectionLanguages ${LANG_GERMAN} "Sprachen" -LangString SectionRequired ${LANG_GERMAN} "Programmdateien (erforderlich)" -LangString SectionShortcuts ${LANG_GERMAN} "Verknüpfungen" -LangString SectionStartMenu ${LANG_GERMAN} "Startmenü" diff --git a/installer/languages/Italian.nsh b/installer/languages/Italian.nsh deleted file mode 100644 index 4bcbb3440..000000000 --- a/installer/languages/Italian.nsh +++ /dev/null @@ -1,14 +0,0 @@ -LangString MsgAlreadyInstalled ${LANG_ITALIAN} "${PRODUCT_NAME} è già installato.$\n$\nFai clic su 'OK' per disinstallare la versione installata o su 'Annulla' per annullare l'aggiornamento." -LangString MsgApplicationRunning ${LANG_ITALIAN} "L'applicazione ${PRODUCT_NAME} è in esecuzione.$\nChiudi l'applicazione e riprova." -LangString MsgRequires64Bit ${LANG_ITALIAN} "Questa versione di ${PRODUCT_NAME} richiede un sistema Windows a 64bit." -LangString MuiDescriptionRequired ${LANG_ITALIAN} "Installa ${PRODUCT_NAME} e i relativi file necessari alla sua esecuzione." -LangString MuiDescriptionLang ${LANG_ITALIAN} "Installa le traduzioni di ${PRODUCT_NAME} per le differenti lingue." -LangString MuiDescriptionShortcuts ${LANG_ITALIAN} "Installa collegamento per eseguire ${PRODUCT_NAME}." -LangString MuiDescriptionDesktop ${LANG_ITALIAN} "Installa collegamento sul desktop." -LangString MuiDescriptionStarteMenu ${LANG_ITALIAN} "Installa collegamento nel menu Start." -LangString OptionRemoveSettings ${LANG_ITALIAN} "Elimina impostazioni e dati personali" -LangString SectionDesktop ${LANG_ITALIAN} "Desktop" -LangString SectionLanguages ${LANG_ITALIAN} "Lingue" -LangString SectionRequired ${LANG_ITALIAN} "File programma (richiesti)" -LangString SectionShortcuts ${LANG_ITALIAN} "Collegamenti" -LangString SectionStartMenu ${LANG_ITALIAN} "Menu Start" diff --git a/installer/picard-setup.nsi.in b/installer/picard-setup.nsi.in index 0587ffd1e..16e40c5ed 100644 --- a/installer/picard-setup.nsi.in +++ b/installer/picard-setup.nsi.in @@ -80,7 +80,7 @@ ReserveFile "${NSISDIR}\Plugins\x86-unicode\InstallOptions.dll" ; Language handling !macro LOAD_LANGUAGE LANGUAGE !insertmacro MUI_LANGUAGE "${LANGUAGE}" - !include "languages\${LANGUAGE}.nsh" + !include "i18n\out\${LANGUAGE}.nsh" !macroend ; Language files @@ -107,7 +107,7 @@ ReserveFile "${NSISDIR}\Plugins\x86-unicode\InstallOptions.dll" ; !insertmacro LOAD_LANGUAGE "SimpChinese" ; !insertmacro LOAD_LANGUAGE "Slovak" ; !insertmacro LOAD_LANGUAGE "Slovenian" -; !insertmacro LOAD_LANGUAGE "Spanish" +!insertmacro LOAD_LANGUAGE "Spanish" ; !insertmacro LOAD_LANGUAGE "Swedish" ; !insertmacro LOAD_LANGUAGE "TradChinese" ; !insertmacro LOAD_LANGUAGE "Turkish" diff --git a/po/README.md b/po/README.md index a516c1208..ed29107da 100644 --- a/po/README.md +++ b/po/README.md @@ -45,13 +45,13 @@ To fetch latest translations from Transifex Use the following command: ```bash -$ python setup.py get_po_files +$ python setup.py pull_translations ``` It will fetch all po files from Transifex, but the most incomplete ones. The minimum acceptable percentage of a translation in order to download it can be seen using: ```bash -$ python setup.py get_po_files --help +$ python setup.py pull_translations --help ``` The percentage value is passed to the `tx pull` command. diff --git a/setup.py b/setup.py index fb1ed1b72..daf289f44 100644 --- a/setup.py +++ b/setup.py @@ -274,6 +274,9 @@ class picard_build(build): } if os.path.isfile('installer/picard-setup.nsi.in'): generate_file('installer/picard-setup.nsi.in', 'installer/picard-setup.nsi', {**args, **installer_args}) + log.info('generating NSIS translation files') + self.spawn(['python', 'installer/i18n/json2nsh.py']) + version_args = { 'filevers': str(file_version), 'prodvers': str(file_version), @@ -469,7 +472,7 @@ class picard_regen_appdata_pot_file(Command): ]) -class picard_get_po_files(Command): +class picard_pull_translations(Command): description = "Retrieve po files from transifex" minimum_perc_default = 5 user_options = [ @@ -764,7 +767,7 @@ args = { 'install': picard_install, 'install_locales': picard_install_locales, 'update_constants': picard_update_constants, - 'get_po_files': picard_get_po_files, + 'pull_translations': picard_pull_translations, 'regen_pot_file': picard_regen_pot_file, 'patch_version': picard_patch_version, },