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

View File

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

View File

@ -615,63 +615,6 @@
</font> </font>
</property> </property>
</action> </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"> <action name="action_map_current_reach">
<property name="text"> <property name="text">
<string>Map current reach</string> <string>Map current reach</string>
@ -758,7 +701,7 @@
<string>Run solver</string> <string>Run solver</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Lancer le solveur pour réaliser une simulation</string> <string>Run solver on current study</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+X</string> <string>Ctrl+X</string>
@ -791,7 +734,7 @@
<string>Run external meshing tool</string> <string>Run external meshing tool</string>
</property> </property>
<property name="toolTip"> <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> </property>
</action> </action>
<action name="action_toolBar_listing"> <action name="action_toolBar_listing">
@ -806,7 +749,7 @@
<string>Display simulation listing</string> <string>Display simulation listing</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Aficher les listings de la simulation courante</string> <string>Display current simulation listing</string>
</property> </property>
</action> </action>
<action name="action_toolBar_network"> <action name="action_toolBar_network">
@ -818,7 +761,7 @@
<string>River network</string> <string>River network</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Open river network edition</string> <string>Edit river network</string>
</property> </property>
</action> </action>
<action name="action_toolBar_geometry"> <action name="action_toolBar_geometry">
@ -830,7 +773,7 @@
<string>Geometry</string> <string>Geometry</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Open geometry edition</string> <string>Edit reach geometry</string>
</property> </property>
</action> </action>
<action name="action_toolBar_mesh"> <action name="action_toolBar_mesh">
@ -861,7 +804,7 @@
<string>Lateral contribution</string> <string>Lateral contribution</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Ouvrir l'éditeur des Apports Latéraux Distribués</string> <string>Edit lateral contribution</string>
</property> </property>
</action> </action>
<action name="action_toolBar_spills"> <action name="action_toolBar_spills">
@ -869,7 +812,7 @@
<string>Spills</string> <string>Spills</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Ouvrir l'éditeur des Déversements Latéraux</string> <string>Edit lateral spills</string>
</property> </property>
</action> </action>
<action name="action_toolBar_sections"> <action name="action_toolBar_sections">
@ -877,7 +820,7 @@
<string>Sections</string> <string>Sections</string>
</property> </property>
<property name="toolTip"> <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> </property>
</action> </action>
<action name="action_toolBar_frictions"> <action name="action_toolBar_frictions">
@ -885,7 +828,7 @@
<string>Frictions</string> <string>Frictions</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Ouvrir l'éditeur des frottements au fond</string> <string>Edit friction at the bottom</string>
</property> </property>
</action> </action>
<action name="action_toolBar_building"> <action name="action_toolBar_building">
@ -893,7 +836,7 @@
<string>Building</string> <string>Building</string>
</property> </property>
<property name="toolTip"> <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> </property>
</action> </action>
<action name="action_menu_edit"> <action name="action_menu_edit">