ui: Set up translate features.

mesh
Pierre-Antoine Rouby 2023-03-27 14:55:03 +02:00
parent 1d4207a1fb
commit d299576a97
5 changed files with 117 additions and 68 deletions

View File

@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
_translate = QCoreApplication.translate
# -------------------- A --------------------
# -------------------- B --------------------
# -------------------- C --------------------
# -------------------- D --------------------
# -------------------- E --------------------
# -------------------- F --------------------
# -------------------- G --------------------
# -------------------- H --------------------
# -------------------- I --------------------
# -------------------- J --------------------
# -------------------- K --------------------
# -------------------- L --------------------
# -------------------- M --------------------
# -------------------- N --------------------
# -------------------- O --------------------
# -------------------- P --------------------
# -------------------- Q --------------------
# -------------------- R --------------------
# -------------------- S --------------------
# -------------------- T --------------------
# -------------------- U --------------------
# -------------------- V --------------------
# -------------------- W --------------------
# -------------------- X --------------------
# -------------------- Y --------------------
# -------------------- Z --------------------

16
src/lang/create_ts.sh Executable file
View File

@ -0,0 +1,16 @@
#! /bin/sh
SOURCES=$(find ../ -name "*.py")
FROM=$(find ../ -name "*.ui")
LANG="fr de"
for l in $LANG
do
pylupdate5 $SOURCES $FROM -ts $l.ts
done
for l in $LANG
do
lrelease $l.ts $l.qm
done

View File

@ -1,8 +1,9 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import sys, os
from PyQt5.QtCore import QTranslator
from PyQt5.QtWidgets import QApplication
from config import Config
@ -12,6 +13,11 @@ from model.Study import Study
def main():
conf = Config.load()
app = QApplication(sys.argv)
translator = QTranslator()
translator.load(os.path.dirname(__file__) + "/lang/fr.qm")
app.installTranslator(translator)
application = ApplicationWindow(conf=conf)
application.show()
sys.exit(app.exec_())

View File

@ -61,6 +61,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow):
self.init_callback()
self.default_style()
#self.ui.retranslateUi()
def enable_actions(self, action:str, enable:bool):
"""Enable of disable an action componant

View File

@ -615,63 +615,6 @@
</font>
</property>
</action>
<action name="action_plot_water_line">
<property name="text">
<string>Ligne d'eau</string>
</property>
</action>
<action name="actionLigne_d_eau_finale">
<property name="text">
<string>Ligne d'eau finale</string>
</property>
</action>
<action name="actionLigne_d_eau_enveloppe">
<property name="text">
<string>Ligne d'eau enveloppe</string>
</property>
</action>
<action name="actionVitesse_Pk_t_fix">
<property name="text">
<string>Vitesse(Pk) à t fixé</string>
</property>
</action>
<action name="actionVitesse_t_Pk_fix">
<property name="text">
<string>Vitesse(t) à Pk fixé</string>
</property>
</action>
<action name="actionCharge_hydraulique_Pk_t_fix">
<property name="text">
<string>Charge hydraulique(Pk) à t fixé</string>
</property>
</action>
<action name="actionCharge_hydraulique_t_Pk_fix">
<property name="text">
<string>Charge hydraulique(t) à Pk fixé</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</action>
<action name="actionVoir_l_animation_MAGE">
<property name="text">
<string>Voir l'animation (MAGE)</string>
</property>
</action>
<action name="actionAutres_r_sulats_MAGE">
<property name="text">
<string>Autres résulats MAGE</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</action>
<action name="action_map_current_reach">
<property name="text">
<string>Map current reach</string>
@ -758,7 +701,7 @@
<string>Run solver</string>
</property>
<property name="toolTip">
<string>Lancer le solveur pour réaliser une simulation</string>
<string>Run solver on current study</string>
</property>
<property name="shortcut">
<string>Ctrl+X</string>
@ -791,7 +734,7 @@
<string>Run external meshing tool</string>
</property>
<property name="toolTip">
<string>Lancer le mailleur externe sur la géométrie du bief courant</string>
<string>Run meshing tool on current reach geometry</string>
</property>
</action>
<action name="action_toolBar_listing">
@ -806,7 +749,7 @@
<string>Display simulation listing</string>
</property>
<property name="toolTip">
<string>Aficher les listings de la simulation courante</string>
<string>Display current simulation listing</string>
</property>
</action>
<action name="action_toolBar_network">
@ -818,7 +761,7 @@
<string>River network</string>
</property>
<property name="toolTip">
<string>Open river network edition</string>
<string>Edit river network</string>
</property>
</action>
<action name="action_toolBar_geometry">
@ -830,7 +773,7 @@
<string>Geometry</string>
</property>
<property name="toolTip">
<string>Open geometry edition</string>
<string>Edit reach geometry</string>
</property>
</action>
<action name="action_toolBar_mesh">
@ -861,7 +804,7 @@
<string>Lateral contribution</string>
</property>
<property name="toolTip">
<string>Ouvrir l'éditeur des Apports Latéraux Distribués</string>
<string>Edit lateral contribution</string>
</property>
</action>
<action name="action_toolBar_spills">
@ -869,7 +812,7 @@
<string>Spills</string>
</property>
<property name="toolTip">
<string>Ouvrir l'éditeur des Déversements Latéraux</string>
<string>Edit lateral spills</string>
</property>
</action>
<action name="action_toolBar_sections">
@ -877,7 +820,7 @@
<string>Sections</string>
</property>
<property name="toolTip">
<string>Ouvrir l'éditeur des tronçons pour les frottements et Apports Latéraux</string>
<string>Edit section frictions and lateral contributions</string>
</property>
</action>
<action name="action_toolBar_frictions">
@ -885,7 +828,7 @@
<string>Frictions</string>
</property>
<property name="toolTip">
<string>Ouvrir l'éditeur des frottements au fond</string>
<string>Edit friction at the bottom</string>
</property>
</action>
<action name="action_toolBar_building">
@ -893,7 +836,7 @@
<string>Building</string>
</property>
<property name="toolTip">
<string>Ouvrir l'éditeur des ouvrages (seuils, vannes, etc.), singularités et pompes</string>
<string>Edit building (valve, ...), singularity and pump</string>
</property>
</action>
<action name="action_menu_edit">