fr:develop:collaboration:dev:translation

Differences

This shows you the differences between two versions of the page.

fr:develop:collaboration:dev:translation [2021/03/11 21:55] – créée qroyerfr:develop:collaboration:dev:translation [2021/09/28 16:17] () qroyer
 1:  1:
-===== Traduction du logiciel =====+====== Traduction du logiciel ======
  
-==== Prés-requis ====+===== Prés-requis =====
  
   * Linguist.exe : (https://github.com/thurask/Qt-Linguist/releases)   * Linguist.exe : (https://github.com/thurask/Qt-Linguist/releases)
-  * environnement virtuel d’HABBY avec PyQt5+  * environnement Python HABBY avec PyQt5
  
-==== Utilisation dans le code ====+===== Utilisation dans le code =====
  
-=== Traduire des champs dans des classes Qt ===+==== Traduire des champs dans des classes Qt ====
  
-    self.tr(‘string to translate’)+  self.tr(‘string to translate’)
  
-=== Traduire des champs en dehors des classes Qt ===+==== Traduire des champs en dehors des classes Qt ====
  
 Si pas de classe ou heritage de classe qui pose problème :  Si pas de classe ou heritage de classe qui pose problème : 
  
-    from PyQt5.QtCore import QCoreApplication +  from PyQt5.QtCore import QCoreApplication 
-    text = QCoreApplication.translate(‘Input’, ‘string to translate’) # ‘Input’ sera le nom de la ‘fausse’ classe dans QLinguist et ‘Neglect’ le string à traduire.+  text = QCoreApplication.translate(‘Input’, ‘string to translate’) # ‘Input’ sera le nom de la ‘fausse’ classe dans QLinguist et ‘Neglect’ le string à traduire.
  
 Ou Ou
-    app = QApplication(sys.argv) +  app = QApplication(sys.argv) 
-    languageTranslator = QTranslator(app) +  languageTranslator = QTranslator(app) 
-    if language == 0: +  if language == 0: 
-        input_file_translation = 'Zen_EN' +      input_file_translation = 'Zen_EN' 
-        languageTranslator.load(input_file_translation, os.path.join(os.getcwd(), 'translation')) +      languageTranslator.load(input_file_translation, os.path.join(os.getcwd(), 'translation')) 
-    if language == 1: +  if language == 1: 
-        input_file_translation = 'Zen_FR' +      input_file_translation = 'Zen_FR' 
-        languageTranslator.load(input_file_translation, os.path.join(os.getcwd(), 'translation')) +      languageTranslator.load(input_file_translation, os.path.join(os.getcwd(), 'translation')) 
-    elif language == 2: +  elif language == 2: 
-        input_file_translation = 'Zen_ES' +      input_file_translation = 'Zen_ES' 
-        languageTranslator.load(input_file_translation, os.path.join(os.getcwd(), 'translation')) +      languageTranslator.load(input_file_translation, os.path.join(os.getcwd(), 'translation')) 
-    app.installTranslator(languageTranslator) +  app.installTranslator(languageTranslator) 
-    app.translate(‘Input’, ‘string to translate’)+  app.translate(‘Input’, ‘string to translate’)
  
-Attention : ne pas traduire ‘Warning :’ dans les champs de log car utilisé pour le code couleur. +===== Mise à jour des fichiers .ts à traduire dans HABBY =====
- +
-==== Mise à jour des fichiers .ts à traduire dans HABBY ====+
  
   * Vérifier que le fichier ‘habby_trans.pro’ contient bien les fichier.py contenant les champs à traduire   * Vérifier que le fichier ‘habby_trans.pro’ contient bien les fichier.py contenant les champs à traduire
-  * Lancer dans l’environnement virtuel et dans  ‘habby’ et pour mettre à jour les fichiers, lancer la commande : +  * Pour mettre à jour les fichiers, lancer dans l’environnement virtuel et dans le repertoire ‘habby’, lancer la commande : 
  
   python -m PyQt5.pylupdate_main habby_trans.pro   python -m PyQt5.pylupdate_main habby_trans.pro
 52:  50:
  
   * Relancer HABBY   * Relancer HABBY
 +
 +{{indexmenu_n>4}}
  • fr/develop/collaboration/dev/translation.1615496153.txt.gz
  • 2021/03/11 21:55
  • qroyer