diff --git a/LogarithmPlotter/__init__.py b/LogarithmPlotter/__init__.py index 1691f80..5fb66ac 100644 --- a/LogarithmPlotter/__init__.py +++ b/LogarithmPlotter/__init__.py @@ -1,5 +1,5 @@ """ - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/__main__.py b/LogarithmPlotter/__main__.py index 0b950d2..3797f01 100644 --- a/LogarithmPlotter/__main__.py +++ b/LogarithmPlotter/__main__.py @@ -1,5 +1,5 @@ """ - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/config.py b/LogarithmPlotter/config.py index db904b7..7dec155 100644 --- a/LogarithmPlotter/config.py +++ b/LogarithmPlotter/config.py @@ -1,5 +1,5 @@ """ - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -19,12 +19,13 @@ from os import path, environ, makedirs from platform import system from json import load, dumps +from PySide2.QtCore import QLocale, QTranslator + DEFAULT_SETTINGS = { "check_for_updates": True, "reset_redo_stack": True, "last_install_greet": "0", - "lang": "en" } # Create config directory @@ -35,7 +36,10 @@ CONFIG_PATH = { }[system()] CONFIG_FILE = path.join(CONFIG_PATH, "config.json") -CONFIG = DEFAULT_SETTINGS + +initialized = False +current_config= DEFAULT_SETTINGS + def init(): """ @@ -47,13 +51,13 @@ def init(): cfg_data = load(open(CONFIG_FILE, 'r', -1, 'utf8')) for setting_name in cfg_data: setSetting(setting_name, cfg_data[setting_name]) - + def save(): """ Saves the config to the path. """ write_file = open(CONFIG_FILE, 'w', -1, 'utf8') - write_file.write(dumps(CONFIG)) + write_file.write(dumps(current_config)) write_file.close() def getSetting(namespace): @@ -63,7 +67,7 @@ def getSetting(namespace): by using the "test.foo" namespace. """ names = namespace.split(".") - setting = CONFIG + setting = current_config for name in names: if name in setting: setting = setting[name] @@ -79,7 +83,7 @@ def setSetting(namespace, data): by using the "test.foo" namespace. """ names = namespace.split(".") - setting = CONFIG + setting = current_config for name in names: if name != names[-1]: if name in setting: diff --git a/LogarithmPlotter/i18n/lp_de.ts b/LogarithmPlotter/i18n/lp_de.ts new file mode 100644 index 0000000..22b353c --- /dev/null +++ b/LogarithmPlotter/i18n/lp_de.ts @@ -0,0 +1,607 @@ + + + + + About + + + About LogarithmPlotter + + + + + LogarithmPlotter v%1 + + + + + 2D plotter software to make BODE plots, sequences and repartition functions. + + + + + Report a bug + + + + + AppMenuBar + + + &File + + + + + &Load... + + + + + &Save + + + + + Save &As... + + + + + &Quit + + + + + &Edit + + + + + &Undo + + + + + &Redo + + + + + &Copy plot + + + + + &Create + + + + + &Settings + + + + + Check for updates on startup + + + + + Reset redo stack automaticly + + + + + &Help + + + + + &About + + + + + EditorDialog + + + Edit properties of %1 %2 + + + + + Name + + + + + Label content + + + + + null + + + + + name + + + + + name + value + + + + + + + Create new %1 + + + + + FileDialog + + + Export Logarithm Plot file + + + + + Import Logarithm Plot file + + + + + GreetScreen + + + Welcome to LogarithmPlotter + + + + + Version %1 + + + + + Take a few seconds to configure LogarithmPlotter. +These settings can be changed at any time from the "Settings" menu. + + + + + Check for updates on startup (requires online connectivity) + + + + + Reset redo stack when a new action is added to history + + + + + HistoryBrowser + + + Redo > + + + + + > Now + + + + + < Undo + + + + + LogarithmPlotter + + + Objects + + + + + Settings + + + + + History + + + + + Saved plot to '%1'. + + + + + Loading file '%1'. + + + + + Unknown object type: %1. + + + + + Invalid file provided. + + + + + Could not save file: + + + + + Loaded file '%1'. + + + + + Copied plot screenshot to clipboard! + + + + + &Update + + + + + &Update LogarithmPlotter + + + + + ObjectCreationGrid + + + + Create new: + + + + + ObjectLists + + + Hide all %1 + + + + + Show all %1 + + + + + Hide %1 %2 + + + + + Show %1 %2 + + + + + Set %1 %2 position + + + + + Delete %1 %2 + + + + + Pick new color for %1 %2 + + + + + PickLocationOverlay + + + Pointer precision: + + + + + Snap to grid + + + + + Settings + + + X Zoom + + + + + Y Zoom + + + + + Min X + + + + + Max Y + + + + + Max X + + + + + Min Y + + + + + X Axis Step + + + + + Y Axis Step + + + + + Line width + + + + + Text size (px) + + + + + X Label + + + + + Y Label + + + + + X Log scale + + + + + Show X graduation + + + + + Show Y graduation + + + + + Copy to clipboard + + + + + Save plot + + + + + Save plot as + + + + + Load plot + + + + + function + + + Function + + + + + Functions + + + + + gainbode + + + Bode Magnitude + + + + + Bode Magnitudes + + + + + low-pass + + + + + high-pass + + + + + historylib + + + New %1 %2 created. + + + + + %1 %2 deleted. + + + + + %1 of %2 %3 changed from "%4" to "%5". + + + + + %1 %2 shown. + + + + + %1 %2 hidden. + + + + + phasebode + + + Bode Phase + + + + + Bode Phases + + + + + point + + + Point + + + + + Points + + + + + repartition + + + Repartition + + + + + Repartition functions + + + + + sequence + + + Sequence + + + + + Sequences + + + + + sommegainsbode + + + + Bode Magnitudes Sum + + + + + sommephasesbode + + + + Bode Phases Sum + + + + + text + + + Text + + + + + Texts + + + + + update + + + An update for LogarithPlotter (v{}) is available. + + + + + No update available. + + + + + Could not fetch update information: Server error {}. + + + + + Could not fetch update information: {}. + + + + + xcursor + + + X Cursor + + + + + X Cursors + + + + diff --git a/LogarithmPlotter/i18n/lp_en.ts b/LogarithmPlotter/i18n/lp_en.ts new file mode 100644 index 0000000..693ea98 --- /dev/null +++ b/LogarithmPlotter/i18n/lp_en.ts @@ -0,0 +1,607 @@ + + + + + About + + + About LogarithmPlotter + + + + + LogarithmPlotter v%1 + + + + + 2D plotter software to make BODE plots, sequences and repartition functions. + + + + + Report a bug + + + + + AppMenuBar + + + &File + + + + + &Load... + + + + + &Save + + + + + Save &As... + + + + + &Quit + + + + + &Edit + + + + + &Undo + + + + + &Redo + + + + + &Copy plot + + + + + &Create + + + + + &Settings + + + + + Check for updates on startup + + + + + Reset redo stack automaticly + + + + + &Help + + + + + &About + + + + + EditorDialog + + + Edit properties of %1 %2 + + + + + Name + + + + + Label content + + + + + null + + + + + name + + + + + name + value + + + + + + + Create new %1 + + + + + FileDialog + + + Export Logarithm Plot file + + + + + Import Logarithm Plot file + + + + + GreetScreen + + + Welcome to LogarithmPlotter + + + + + Version %1 + + + + + Take a few seconds to configure LogarithmPlotter. +These settings can be changed at any time from the "Settings" menu. + + + + + Check for updates on startup (requires online connectivity) + + + + + Reset redo stack when a new action is added to history + + + + + HistoryBrowser + + + Redo > + + + + + > Now + + + + + < Undo + + + + + LogarithmPlotter + + + Objects + + + + + Settings + + + + + History + + + + + Saved plot to '%1'. + + + + + Loading file '%1'. + + + + + Unknown object type: %1. + + + + + Invalid file provided. + + + + + Could not save file: + + + + + Loaded file '%1'. + + + + + Copied plot screenshot to clipboard! + + + + + &Update + + + + + &Update LogarithmPlotter + + + + + ObjectCreationGrid + + + + Create new: + + + + + ObjectLists + + + Hide all %1 + + + + + Show all %1 + + + + + Hide %1 %2 + + + + + Show %1 %2 + + + + + Set %1 %2 position + + + + + Delete %1 %2 + + + + + Pick new color for %1 %2 + + + + + PickLocationOverlay + + + Pointer precision: + + + + + Snap to grid + + + + + Settings + + + X Zoom + + + + + Y Zoom + + + + + Min X + + + + + Max Y + + + + + Max X + + + + + Min Y + + + + + X Axis Step + + + + + Y Axis Step + + + + + Line width + + + + + Text size (px) + + + + + X Label + + + + + Y Label + + + + + X Log scale + + + + + Show X graduation + + + + + Show Y graduation + + + + + Copy to clipboard + + + + + Save plot + + + + + Save plot as + + + + + Load plot + + + + + function + + + Function + + + + + Functions + + + + + gainbode + + + Bode Magnitude + + + + + Bode Magnitudes + + + + + low-pass + + + + + high-pass + + + + + historylib + + + New %1 %2 created. + + + + + %1 %2 deleted. + + + + + %1 of %2 %3 changed from "%4" to "%5". + + + + + %1 %2 shown. + + + + + %1 %2 hidden. + + + + + phasebode + + + Bode Phase + + + + + Bode Phases + + + + + point + + + Point + + + + + Points + + + + + repartition + + + Repartition + + + + + Repartition functions + + + + + sequence + + + Sequence + + + + + Sequences + + + + + sommegainsbode + + + + Bode Magnitudes Sum + + + + + sommephasesbode + + + + Bode Phases Sum + + + + + text + + + Text + + + + + Texts + + + + + update + + + An update for LogarithPlotter (v{}) is available. + + + + + No update available. + + + + + Could not fetch update information: Server error {}. + + + + + Could not fetch update information: {}. + + + + + xcursor + + + X Cursor + + + + + X Cursors + + + + diff --git a/LogarithmPlotter/i18n/lp_es.ts b/LogarithmPlotter/i18n/lp_es.ts new file mode 100644 index 0000000..09a98a1 --- /dev/null +++ b/LogarithmPlotter/i18n/lp_es.ts @@ -0,0 +1,607 @@ + + + + + About + + + About LogarithmPlotter + + + + + LogarithmPlotter v%1 + + + + + 2D plotter software to make BODE plots, sequences and repartition functions. + + + + + Report a bug + + + + + AppMenuBar + + + &File + + + + + &Load... + + + + + &Save + + + + + Save &As... + + + + + &Quit + + + + + &Edit + + + + + &Undo + + + + + &Redo + + + + + &Copy plot + + + + + &Create + + + + + &Settings + + + + + Check for updates on startup + + + + + Reset redo stack automaticly + + + + + &Help + + + + + &About + + + + + EditorDialog + + + Edit properties of %1 %2 + + + + + Name + + + + + Label content + + + + + null + + + + + name + + + + + name + value + + + + + + + Create new %1 + + + + + FileDialog + + + Export Logarithm Plot file + + + + + Import Logarithm Plot file + + + + + GreetScreen + + + Welcome to LogarithmPlotter + + + + + Version %1 + + + + + Take a few seconds to configure LogarithmPlotter. +These settings can be changed at any time from the "Settings" menu. + + + + + Check for updates on startup (requires online connectivity) + + + + + Reset redo stack when a new action is added to history + + + + + HistoryBrowser + + + Redo > + + + + + > Now + + + + + < Undo + + + + + LogarithmPlotter + + + Objects + + + + + Settings + + + + + History + + + + + Saved plot to '%1'. + + + + + Loading file '%1'. + + + + + Unknown object type: %1. + + + + + Invalid file provided. + + + + + Could not save file: + + + + + Loaded file '%1'. + + + + + Copied plot screenshot to clipboard! + + + + + &Update + + + + + &Update LogarithmPlotter + + + + + ObjectCreationGrid + + + + Create new: + + + + + ObjectLists + + + Hide all %1 + + + + + Show all %1 + + + + + Hide %1 %2 + + + + + Show %1 %2 + + + + + Set %1 %2 position + + + + + Delete %1 %2 + + + + + Pick new color for %1 %2 + + + + + PickLocationOverlay + + + Pointer precision: + + + + + Snap to grid + + + + + Settings + + + X Zoom + + + + + Y Zoom + + + + + Min X + + + + + Max Y + + + + + Max X + + + + + Min Y + + + + + X Axis Step + + + + + Y Axis Step + + + + + Line width + + + + + Text size (px) + + + + + X Label + + + + + Y Label + + + + + X Log scale + + + + + Show X graduation + + + + + Show Y graduation + + + + + Copy to clipboard + + + + + Save plot + + + + + Save plot as + + + + + Load plot + + + + + function + + + Function + + + + + Functions + + + + + gainbode + + + Bode Magnitude + + + + + Bode Magnitudes + + + + + low-pass + + + + + high-pass + + + + + historylib + + + New %1 %2 created. + + + + + %1 %2 deleted. + + + + + %1 of %2 %3 changed from "%4" to "%5". + + + + + %1 %2 shown. + + + + + %1 %2 hidden. + + + + + phasebode + + + Bode Phase + + + + + Bode Phases + + + + + point + + + Point + + + + + Points + + + + + repartition + + + Repartition + + + + + Repartition functions + + + + + sequence + + + Sequence + + + + + Sequences + + + + + sommegainsbode + + + + Bode Magnitudes Sum + + + + + sommephasesbode + + + + Bode Phases Sum + + + + + text + + + Text + + + + + Texts + + + + + update + + + An update for LogarithPlotter (v{}) is available. + + + + + No update available. + + + + + Could not fetch update information: Server error {}. + + + + + Could not fetch update information: {}. + + + + + xcursor + + + X Cursor + + + + + X Cursors + + + + diff --git a/LogarithmPlotter/i18n/lp_fr.ts b/LogarithmPlotter/i18n/lp_fr.ts new file mode 100644 index 0000000..a7376cb --- /dev/null +++ b/LogarithmPlotter/i18n/lp_fr.ts @@ -0,0 +1,617 @@ + + + + + About + + + + About LogarithmPlotter + À propos de LogarithmPlotter + + + + LogarithmPlotter v%1 + LogarithmPlotter v%1 + + + + 2D plotter software to make BODE plots, sequences and repartition functions. + Logiciel de traçage 2D pour les diagrammes de BODE, les suites et les fonctions de répartition. + + + + Report a bug + Rapporter un bug + + + + AppMenuBar + + + &File + &Fichier + + + + &Load... + &Ouvrir... + + + + &Save + &Sauvegarder + + + + Save &As... + Sauvegarde &Sous... + + + + &Quit + &Quitter + + + + &Edit + &Édition + + + + &Undo + &Annuler + + + + &Redo + &Rétablir + + + + &Copy plot + &Copier le graphe + + + + &Create + &Créer + + + + &Settings + &Paramètres + + + + Check for updates on startup + Vérifier la présence de mise à jour au démarage + + + + Reset redo stack automaticly + Légèrement long, et pas forcément très compréhensible. + Réinitialiser la pile d'action "Rétablir" automatiquement + + + + &Help + &Aide + + + + &About + &À propos + + + + EditorDialog + + + Edit properties of %1 %2 + Changer les propriétés de %1 %2 + + + + Name + Nom + + + + Label content + Étiquette + + + + null + vide + + + + name + nom + + + + name + value + nom + valeur + + + + + + Create new %1 + Traduction non litéralle pour éviter les problèmes de genre. + + Créer un nouvel objet %1 + + + + FileDialog + + + Export Logarithm Plot file + Exporter le graphe Logarithmique + + + + Import Logarithm Plot file + Importer un graphe Logarithmique + + + + GreetScreen + + + Welcome to LogarithmPlotter + Bienvenue sur LogarithmPlotter + + + + Version %1 + Version %1 + + + + Take a few seconds to configure LogarithmPlotter. +These settings can be changed at any time from the "Settings" menu. + Prenez quelques secondes pour configurer LogarithmPlotter. +Ces paramètres peuvent être modifiés à tout moment à partir du menu "Paramètres". + + + Take a few seconds to configure LogarithmPlotter. +These settings can always be changed at any time from the "Settings" menu. + Take a few seconds to configure LogarithmPlotter. +These settings can always be changed at any time from the "Settings" menu. + + + + Check for updates on startup (requires online connectivity) + Vérifier les mises à jour au démarrage (nécessite d'être connecté à internet) + + + + Reset redo stack when a new action is added to history + Réinitialiser la pile d'action "Rétablir" lorsqu'une nouvelle action est ajoutée à l'historique + + + + HistoryBrowser + + + Redo > + Rétablir > + + + + > Now + > État actuel + + + + < Undo + < Annuler + + + + LogarithmPlotter + + + Objects + Objets + + + + Settings + Paramètres + + + + History + Historique + + + + Saved plot to '%1'. + Graphe sauvegardé dans '%1'. + + + + Loading file '%1'. + Chargement du fichier '%1'. + + + + Unknown object type: %1. + Type d'objet inconnu : %1. + + + + Invalid file provided. + Fichier fourni invalide. + + + + Could not save file: + Impossible de sauvegarder le fichier : + + + + Loaded file '%1'. + Fichier '%1' chargé. + + + + Copied plot screenshot to clipboard! + Image du graphe copiée dans le presse-papiers ! + + + + &Update + &Mise à jour + + + + &Update LogarithmPlotter + &Mettre à jour LogarithmPlotter + + + + ObjectCreationGrid + + + + Create new: + + Créer : + + + + ObjectLists + + + Hide all %1 + Cacher tous les %1 + + + + Show all %1 + Montrer tous les %1 + + + + Hide %1 %2 + Cacher l'objet %1 %2 + + + + Show %1 %2 + Montrer l'objet %1 %2 + + + + Set %1 %2 position + Définir la position de l'objet %1 %2 + + + + Delete %1 %2 + Supprimer l'objet %1 %2 + + + + Pick new color for %1 %2 + Choisissez une nouvelle couleur pour %1 %2 + + + + PickLocationOverlay + + + Pointer precision: + Précision du pointeur : + + + + Snap to grid + Placement sur la grille + + + + Settings + + + X Zoom + Zoom en X + + + + Y Zoom + Zoom en Y + + + + Min X + Min X + + + + Max Y + Max Y + + + + Max X + Max X + + + + Min Y + Min Y + + + + X Axis Step + Pas de l'axe X + + + + Y Axis Step + Pas de l'axe Y + + + + Line width + Taille des lignes + + + + Text size (px) + Taille du texte (px) + + + + X Label + Label de l'axe X + + + + Y Label + Label de l'axe Y + + + + X Log scale + Échelle logarithmique en X + + + + Show X graduation + Montrer la graduation de l'axe X + + + + Show Y graduation + Montrer la graduation de l'axe Y + + + + Copy to clipboard + Copier vers le presse-papiers + + + + Save plot + Sauvegarder le graphe + + + + Save plot as + Sauvegarder le graphe sous + + + + Load plot + Charger un graphe + + + + function + + + Function + Fonction + + + + Functions + Fonctions + + + + gainbode + + + Bode Magnitude + Gain de Bode + + + + Bode Magnitudes + Gains de Bode + + + + low-pass + passe-bas + + + + high-pass + passe-haut + + + + historylib + + + New %1 %2 created. + Nouveau %1 %2 créé(e). + + + + %1 %2 deleted. + %1 %2 supprimé(e). + + + + %1 of %2 %3 changed from "%4" to "%5". + %1 de %2 %3 modifiée de "%4" à "%5". + + + + %1 %2 shown. + %1 %2 affiché(e). + + + + %1 %2 hidden. + %1 %2 cachée(e). + + + + phasebode + + + Bode Phase + Phase de Bode + + + + Bode Phases + Phases de Bode + + + + point + + + Point + Point + + + + Points + Points + + + + repartition + + + Repartition + Répartition + + + + Repartition functions + Fonctions de répartition + + + + sequence + + + Sequence + Suite + + + + Sequences + Suites + + + + sommegainsbode + + + + Bode Magnitudes Sum + Sommes des gains de Bode + + + + sommephasesbode + + + + Bode Phases Sum + Somme des phases de Bode + + + + text + + + Text + Texte + + + + Texts + Textes + + + + update + + + An update for LogarithPlotter (v{}) is available. + Une mise à jour de LogarithPlotter (v{}) est disponible. + + + + No update available. + À jour. + + + + Could not fetch update information: Server error {}. + Impossible de récupérer les informations de mise à jour. Erreur du serveur {}. + + + + Could not fetch update information: {}. + Impossible de récupérer les informations de mise à jour. {}. + + + + xcursor + + + X Cursor + Curseur X + + + + X Cursors + Curseurs X + + + diff --git a/LogarithmPlotter/i18n/release.sh b/LogarithmPlotter/i18n/release.sh new file mode 100755 index 0000000..93475b5 --- /dev/null +++ b/LogarithmPlotter/i18n/release.sh @@ -0,0 +1,2 @@ +#!/bin/bash +lrelease *.ts diff --git a/LogarithmPlotter/i18n/update.sh b/LogarithmPlotter/i18n/update.sh new file mode 100755 index 0000000..3da7ef6 --- /dev/null +++ b/LogarithmPlotter/i18n/update.sh @@ -0,0 +1,5 @@ +#!/bin/bash +lupdate -extensions js,qs,qml,py -recursive .. -ts lp_en.ts +lupdate -extensions js,qs,qml,py -recursive .. -ts lp_fr.ts +lupdate -extensions js,qs,qml,py -recursive .. -ts lp_de.ts +lupdate -extensions js,qs,qml,py -recursive .. -ts lp_es.ts diff --git a/LogarithmPlotter/logarithmplotter.py b/LogarithmPlotter/logarithmplotter.py index 2b105b8..621e7c0 100644 --- a/LogarithmPlotter/logarithmplotter.py +++ b/LogarithmPlotter/logarithmplotter.py @@ -1,5 +1,5 @@ """ - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ start_time = time() from PySide2.QtWidgets import QApplication, QFileDialog from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType -from PySide2.QtCore import Qt, QObject, Signal, Slot, Property +from PySide2.QtCore import Qt, QObject, Signal, Slot, Property, QTranslator, QLocale, QCoreApplication from PySide2.QtGui import QIcon, QImage, QKeySequence from PySide2 import __version__ as PySide2_version @@ -46,8 +46,8 @@ if path.realpath(path.join(getcwd(), "..")) not in sys_path: from LogarithmPlotter import config, native, __VERSION__ from LogarithmPlotter.update import check_for_updates -config.init() +config.init() def get_linux_theme(): des = { @@ -63,6 +63,10 @@ def get_linux_theme(): return "Material" class Helper(QObject): + + def __init__(self, engine: QQmlApplicationEngine): + QObject.__init__(self) + self.engine = engine; @Slot(str, str) def write(self, filename, filedata): @@ -80,6 +84,7 @@ class Helper(QObject): def load(self, filename): chdir(pwd) data = '{}' + from PySide2.QtWidgets import QMessageBox if path.exists(path.realpath(filename)): f = open(path.realpath(filename), 'r', -1, 'utf8') data = f.read() @@ -93,10 +98,9 @@ class Helper(QObject): else: raise Exception("Invalid LogarithmPlotter file.") except Exception as e: # If file can't be loaded - from PySide2.QtWidgets import QMessageBox - QMessageBox.warning(None, 'LogarithmPlotter', 'Could not open file "{}":\n{}'.format(filename, e), QMessageBox.Ok) # Cannot parse file + QMessageBox.warning(None, 'LogarithmPlotter', QCoreApplication.translate('main','Could not open file "{}":\n{}').format(filename, e), QMessageBox.Ok) # Cannot parse file else: - QMessageBox.warning(None, 'LogarithmPlotter', 'Could not open file: "{}"\nFile does not exist.'.format(filename), QMessageBox.Ok) # Cannot parse file + QMessageBox.warning(None, 'LogarithmPlotter', QCoreApplication.translate('main','Could not open file: "{}"\nFile does not exist.').format(filename), QMessageBox.Ok) # Cannot parse file chdir(path.dirname(path.realpath(__file__))) return data @@ -131,12 +135,16 @@ class Helper(QObject): def setSettingBool(self, namespace, value): return config.setSetting(namespace, value) + @Slot(str) + def setLanguage(self, new_lang): + config.setSetting("language", new_lang) + @Slot(result=str) def getDebugInfos(self): """ Returns the version info about Qt, PySide2 & Python """ - return "Built with PySide2 (Qt) v{} and python v{}".format(PySide2_version, sys_version.split("\n")[0]) + return QCoreApplication.translate('main',"Built with PySide2 (Qt) v{} and python v{}").format(PySide2_version, sys_version.split("\n")[0]) @Slot(str) def openUrl(self, url): @@ -166,6 +174,11 @@ def run(): app.setOrganizationName("Ad5001") app.setWindowIcon(QIcon(path.realpath(path.join(getcwd(), "logarithmplotter.svg")))) + # Installing translators + translator = QTranslator() + if (translator.load(QLocale(), "lp", "_", path.realpath(path.join(getcwd(), "i18n")))): + app.installTranslator(translator); + # Installing macOS file handler. macOSFileOpenHandler = None if platform == "darwin": @@ -173,13 +186,16 @@ def run(): app.installEventFilter(macOSFileOpenHandler) engine = QQmlApplicationEngine() - helper = Helper() + helper = Helper(engine) engine.rootContext().setContextProperty("Helper", helper) engine.rootContext().setContextProperty("TestBuild", "--test-build" in argv) engine.rootContext().setContextProperty("StartTime", dep_time) + + app.translate("About","About LogarithmPlotter") # FOR SOME REASON, if this isn't included, Qt refuses to load the QML file. engine.addImportPath(path.realpath(path.join(getcwd(), "qml"))) engine.load(path.realpath(path.join(getcwd(), "qml", "eu", "ad5001", "LogarithmPlotter", "LogarithmPlotter.qml"))) + if not engine.rootObjects(): print("No root object", path.realpath(path.join(getcwd(), "qml"))) diff --git a/LogarithmPlotter/native.py b/LogarithmPlotter/native.py index e867c8b..28e58e0 100644 --- a/LogarithmPlotter/native.py +++ b/LogarithmPlotter/native.py @@ -1,5 +1,5 @@ """ - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/About.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/About.qml index eb5e32f..29fd3f7 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/About.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/About.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -23,7 +23,7 @@ import QtQuick.Controls 2.12 D.Dialog { id: about - title: `About LogarithmPlotter` + title: qsTr("About LogarithmPlotter") width: 400 height: 600 @@ -49,7 +49,7 @@ D.Dialog { width: parent.width wrapMode: Text.WordWrap font.pixelSize: 25 - text: "LogarithmPlotter v" + Helper.getVersion() + text: qsTr("LogarithmPlotter v%1").arg(Helper.getVersion()) } Label { @@ -61,7 +61,7 @@ D.Dialog { width: parent.width wrapMode: Text.WordWrap font.pixelSize: 18 - text: "Create graphs with logarithm scales." + text: qsTr("2D plotter software to make BODE plots, sequences and repartition functions.") } Label { @@ -100,7 +100,7 @@ You should have received a copy of the GNU General Public License along with thi anchors.top: copyrightInfos.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.topMargin: 10 - text: 'Report a bug' + text: qsTr('Report a bug') icon.name: 'bug' onClicked: Helper.openUrl('https://git.ad5001.eu/Ad5001/LogarithmPlotter') } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Alert.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Alert.qml index 5309eec..0378b53 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Alert.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Alert.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml index 653f482..75632ff 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ComboBoxSetting.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ComboBoxSetting.qml index 6cda799..ece456b 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ComboBoxSetting.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ComboBoxSetting.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/FileDialog.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/FileDialog.qml index eeaa69b..e9fb19d 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/FileDialog.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/FileDialog.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -23,7 +23,7 @@ D.FileDialog { property bool exportMode: false - title: exportMode ? "Export Logarithm Plot file" : "Import Logarithm Plot file" + title: exportMode ? qsTr("Export Logarithm Plot file") : qsTr("Import Logarithm Plot file") nameFilters: ["Logarithm Plot File (*.lpf)", "All files (*)"] folder: shortcuts.documents diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/GreetScreen.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/GreetScreen.qml index 2758b24..5211a30 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/GreetScreen.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/GreetScreen.qml @@ -1,6 +1,6 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -55,7 +55,7 @@ Popup { //width: parent.width wrapMode: Text.WordWrap font.pixelSize: 32 - text: "Welcome to LogarithmPlotter" + text: qsTr("Welcome to LogarithmPlotter") } } @@ -69,7 +69,7 @@ Popup { width: implicitWidth font.pixelSize: 18 font.italic: true - text: "Version " + Helper.getVersion() + text: qsTr("Version %1").arg(Helper.getVersion()) } Label { @@ -81,7 +81,7 @@ Popup { wrapMode: Text.WordWrap font.pixelSize: 14 width: parent.width - 50 - text: "Take a few seconds to configure LogarithmPlotter.\nThese settings can always be changed at any time from the \"Settings\" menu." + text: qsTr("Take a few seconds to configure LogarithmPlotter.\nThese settings can be changed at any time from the \"Settings\" menu.") } CheckBox { @@ -90,7 +90,7 @@ Popup { anchors.top: helpText.bottom anchors.topMargin: 10 checked: Helper.getSettingBool("check_for_updates") - text: 'Check for updates on startup (requires online connectivity)' + text: qsTr('Check for updates on startup (requires online connectivity)') onClicked: { Helper.setSettingBool("check_for_updates", checked) checkForUpdatesMenuSetting.checked = checked @@ -102,7 +102,7 @@ Popup { anchors.horizontalCenter: parent.horizontalCenter anchors.top: checkForUpdatesSetting.bottom checked: Helper.getSettingBool("reset_redo_stack") - text: 'Reset redo stack when a new action is added to history' + text: qsTr('Reset redo stack when a new action is added to history') onClicked: { Helper.setSettingBool("reset_redo_stack", checked) resetRedoStackMenuSetting.checked = checked diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml index 8d00ecf..df2b772 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/HistoryBrowser.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/HistoryBrowser.qml index 27caabb..6be99ba 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/HistoryBrowser.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/HistoryBrowser.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -60,7 +60,7 @@ ScrollView { Text { anchors.left: parent.left anchors.bottom: nowRect.top - text: "Redo >" + text: qsTr("Redo >") color: sysPaletteIn.windowText transform: Rotation { origin.x: 30; origin.y: 30; angle: 270} height: 70 @@ -79,7 +79,7 @@ ScrollView { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: 5 - text: "> Now" + text: qsTr("> Now") color: sysPalette.windowText } } @@ -113,7 +113,7 @@ ScrollView { Text { anchors.left: parent.left anchors.top: undoColumn.top - text: "< Undo" + text: qsTr("< Undo") color: sysPaletteIn.windowText transform: Rotation { origin.x: 30; origin.y: 30; angle: 270} height: 60 diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Icon.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Icon.qml index 1a24031..68f9c53 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Icon.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Icon.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml index 5488fe0..96814d5 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogGraphCanvas.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml index 2311c4d..749df05 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -39,6 +39,7 @@ ApplicationWindow { SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active } SystemPalette { id: sysPaletteIn; colorGroup: SystemPalette.Disabled } + menuBar: appMenu.trueItem GreetScreen {} @@ -193,12 +194,12 @@ ApplicationWindow { "objects": objs, "type": "logplotv1" })) - alert.show("Saved plot to '" + filename.split("/").pop() + "'.") + alert.show(qsTr("Saved plot to '%1'.").arg(filename.split("/").pop())) } function loadDiagram(filename) { let basename = filename.split("/").pop() - alert.show("Loading file '" + basename + "'.") + alert.show(qsTr("Loading file '%1'.").arg(basename)) let data = JSON.parse(Helper.load(filename)) let error = ""; if(Object.keys(data).includes("type") && data["type"] == "logplotv1") { @@ -237,7 +238,7 @@ ApplicationWindow { Objects.currentObjects[objType].push(obj) } } else { - error += "Unknown object type: " +objType + "\n"; + error += qsTr("Unknown object type: %1.").arg(objType) + "\n"; } } // Refreshing sidebar @@ -251,15 +252,15 @@ ApplicationWindow { objectLists.update() } } else { - error = "Invalid file provided." + error = qsTr("Invalid file provided.") } if(error != "") { console.log(error) - alert.show("Could not save file: " + error) + alert.show(qsTr("Could not save file: ") + error) // TODO: Error handling } drawCanvas.requestPaint() - alert.show("Loaded file '" + basename + "'.") + alert.show(qsTr("Loaded file '%1'.").arg(basename)) } Timer { @@ -280,7 +281,7 @@ ApplicationWindow { var file = Helper.gettmpfile() drawCanvas.save(file) Helper.copyImageToClipboard() - alert.show("Copied plot screenshot to clipboard!") + alert.show(qsTr("Copied plot screenshot to clipboard!")) } function showAlert(alertText) { diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/EditorDialog.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/EditorDialog.qml index 89a39ae..b7e45d0 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/EditorDialog.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/EditorDialog.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -42,7 +42,7 @@ D.Dialog { anchors.left: parent.left anchors.top: parent.top verticalAlignment: TextInput.AlignVCenter - text: `Edit properties of ${objEditor.objType} ${objEditor.obj.name}` + text: qsTr("Edit properties of %1 %2").arg(Objects.types[objEditor.objType].displayType()).arg(objEditor.obj.name) font.pixelSize: 20 color: sysPalette.windowText } @@ -56,7 +56,7 @@ D.Dialog { TextSetting { id: nameProperty height: 30 - label: "Name" + label: qsTr("Name") icon: "icons/settings/custom/label.svg" min: 1 width: dlgProperties.width @@ -82,13 +82,14 @@ D.Dialog { id: labelContentProperty height: 30 width: dlgProperties.width - label: "Label content" - model: ["null", "name", "name + value"] + label: qsTr("Label content") + model: [qsTr("null"), qsTr("name"), qsTr("name + value")] + property var idModel: ["null", "name", "name + value"] icon: "icons/settings/custom/label.svg" - currentIndex: model.indexOf(objEditor.obj.labelContent) + currentIndex: idModel.indexOf(objEditor.obj.labelContent) onActivated: function(newIndex) { - if(model[newIndex] != objEditor.obj.labelContent) { - objEditor.obj.labelContent = model[newIndex] + if(idModel[newIndex] != objEditor.obj.labelContent) { + objEditor.obj.labelContent = idModel[newIndex] objectListList.update() } } @@ -109,7 +110,7 @@ D.Dialog { width: parent.width height: visible ? implicitHeight : 0 visible: modelData[0].startsWith('comment') - text: visible ? modelData[1].replace(/\{name\}/g, objEditor.obj.name) : '' + text: visible ? (modelData[1].replace(/\{name\}/g, objEditor.obj.name)) : '' //color: sysPalette.windowText wrapMode: Text.WordWrap } @@ -181,7 +182,7 @@ D.Dialog { property bool selectObjMode: paramTypeIn(modelData[1], ['ObjectType']) model: visible ? - (selectObjMode ? Objects.getObjectsName(modelData[1].objType).concat(['+ Create new ' + modelData[1].objType]) : modelData[1].values) + (selectObjMode ? Objects.getObjectsName(modelData[1].objType).concat([qsTr("+ Create new %1").arg(Objects.types[modelData[1].objType].displayType())]) : modelData[1].values) : [] visible: paramTypeIn(modelData[1], ['ObjectType', 'Enum']) currentIndex: model.indexOf(selectObjMode ? objEditor.obj[modelData[0]].name : objEditor.obj[modelData[0]]) @@ -195,7 +196,7 @@ D.Dialog { // Creating new object. selectedObj = Objects.createNewRegisteredObject(modelData[1].objType) history.addToHistory(new HistoryLib.CreateNewObject(selectedObj.name, modelData[1].objType, selectedObj.export())) - model = Objects.getObjectsName(modelData[1].objType).concat(['+ Create new ' + modelData[1].objType]) + model = Objects.getObjectsName(modelData[1].objType).concat([qsTr("+ Create new %1").arg(Objects.types[modelData[1].objType].displayType())]) currentIndex = model.indexOf(selectedObj.name) } //Objects.currentObjects[objEditor.objType][objEditor.objIndex].requiredBy = objEditor.obj[modelData[0]].filter((obj) => objEditor.obj.name != obj.name) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml index 25a256d..b99641a 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -29,7 +29,7 @@ Column { Label { id: createTitle verticalAlignment: TextInput.AlignVCenter - text: '+ Create new:' + text: qsTr('+ Create new:') font.pixelSize: 20 } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml index c3b5310..085d5b4 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -60,7 +60,7 @@ ListView { } ToolTip.visible: hovered - ToolTip.text: checked ? `Hide all ${Objects.types[objType].displayTypeMultiple()}` : `Show all ${Objects.types[objType].displayTypeMultiple()}` + ToolTip.text: checked ? qsTr("Hide all %1").arg(Objects.types[objType].displayTypeMultiple()) : qsTr("Show all %1").arg(Objects.types[objType].displayTypeMultiple()) } Label { @@ -96,7 +96,9 @@ ListView { } ToolTip.visible: hovered - ToolTip.text: checked ? `Hide ${objType} ${obj.name}` : `Show ${objType} ${obj.name}` + ToolTip.text: checked ? + qsTr("Hide %1 %2").arg(Objects.types[objType].displayType()).arg(obj.name) : + qsTr("Show %1 %2").arg(Objects.types[objType].displayType()).arg(obj.name) } Label { @@ -134,7 +136,7 @@ ListView { property bool hasYProp: Objects.types[objType].properties().hasOwnProperty('y') visible: hasXProp || hasYProp ToolTip.visible: hovered - ToolTip.text: 'Set ' + Objects.types[objType].displayType() + ' position.' + ToolTip.text: qsTr("Set %1 %2 position").arg(Objects.types[objType].displayType()).arg(obj.name) onClicked: { positionPicker.objType = objType @@ -159,7 +161,7 @@ ListView { icon.source: '../icons/delete.svg' icon.color: sysPalette.buttonText ToolTip.visible: hovered - ToolTip.text: 'Delete ' + Objects.types[objType].displayType() + '.' + ToolTip.text: qsTr("Delete %1 %2").arg(Objects.types[objType].displayType()).arg(obj.name) onClicked: { history.addToHistory(new HistoryLib.DeleteObject( @@ -191,8 +193,8 @@ ListView { D.ColorDialog { id: pickColor - color: obj.color - title: `Pick new color for ${objType} ${obj.name}` + color: obj.color.arg(obj.name) + title: qsTr("Pick new color for %1 %2").arg(Objects.types[objType].displayType()) onAccepted: { history.addToHistory(new HistoryLib.EditedProperty( obj.name, objType, "color", diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml index c684836..6a5399a 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -85,7 +85,7 @@ Item { Row { height: precisionSlider.height Text { - text: " Pointer precision: " + text: " "+ qsTr("Pointer precision:") + " " color: 'black' anchors.verticalCenter: parent.verticalCenter } @@ -105,7 +105,7 @@ Item { CheckBox { id: snapToGridCheckbox - text: "Snap to grid" + text: qsTr("Snap to grid") checked: false } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml index 38a30c0..b701dd0 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -70,7 +70,7 @@ ScrollView { id: zoomX height: 30 isDouble: true - label: "X Zoom" + label: qsTr("X Zoom") min: 1 icon: "icons/settings/xzoom.svg" width: settings.settingWidth @@ -85,7 +85,7 @@ ScrollView { id: zoomY height: 30 isDouble: true - label: "Y Zoom" + label: qsTr("Y Zoom") icon: "icons/settings/yzoom.svg" width: settings.settingWidth value: settings.yzoom.toFixed(2) @@ -101,7 +101,7 @@ ScrollView { height: 30 isDouble: true min: -Infinity - label: "Min X" + label: qsTr("Min X") icon: "icons/settings/xmin.svg" width: settings.settingWidth defValue: settings.xmin @@ -120,7 +120,7 @@ ScrollView { height: 30 isDouble: true min: -Infinity - label: "Max Y" + label: qsTr("Max Y") icon: "icons/settings/ymax.svg" width: settings.settingWidth defValue: settings.ymax @@ -135,7 +135,7 @@ ScrollView { height: 30 isDouble: true min: -Infinity - label: "Max X" + label: qsTr("Max X") icon: "icons/settings/xmax.svg" width: settings.settingWidth value: canvas.px2x(canvas.canvasSize.width).toFixed(2) @@ -154,7 +154,7 @@ ScrollView { height: 30 isDouble: true min: -Infinity - label: "Min Y" + label: qsTr("Min Y") icon: "icons/settings/ymin.svg" width: settings.settingWidth defValue: canvas.px2y(canvas.canvasSize.height).toFixed(2) @@ -171,7 +171,7 @@ ScrollView { TextSetting { id: xAxisStep height: 30 - label: "X Axis Step" + label: qsTr("X Axis Step") icon: "icons/settings/xaxisstep.svg" width: settings.settingWidth defValue: settings.xaxisstep @@ -185,7 +185,7 @@ ScrollView { TextSetting { id: yAxisStep height: 30 - label: "Y Axis Step" + label: qsTr("Y Axis Step") icon: "icons/settings/yaxisstep.svg" width: settings.settingWidth defValue: settings.yaxisstep @@ -199,7 +199,7 @@ ScrollView { id: lineWidth height: 30 isDouble: true - label: "Line width" + label: qsTr("Line width") min: 1 icon: "icons/settings/linewidth.svg" width: settings.settingWidth @@ -214,7 +214,7 @@ ScrollView { id: textSize height: 30 isDouble: true - label: "Text size (px)" + label: qsTr("Text size (px)") min: 1 icon: "icons/settings/textsize.svg" width: settings.settingWidth @@ -229,7 +229,7 @@ ScrollView { id: xAxisLabel height: 30 width: settings.settingWidth - label: 'X Label' + label: qsTr('X Label') icon: "icons/settings/xlabel.svg" model: ListModel { ListElement { text: "" } @@ -255,7 +255,7 @@ ScrollView { id: yAxisLabel height: 30 width: settings.settingWidth - label: 'Y Label' + label: qsTr('Y Label') icon: "icons/settings/ylabel.svg" model: ListModel { ListElement { text: "" } @@ -283,7 +283,7 @@ ScrollView { CheckBox { id: logScaleX checked: settings.logscalex - text: 'X Log scale' + text: qsTr('X Log scale') onClicked: { settings.logscalex = checked settings.changed() @@ -293,7 +293,7 @@ ScrollView { CheckBox { id: showXGrad checked: settings.showxgrad - text: 'Show X graduation' + text: qsTr('Show X graduation') onClicked: { settings.showxgrad = checked settings.changed() @@ -303,7 +303,7 @@ ScrollView { CheckBox { id: showYGrad checked: settings.showygrad - text: 'Show Y graduation' + text: qsTr('Show Y graduation') onClicked: { settings.showygrad = checked settings.changed() @@ -314,7 +314,7 @@ ScrollView { id: copyToClipboard height: 30 width: settings.settingWidth - text: "Copy to clipboard" + text: qsTr("Copy to clipboard") icon.name: 'editcopy' onClicked: root.copyDiagramToClipboard() } @@ -323,7 +323,7 @@ ScrollView { id: saveDiagram height: 30 width: settings.settingWidth - text: "Save plot" + text: qsTr("Save plot") icon.name: 'document-save' onClicked: save() } @@ -332,7 +332,7 @@ ScrollView { id: saveDiagramAs height: 30 width: settings.settingWidth - text: "Save plot as" + text: qsTr("Save plot as") icon.name: 'document-save-as' onClicked: saveAs() } @@ -341,7 +341,7 @@ ScrollView { id: loadDiagram height: 30 width: settings.settingWidth - text: "Load plot" + text: qsTr("Load plot") icon.name: 'document-open' onClicked: load() } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml index 5c20f36..8665eb8 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/historylib.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/historylib.js index cae0769..7d23ee5 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/historylib.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/historylib.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -74,7 +74,7 @@ class CreateNewObject extends Action { } getReadableString() { - return `New ${this.targetType} ${this.targetName} created.` + return qsTr("New %1 %2 created.").arg(this.targetType).arg(this.targetName) } } @@ -91,7 +91,7 @@ class DeleteObject extends CreateNewObject { } getReadableString() { - return `${this.targetType} ${this.targetName} deleted.` + return qsTr("%1 %2 deleted.").arg(this.targetType).arg(this.targetName) } } @@ -130,7 +130,7 @@ class EditedProperty extends Action { getReadableString() { var prev = this.previousValue == null ? ""+this.previousValue : this.previousValue.toString() var next = this.newValue == null ? ""+this.newValue : this.newValue.toString() - return `${this.targetPropertyReadable} of ${this.targetType} ${this.targetName} changed from "${prev}" to "${next}".` + return qsTr('%1 of %2 %3 changed from "%4" to "%5".').arg(this.targetPropertyReadable).arg(this.targetType).arg(this.targetName).arg(prev).arg(next) } } @@ -144,9 +144,9 @@ class EditedVisibility extends EditedProperty { getReadableString() { if(this.newValue) { - return `${this.targetType} ${this.targetName} shown.` + return qsTr('%1 %2 shown.').arg(this.targetType).arg(this.targetName) } else { - return `${this.targetType} ${this.targetName} hidden.` + return qsTr('%1 %2 hidden.').arg(this.targetType).arg(this.targetName) } } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/latex.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/latex.js index 5015415..772a376 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/latex.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/latex.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/mathlib.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/mathlib.js index 2c52844..81762b4 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/mathlib.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/mathlib.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objects.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objects.js index 52bfde8..700cc85 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objects.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objects.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/autoload.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/autoload.js index 7ab6308..02a6646 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/autoload.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/autoload.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/common.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/common.js index 7cbfaab..32fda9d 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/common.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/common.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/function.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/function.js index 8b11990..bb4dc6e 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/function.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/function.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -26,8 +26,8 @@ class Function extends Common.ExecutableObject { static type(){return 'Function'} - static displayType(){return 'Function'} - static displayTypeMultiple(){return 'Functions'} + static displayType(){return qsTr('Function')} + static displayTypeMultiple(){return qsTr('Functions')} static properties() {return { 'expression': 'Expression', 'definitionDomain': 'Domain', diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/gainbode.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/gainbode.js index 7ecd963..a3e5a35 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/gainbode.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/gainbode.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -28,8 +28,8 @@ class GainBode extends Common.ExecutableObject { static type(){return 'Gain Bode'} - static displayType(){return 'Bode Magnitude'} - static displayTypeMultiple(){return 'Bode Magnitudes'} + static displayType(){return qsTr('Bode Magnitude')} + static displayTypeMultiple(){return qsTr('Bode Magnitudes')} static properties() {return { 'om_0': new P.ObjectType('Point'), 'pass': new P.Enum('high', 'low'), @@ -69,7 +69,8 @@ class GainBode extends Common.ExecutableObject { } getReadableString() { - return `${this.name}: ${this.pass}-pass; ${this.om_0.name} = ${this.om_0.x}\n ${' '.repeat(this.name.length)}${this.gain.toString(true)} dB/dec` + let pass = this.pass == "low" ? qsTr("low-pass") : qsTr("high-pass"); + return `${this.name}: ${pass}; ${this.om_0.name} = ${this.om_0.x}\n ${' '.repeat(this.name.length)}${this.gain.toString(true)} dB/dec` } export() { diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/phasebode.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/phasebode.js index 63dba8b..c747c22 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/phasebode.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/phasebode.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -27,8 +27,8 @@ class PhaseBode extends Common.ExecutableObject { static type(){return 'Phase Bode'} - static displayType(){return 'Bode Phase'} - static displayTypeMultiple(){return 'Bode Phases'} + static displayType(){return qsTr('Bode Phase')} + static displayTypeMultiple(){return qsTr('Bode Phases')} static properties() {return { 'om_0': new P.ObjectType('Point'), 'phase': 'Expression', diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/point.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/point.js index db3839a..a2e9e54 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/point.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/point.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -25,8 +25,8 @@ class Point extends Common.DrawableObject { static type(){return 'Point'} - static displayType(){return 'Point'} - static displayTypeMultiple(){return 'Points'} + static displayType(){return qsTr('Point')} + static displayTypeMultiple(){return qsTr('Points')} static properties() {return { 'x': 'Expression', diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/repartition.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/repartition.js index 2d29d0d..9baed2b 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/repartition.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/repartition.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -23,8 +23,8 @@ class RepartitionFunction extends Common.ExecutableObject { static type(){return 'Repartition'} - static displayType(){return 'Repartition'} - static displayTypeMultiple(){return 'Repartition functions'} + static displayType(){return qsTr('Repartition')} + static displayTypeMultiple(){return qsTr('Repartition functions')} static properties() {return { 'beginIncluded': 'boolean', 'drawLineEnds': 'boolean', diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sequence.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sequence.js index bbd53b2..e1fd800 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sequence.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sequence.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -26,8 +26,8 @@ class Sequence extends Common.ExecutableObject { static type(){return 'Sequence'} - static displayType(){return 'Sequence'} - static displayTypeMultiple(){return 'Sequences'} + static displayType(){return qsTr('Sequence')} + static displayTypeMultiple(){return qsTr('Sequences')} static properties() {return { 'drawPoints': 'boolean', 'drawDashedLines': 'boolean', diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sommegainsbode.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sommegainsbode.js index 57f0ec7..20f1edb 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sommegainsbode.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sommegainsbode.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -27,8 +27,8 @@ class SommeGainsBode extends Common.DrawableObject { static type(){return 'Somme gains Bode'} - static displayType(){return 'Bode Magnitudes Sum'} - static displayTypeMultiple(){return 'Bode Magnitudes Sum'} + static displayType(){return qsTr('Bode Magnitudes Sum')} + static displayTypeMultiple(){return qsTr('Bode Magnitudes Sum')} static createable() {return false} static properties() {return { 'labelPosition': new P.Enum('above', 'below', 'left', 'right', 'above-left', 'above-right', 'below-left', 'below-right'), diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sommephasesbode.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sommephasesbode.js index 4d0c6f8..7617521 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sommephasesbode.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/sommephasesbode.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -26,8 +26,8 @@ class SommePhasesBode extends Common.ExecutableObject { static type(){return 'Somme phases Bode'} - static displayType(){return 'Bode Phases Sum'} - static displayTypeMultiple(){return 'Bode Phases Sum'} + static displayType(){return qsTr('Bode Phases Sum')} + static displayTypeMultiple(){return qsTr('Bode Phases Sum')} static createable() {return false} static properties() {return { 'labelPosition': new P.Enum('above', 'below', 'left', 'right', 'above-left', 'above-right', 'below-left', 'below-right'), diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js index 45fd633..b67932c 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -25,8 +25,8 @@ class Text extends Common.DrawableObject { static type(){return 'Text'} - static displayType(){return 'Text'} - static displayTypeMultiple(){return 'Texts'} + static displayType(){return qsTr('Text')} + static displayTypeMultiple(){return qsTr('Texts')} static properties() {return { 'x': 'Expression', 'y': 'Expression', diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/xcursor.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/xcursor.js index c6eae5d..09e548b 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/xcursor.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/xcursor.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -26,8 +26,8 @@ class XCursor extends Common.DrawableObject { static type(){return 'X Cursor'} - static displayType(){return 'X Cursor'} - static displayTypeMultiple(){return 'X Cursors'} + static displayType(){return qsTr('X Cursor')} + static displayTypeMultiple(){return qsTr('X Cursors')} static properties() { return { 'x': 'Expression', diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parameters.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parameters.js index 1eca5ae..710a3f7 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parameters.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parameters.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/ast.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/ast.js index 82d07f1..e7403a2 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/ast.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/ast.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -18,7 +18,7 @@ .pragma library -import "reference.js" as Reference +.import "reference.js" as Reference const OPERATION_PRIORITY = { "+": 10, "-": 10, diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/builder.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/builder.js index d705491..75ce262 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/builder.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/builder.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/common.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/common.js index 120411f..1d10237 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/common.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/common.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -45,7 +45,7 @@ class InputExpression { } raise(message) { - throw new SyntaxError(message + " at " + this.position ".") + throw new SyntaxError(message + " at " + this.position + ".") } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/reference.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/reference.js index 48ad2a8..367432a 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/reference.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/reference.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/tokenizer.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/tokenizer.js index dbb7abd..f0e02c7 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/tokenizer.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/tokenizer.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -18,7 +18,7 @@ .pragma library -import "reference.js" as Reference +.import "reference.js" as Reference const WHITESPACES = " \t\n\r" const STRING_LIMITORS = '"\'`'; diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/utils.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/utils.js index 27757a6..a86a0fa 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/utils.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/utils.js @@ -1,5 +1,5 @@ /** - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify diff --git a/LogarithmPlotter/update.py b/LogarithmPlotter/update.py index 35df66f..7e525a1 100644 --- a/LogarithmPlotter/update.py +++ b/LogarithmPlotter/update.py @@ -1,5 +1,5 @@ """ - * LogarithmPlotter - Create graphs with logarithm scales. + * LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions. * Copyright (C) 2022 Ad5001 * * This program is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ * along with this program. If not, see . """ -from PySide2.QtCore import Qt, QRunnable, QThreadPool, QThread, QObject, Signal +from PySide2.QtCore import Qt, QRunnable, QThreadPool, QThread, QObject, Signal, QCoreApplication from urllib.request import urlopen from urllib.error import HTTPError, URLError from sys import argv @@ -51,17 +51,16 @@ class UpdateCheckerRunnable(QRunnable): current_version_tuple = self.current_version.split(".") is_version_newer = version_tuple > current_version_tuple if is_version_newer: - msg_text = "An update for LogarithPlotter (v" + version + ") is available." + msg_text = QCoreApplication.translate("update","An update for LogarithPlotter (v{}) is available.").format(version) update_available = True else: show_alert = False - msg_text = "No update available." + msg_text = QCoreApplication.translate("update","No update available.") except HTTPError as e: - msg_text = "Could not fetch update information: Server error " + str(e.code) + "." + msg_text = QCoreApplication.translate("update","Could not fetch update information: Server error {}.").format(str(e.code)) except URLError as e: - msg_text = "Could not fetch update information: Could not connect to the update server. " + str(e.reason) + "." - print(msg_text) + msg_text = QCoreApplication.translate("update","Could not fetch update information: {}.").format(str(e.reason)) self.callback.got_update_info.emit(show_alert, msg_text,update_available) def check_for_updates(current_version, window): diff --git a/build-macosx.sh b/build-macosx.sh index 5e17dff..30a902d 100755 --- a/build-macosx.sh +++ b/build-macosx.sh @@ -2,7 +2,14 @@ rm $(find . -name "*.qmlc") rm $(find . -name "*.pyc") python3 -m pip install -U pyinstaller + +# Buiilding translations +cd "LogarithmPlotter/i18n/" +bash release.sh +cd ../../ + pyinstaller --add-data "LogarithmPlotter/qml:qml" \ + --add-data "LogarithmPlotter/i18n:i18n" \ --add-data "LICENSE.md:." \ --add-data "mac/logarithmplotterfile.icns:." \ --add-data "README.md:." \ diff --git a/build-windows.bat b/build-windows.bat index ed31a37..297d132 100644 --- a/build-windows.bat +++ b/build-windows.bat @@ -1,3 +1,9 @@ rem Need pyinstaller >= 4.3, or there is an issue regarding the PATH of the building. python -m pip install -U pyinstaller>=4.3 -pyinstaller --add-data "logplotter.svg;." --add-data "LogarithmPlotter/qml;qml" --noconsole LogarithmPlotter/logarithmplotter.py --icon=win/logarithmplotter.ico -n logarithmplotter + +rem Buiilding translations +cd "LogarithmPlotter\i18n" +bash release.sh +cd ..\.. + +pyinstaller --add-data "logplotter.svg;." --add-data "LogarithmPlotter/qml;qml" --add-data "LogarithmPlotter/i18n;i18n" --noconsole LogarithmPlotter/logarithmplotter.py --icon=win/logarithmplotter.ico -n logarithmplotter diff --git a/build-wine.sh b/build-wine.sh index e802ac5..329dabb 100644 --- a/build-wine.sh +++ b/build-wine.sh @@ -3,4 +3,10 @@ rm $(find . -name "*.qmlc") rm $(find . -name "*.pyc") wine python -m pip install -U pyinstaller -wine pyinstaller --add-data "logplotter.svg;." --add-data "LogarithmPlotter/qml;qml" --noconsole LogarithmPlotter/logarithmplotter.py --icon=win/logarithmplotter.ico -n logarithmplotter + +# Buiilding translations +cd "LogarithmPlotter/i18n/" +bash release.sh +cd ../../ + +wine pyinstaller --add-data "logplotter.svg;." --add-data "LogarithmPlotter/qml;qml" --add-data "LogarithmPlotter/i18n;i18n" --noconsole LogarithmPlotter/logarithmplotter.py --icon=win/logarithmplotter.ico -n logarithmplotter diff --git a/package-linux.sh b/package-linux.sh index 9e46527..e5e4dd4 100755 --- a/package-linux.sh +++ b/package-linux.sh @@ -1,5 +1,11 @@ #!/bin/bash +# Buiilding translations +cd "LogarithmPlotter/i18n/" +bash release.sh +cd ../../ + +# Deb python3 setup.py --remove-git-version --command-packages=stdeb.command sdist_dsc \ --package logarithmplotter --copyright-file linux/debian/copyright --suite impish --depends3 "$(cat linux/debian/depends)" --section science \ --debian-version "ppa1" bdist_deb diff --git a/run.py b/run.py index ead8e33..dbe6560 100644 --- a/run.py +++ b/run.py @@ -1,5 +1,16 @@ +def update_translations(): + """ + Updates all binary translations + """ + from os import system, getcwd, chdir, path + pwd = getcwd() + chdir(path.join("LogarithmPlotter", "i18n")) + system("./release.sh") + chdir(pwd) + def run(): + update_translations() from LogarithmPlotter import logarithmplotter logarithmplotter.run()