Index: gc_lang/fr/oxt/About/About.py ================================================================== --- gc_lang/fr/oxt/About/About.py +++ gc_lang/fr/oxt/About/About.py @@ -5,11 +5,11 @@ import unohelper import uno import traceback import sys -import ab_strings +import ab_strings as ui import helpers from com.sun.star.awt import XActionListener from com.sun.star.beans import PropertyValue @@ -33,18 +33,19 @@ self.xDialog.insertByName(name, xWidget) return xWidget def run (self, sLang): try: - dUI = ab_strings.getUI(sLang) + ui.selectLang(sLang) + self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True) # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 160 self.xDialog.Height = 320 - self.xDialog.Title = dUI.get('windowtitle', "#err") + self.xDialog.Title = ui.get('windowtitle') xWindowSize = helpers.getWindowSize() self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) # xWidgets @@ -70,33 +71,33 @@ xPackageInfoProvider = xDefaultContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider") sExtPath = xPackageInfoProvider.getPackageLocation("French.linguistic.resources.from.Dicollecte.by.OlivierR") self._addWidget('imgMainLogo', 'ImageControl', 5, 5, 150, 80, ImageURL = sExtPath+"/img/logo120_text.png", Border = 0, ScaleMode = 1) # Infos - self._addWidget('lblVersion', 'FixedText', 10, 90, nLblWidth, 10, Label = dUI.get('version', "#err"), Align = 1, FontDescriptor = xFD2) - self._addWidget('lblLicence', 'FixedText', 10, 100, nLblWidth, 10, Label = dUI.get('license', "#err"), Align = 1, FontDescriptor = xFD2) - self._addWidget('lblWebsite', 'FixedHyperlink', 10, 110, nLblWidth, 10, Label = dUI.get('website', "#err"), Align = 1, \ + self._addWidget('lblVersion', 'FixedText', 10, 90, nLblWidth, 10, Label = ui.get('version'), Align = 1, FontDescriptor = xFD2) + self._addWidget('lblLicence', 'FixedText', 10, 100, nLblWidth, 10, Label = ui.get('license'), Align = 1, FontDescriptor = xFD2) + self._addWidget('lblWebsite', 'FixedHyperlink', 10, 110, nLblWidth, 10, Label = ui.get('website'), Align = 1, \ URL="https://grammalecte.net/?from=grammalecte-lo", FontDescriptor = xFD1, TextColor = nURLcolor) # Python self._addWidget('lblpython', 'FixedText', 10, 125, nLblWidth//2, 10, Align = 1, TextColor = 0x666666, FontDescriptor = xFD2, \ - Label = dUI.get('pythonver', "#err") + "{0[0]}.{0[1]}.{0[2]}".format(sys.version_info)) + Label = ui.get('pythonver') + "{0[0]}.{0[1]}.{0[2]}".format(sys.version_info)) self._addWidget('console_button', 'Button', nLblWidth-40, 124, 40, 10, \ - Label = dUI.get('console', "#err"), FontDescriptor = xFD2, TextColor = 0x666666) + Label = ui.get('console'), FontDescriptor = xFD2, TextColor = 0x666666) # other self._addWidget('line', 'FixedLine', 10, 140, nLblWidth, 10) # sponsors - self._addWidget('lblMsg', 'FixedText', 10, 155, nLblWidth, 10, Label = dUI.get('message', "#err"), FontDescriptor = xFD2, Align = 1) - self._addWidget('lblURL1', 'FixedHyperlink', 10, 170, nLblWidth, 10, Label = dUI.get('sponsor', "#err"), \ + self._addWidget('lblMsg', 'FixedText', 10, 155, nLblWidth, 10, Label = ui.get('message'), FontDescriptor = xFD2, Align = 1) + self._addWidget('lblURL1', 'FixedHyperlink', 10, 170, nLblWidth, 10, Label = ui.get('sponsor'), \ Align = 1, URL="http://lamouette.org/?from=grammalecte-lo", FontDescriptor = xFD3, TextColor = nURLcolor) self._addWidget('imgSponsor', 'ImageControl', 5, 180, 150, 50, ImageURL = sExtPath+"/img/LaMouette_small.png", Border = 0, ScaleMode = 1) - self._addWidget('lblURL2', 'FixedHyperlink', 10, 235, nLblWidth, 10, Label = dUI.get('sponsor2', "#err"), \ + self._addWidget('lblURL2', 'FixedHyperlink', 10, 235, nLblWidth, 10, Label = ui.get('sponsor2'), \ Align = 1, URL="https://www.algoo.fr/?from=grammalecte-lo", FontDescriptor = xFD3, TextColor = nURLcolor) self._addWidget('imgSponsor2', 'ImageControl', 5, 245, 150, 50, ImageURL = sExtPath+"/img/Algoo_logo.png", Border = 0, ScaleMode = 1) - self._addWidget('lblURL3', 'FixedHyperlink', 10, 300, nLblWidth, 10, Label = dUI.get('link', "#err"), \ + self._addWidget('lblURL3', 'FixedHyperlink', 10, 300, nLblWidth, 10, Label = ui.get('link'), \ Align = 1, URL="https://grammalecte.net/#thanks", FontDescriptor = xFD1, TextColor = nURLcolor) # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) self.xContainer.setModel(self.xDialog) Index: gc_lang/fr/oxt/About/ab_strings.py ================================================================== --- gc_lang/fr/oxt/About/ab_strings.py +++ gc_lang/fr/oxt/About/ab_strings.py @@ -1,43 +1,55 @@ -# About strings +# strings for About + + +sUI = "fr" + -def getUI (sLang): +def selectLang (sLang): + global sUI if sLang in dStrings: - return dStrings[sLang] - return dStrings["fr"] + sUI = sLang + + +def get (sMsgCode): + try: + return dStrings[sUI].get(sMsgCode, sMsgCode) + except: + return "#error" + dStrings = { "fr": { - "windowtitle": "À propos…", - "title": "Grammalecte", - "version": "Version : ${version}", - "license": "Licence : GPL 3", - "website": "Site web", - - "pythonver": "Python v", - "console": "Console", - - "message": "Avec le soutien de", - "sponsor": "La Mouette…", - "sponsor2": "Algoo…", - "link": "… et de nombreux contributeurs.", - - "close": "~OK" - }, + "windowtitle": "À propos…", + "title": "Grammalecte", + "version": "Version : ${version}", + "license": "Licence : GPL 3", + "website": "Site web", + + "pythonver": "Python v", + "console": "Console", + + "message": "Avec le soutien de", + "sponsor": "La Mouette…", + "sponsor2": "Algoo…", + "link": "… et de nombreux contributeurs.", + + "close": "~OK" + }, "en": { - "windowtitle": "About…", - "title": "Grammalecte", - "version": "Version: ${version}", - "license": "License: GPL 3", - "website": "Web site", - - "pythonver": "Python v", - "console": "Console", - - "message": "With the support of", - "sponsor": "La Mouette…", - "sponsor2": "Algoo…", - "link": "… and many contributors.", - - "close": "~OK" - } + "windowtitle": "About…", + "title": "Grammalecte", + "version": "Version: ${version}", + "license": "License: GPL 3", + "website": "Web site", + + "pythonver": "Python v", + "console": "Console", + + "message": "With the support of", + "sponsor": "La Mouette…", + "sponsor2": "Algoo…", + "link": "… and many contributors.", + + "close": "~OK" + } } Index: gc_lang/fr/oxt/ChangeAuthor/Author.py ================================================================== --- gc_lang/fr/oxt/ChangeAuthor/Author.py +++ gc_lang/fr/oxt/ChangeAuthor/Author.py @@ -1,16 +1,15 @@ -# -*- coding: utf8 -*- # Modify author field # by Olivier R. # License: MPL 2 import unohelper import uno import re import traceback -import ca_strings +import ca_strings as ui import helpers from com.sun.star.awt import XActionListener from com.sun.star.beans import PropertyValue @@ -18,11 +17,11 @@ class Author (unohelper.Base, XActionListener): def __init__ (self, ctx): self.ctx = ctx self.xSvMgr = self.ctx.ServiceManager self.xContainer = None - + def _addWidget (self, name, wtype, x, y, w, h, **kwargs): xWidget = self.xDialog.createInstance('com.sun.star.awt.UnoControl%sModel' % wtype) xWidget.Name = name xWidget.PositionX = x xWidget.PositionY = y @@ -33,17 +32,17 @@ self.xDialog.insertByName(name, xWidget) return xWidget def run (self, sLang): try: - dUI = ca_strings.getUI(sLang) + ui.selectLang(sLang) # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 160 self.xDialog.Height = 85 - self.xDialog.Title = dUI.get('title', "#err") + self.xDialog.Title = ui.get('title') xWindowSize = helpers.getWindowSize() self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) # fonts @@ -53,25 +52,25 @@ xFDBut.Name = "Verdana" # document xDesktop = self.ctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx) self.xDoc = xDesktop.getCurrentComponent() - sAuthor = self.xDoc.DocumentProperties.Author if self.xDoc.DocumentProperties.Author else dUI.get('empty', "#err") + sAuthor = self.xDoc.DocumentProperties.Author if self.xDoc.DocumentProperties.Author else ui.get('empty') # widgets nTextWidth = self.xDialog.Width - 20 - state = self._addWidget('state', 'FixedText', 10, 10, nTextWidth, 10, Label = dUI.get('state', "#err")) + state = self._addWidget('state', 'FixedText', 10, 10, nTextWidth, 10, Label = ui.get('state')) value = self._addWidget('value', 'FixedText', 10, 20, nTextWidth, 10, Label = sAuthor, FontSlant = 2, TextColor = 0x000044) - - inputlbl = self._addWidget('inputlbl', 'FixedText', 10, 34, nTextWidth, 10, Label = dUI.get('newvalue', "#err")) + + inputlbl = self._addWidget('inputlbl', 'FixedText', 10, 34, nTextWidth, 10, Label = ui.get('newvalue')) self.inputtxt = self._addWidget('input', 'Edit', 10, 45, nTextWidth-20, 12, Text=self.xDoc.DocumentProperties.Author, MaxTextLen=150) - but0 = self._addWidget('reset', 'Button', self.xDialog.Width-25, 45, 15, 12, Label = u"×", FontDescriptor = xFDBut, TextColor = 0x440000) + but0 = self._addWidget('reset', 'Button', self.xDialog.Width-25, 45, 15, 12, Label = "×", FontDescriptor = xFDBut, TextColor = 0x440000) but1 = self._addWidget('modify', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, \ - Label = dUI.get('modify', "#err"), FontDescriptor = xFDBut, TextColor = 0x004400) + Label = ui.get('modify'), FontDescriptor = xFDBut, TextColor = 0x004400) but2 = self._addWidget('cancel', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, \ - Label = dUI.get('cancel', "#err"), FontDescriptor = xFDBut, TextColor = 0x440000) + Label = ui.get('cancel'), FontDescriptor = xFDBut, TextColor = 0x440000) # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) self.xContainer.setModel(self.xDialog) self.xContainer.getControl('reset').addActionListener(self) @@ -84,11 +83,11 @@ xToolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx) self.xContainer.createPeer(xToolkit, None) self.xContainer.execute() except: traceback.print_exc() - + # XActionListener def actionPerformed (self, xActionEvent): try: if xActionEvent.ActionCommand == 'Reset': self.inputtxt.Text = "" Index: gc_lang/fr/oxt/ChangeAuthor/ca_strings.py ================================================================== --- gc_lang/fr/oxt/ChangeAuthor/ca_strings.py +++ gc_lang/fr/oxt/ChangeAuthor/ca_strings.py @@ -1,33 +1,45 @@ -# -*- encoding: UTF-8 -*- +# strings for change author + + +sUI = "fr" + -def getUI (sLang): +def selectLang (sLang): + global sUI if sLang in dStrings: - return dStrings[sLang] - return dStrings["fr"] + sUI = sLang + + +def get (sMsgCode): + try: + return dStrings[sUI].get(sMsgCode, sMsgCode) + except: + return "#error" + dStrings = { "fr": { - "title": "Grammalecte · Édition du champ “Auteur”", - - "state": "Valeur actuelle du champ “Auteur” :", - "empty": "[vide]", - - "newvalue": "Entrez la nouvelle valeur :", - - "modify": "Modifier", - "cancel": "Annuler" - }, + "title": "Grammalecte · Édition du champ “Auteur”", + + "state": "Valeur actuelle du champ “Auteur” :", + "empty": "[vide]", + + "newvalue": "Entrez la nouvelle valeur :", + + "modify": "Modifier", + "cancel": "Annuler" + }, "en": { - "title": "Grammalecte · Edition of field “Author”", - - "state": "Current value of field “Author”:", - "empty": "[empty]", - - "newvalue": "Enter the new value:", - - "modify": "Modify", - "cancel": "Cancel" - } + "title": "Grammalecte · Edition of field “Author”", + + "state": "Current value of field “Author”:", + "empty": "[empty]", + + "newvalue": "Enter the new value:", + + "modify": "Modify", + "cancel": "Cancel" + } } Index: gc_lang/fr/oxt/DictOptions/DictOptions.py ================================================================== --- gc_lang/fr/oxt/DictOptions/DictOptions.py +++ gc_lang/fr/oxt/DictOptions/DictOptions.py @@ -6,11 +6,11 @@ import uno import re import traceback import helpers -import do_strings +import do_strings as ui from com.sun.star.task import XJobExecutor from com.sun.star.awt import XActionListener from com.sun.star.beans import PropertyValue @@ -46,11 +46,11 @@ setattr(xWidget, k, w) self.xDialog.insertByName(name, xWidget) return xWidget def run (self, sLang): - self.dUI = do_strings.getUI(sLang) + ui.selectLang(sLang) self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx) self.xDocument = self.xDesktop.getCurrentComponent() self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True) @@ -62,11 +62,11 @@ # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 200 self.xDialog.Height = 285 - self.xDialog.Title = self.dUI.get('title', "#title#") + self.xDialog.Title = ui.get('title') xWindowSize = helpers.getWindowSize() self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) # fonts @@ -90,34 +90,34 @@ nWidth = self.xDialog.Width - 20 nHeight = 10 # Graphspell dictionary section - self._addWidget("graphspell_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = self.dUI.get("graphspell_section", "#err"), FontDescriptor = xFDTitle) - self.xMainDic = self._addWidget('activate_main', 'CheckBox', nX, nY1+15, nWidth, nHeight, Label = self.dUI.get('activate_main', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088, State = True) - self._addWidget('activate_main_descr', 'FixedText', nX+10, nY1+25, nWidth-10, nHeight*2, Label = self.dUI.get('activate_main_descr', "#err"), MultiLine = True) - self._addWidget('spelling', 'FixedText', nX+10, nY1+45, nWidth-80, nHeight, Label = self.dUI.get('spelling', "#err"), FontDescriptor = xFDSubTitle) + self._addWidget("graphspell_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = ui.get("graphspell_section"), FontDescriptor = xFDTitle) + self.xMainDic = self._addWidget('activate_main', 'CheckBox', nX, nY1+15, nWidth, nHeight, Label = ui.get('activate_main'), FontDescriptor = xFDSubTitle, TextColor = 0x000088, State = True) + self._addWidget('activate_main_descr', 'FixedText', nX+10, nY1+25, nWidth-10, nHeight*2, Label = ui.get('activate_main_descr'), MultiLine = True) + self._addWidget('spelling', 'FixedText', nX+10, nY1+45, nWidth-80, nHeight, Label = ui.get('spelling'), FontDescriptor = xFDSubTitle) self.xInfoDicButton = self._addWidget('info_dic_button', 'Button', nX+160, nY1+45, 12, 9, Label = "‹i›") - self.xSelClassic = self._addWidget('classic', 'RadioButton', nX+10, nY1+55, 50, nHeight, Label = self.dUI.get('classic', "#err")) - self.xSelReform = self._addWidget('reform', 'RadioButton', nX+65, nY1+55, 55, nHeight, Label = self.dUI.get('reform', "#err")) - self.xSelAllvars = self._addWidget('allvars', 'RadioButton', nX+120, nY1+55, 60, nHeight, Label = self.dUI.get('allvars', "#err")) - self.xCommunityDic = self._addWidget('activate_community', 'CheckBox', nX, nY2+15, nWidth, nHeight, Label = self.dUI.get('activate_community', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088, Enabled = False) - self._addWidget('activate_community_descr', 'FixedText', nX+10, nY2+25, nWidth-10, nHeight*1, Label = self.dUI.get('activate_community_descr', "#err"), MultiLine = True) - self.xPersonalDic = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = self.dUI.get('activate_personal', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088) - self._addWidget('activate_personal_descr', 'FixedText', nX+10, nY3+25, nWidth-10, nHeight*1, Label = self.dUI.get('activate_personal_descr', "#err"), MultiLine = True) + self.xSelClassic = self._addWidget('classic', 'RadioButton', nX+10, nY1+55, 50, nHeight, Label = ui.get('classic')) + self.xSelReform = self._addWidget('reform', 'RadioButton', nX+65, nY1+55, 55, nHeight, Label = ui.get('reform')) + self.xSelAllvars = self._addWidget('allvars', 'RadioButton', nX+120, nY1+55, 60, nHeight, Label = ui.get('allvars')) + self.xCommunityDic = self._addWidget('activate_community', 'CheckBox', nX, nY2+15, nWidth, nHeight, Label = ui.get('activate_community'), FontDescriptor = xFDSubTitle, TextColor = 0x000088, Enabled = False) + self._addWidget('activate_community_descr', 'FixedText', nX+10, nY2+25, nWidth-10, nHeight*1, Label = ui.get('activate_community_descr'), MultiLine = True) + self.xPersonalDic = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = ui.get('activate_personal'), FontDescriptor = xFDSubTitle, TextColor = 0x000088) + self._addWidget('activate_personal_descr', 'FixedText', nX+10, nY3+25, nWidth-10, nHeight*1, Label = ui.get('activate_personal_descr'), MultiLine = True) # Spell suggestion engine section - self._addWidget("suggestion_section", 'FixedLine', nX, nY4, nWidth, nHeight, Label = self.dUI.get("suggestion_section", "#err"), FontDescriptor = xFDTitle) - self.xGraphspellSugg = self._addWidget('activate_spell_sugg', 'CheckBox', nX, nY4+15, nWidth, nHeight, Label = self.dUI.get('activate_spell_sugg', "#err")) - self._addWidget('activate_spell_sugg_descr', 'FixedText', nX, nY4+25, nWidth, nHeight*6, Label = self.dUI.get('activate_spell_sugg_descr', "#err"), MultiLine = True) + self._addWidget("suggestion_section", 'FixedLine', nX, nY4, nWidth, nHeight, Label = ui.get("suggestion_section"), FontDescriptor = xFDTitle) + self.xGraphspellSugg = self._addWidget('activate_spell_sugg', 'CheckBox', nX, nY4+15, nWidth, nHeight, Label = ui.get('activate_spell_sugg')) + self._addWidget('activate_spell_sugg_descr', 'FixedText', nX, nY4+25, nWidth, nHeight*6, Label = ui.get('activate_spell_sugg_descr'), MultiLine = True) # Restart message - self._addWidget('restart', 'FixedText', nX, nY5, nWidth, nHeight*2, Label = self.dUI.get('restart', "#err"), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000) + self._addWidget('restart', 'FixedText', nX, nY5, nWidth, nHeight*2, Label = ui.get('restart'), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000) # Button - self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = self.dUI.get('apply_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500) - self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = self.dUI.get('cancel_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000) + self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = ui.get('apply_button'), FontDescriptor = xFDTitle, TextColor = 0x005500) + self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = ui.get('cancel_button'), FontDescriptor = xFDTitle, TextColor = 0x550000) self._loadOptions() # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) @@ -166,11 +166,11 @@ self.xHunspellNode.commitChanges() # Close window self.xContainer.endExecute() elif xActionEvent.ActionCommand == 'InfoDic': - MessageBox(self.xDocument, self.dUI.get('spelling_descr', "#err"), "Orthographe du français", nBoxType=INFOBOX, nBoxButtons=BUTTONS_OK) + MessageBox(self.xDocument, ui.get('spelling_descr'), "Orthographe du français", nBoxType=INFOBOX, nBoxButtons=BUTTONS_OK) else: self.xContainer.endExecute() except: traceback.print_exc() Index: gc_lang/fr/oxt/DictOptions/LexiconEditor.py ================================================================== --- gc_lang/fr/oxt/DictOptions/LexiconEditor.py +++ gc_lang/fr/oxt/DictOptions/LexiconEditor.py @@ -9,11 +9,11 @@ import os import traceback import platform import helpers -import lxe_strings +import lxe_strings as ui import grammalecte.graphspell as sc import grammalecte.graphspell.dawg as dawg import grammalecte.graphspell.ibdawg as ibdawg import grammalecte.fr.conj as conj import grammalecte.fr.conj_generator as conjgen @@ -111,18 +111,18 @@ self.xDialog.insertByName(name, xGridModel) return xGridModel def run (self, sLang, sWord=""): # ui lang + ui.selectLang(sLang) self.sLang = sLang - self.dUI = lxe_strings.getUI(sLang) # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 550 self.xDialog.Height = 290 - self.xDialog.Title = self.dUI.get('title', "#title#") + self.xDialog.Title = ui.get('title') xWindowSize = helpers.getWindowSize() self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) # fonts @@ -152,113 +152,113 @@ nXC = nXB + 165 nHeight = 10 #### Dictionary section - self._addWidget("dictionary_section", 'FixedLine', nX1, nY0, 170, nHeight, Label = self.dUI.get("dictionary_section", "#err"), FontDescriptor = xFDTitle, TextColor = 0x000088) - self._addWidget("save_date_label", 'FixedText', nXB, nY0+2, 80, nHeight, Label = self.dUI.get("save_date_label", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088) - self._addWidget("num_of_entries_label2", 'FixedText', nXC, nY0+2, 65, nHeight, Label = self.dUI.get("num_of_entries_label", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088) - self.xDateDic = self._addWidget("save_date", 'FixedText', nXB+85, nY0+2, 75, nHeight, Label = self.dUI.get("void", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088) + self._addWidget("dictionary_section", 'FixedLine', nX1, nY0, 170, nHeight, Label = ui.get("dictionary_section"), FontDescriptor = xFDTitle, TextColor = 0x000088) + self._addWidget("save_date_label", 'FixedText', nXB, nY0+2, 80, nHeight, Label = ui.get("save_date_label"), FontDescriptor = xFDSubTitle, TextColor = 0x000088) + self._addWidget("num_of_entries_label2", 'FixedText', nXC, nY0+2, 65, nHeight, Label = ui.get("num_of_entries_label"), FontDescriptor = xFDSubTitle, TextColor = 0x000088) + self.xDateDic = self._addWidget("save_date", 'FixedText', nXB+85, nY0+2, 75, nHeight, Label = ui.get("void"), FontDescriptor = xFDSubTitle, TextColor = 0x000088) self.xNumDic = self._addWidget("num_of_entries2", 'FixedText', nXC+70, nY0+2, 45, nHeight, Label = "0", FontDescriptor = xFDSubTitle, TextColor = 0x000088) - self.xImport = self._addWidget('import_button', 'Button', self.xDialog.Width-90, nY0, 40, 12, Label = self.dUI.get('import_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000055) - self.xExport = self._addWidget('export_button', 'Button', self.xDialog.Width-45, nY0, 40, 12, Label = self.dUI.get('export_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000055) + self.xImport = self._addWidget('import_button', 'Button', self.xDialog.Width-90, nY0, 40, 12, Label = ui.get('import_button'), FontDescriptor = xFDSubTitle, TextColor = 0x000055) + self.xExport = self._addWidget('export_button', 'Button', self.xDialog.Width-45, nY0, 40, 12, Label = ui.get('export_button'), FontDescriptor = xFDSubTitle, TextColor = 0x000055) #### Add word - self._addWidget("add_section", 'FixedLine', nX1, nY1, 170, nHeight, Label = self.dUI.get("add_section", "#err"), FontDescriptor = xFDTitle) + self._addWidget("add_section", 'FixedLine', nX1, nY1, 170, nHeight, Label = ui.get("add_section"), FontDescriptor = xFDTitle) self.xLemma = self._addWidget('lemma', 'Edit', nX1, nY1+10, 100, 14, Text = sWord, FontDescriptor = xFDTitle) - self._addWidget('search_button', 'Button', nX1+105, nY1+11, 45, 12, Label = self.dUI.get('search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x555500) - self._addWidget('information_button', 'Button', nX1+155, nY1+11, 15, 12, Label = self.dUI.get('information_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x555500) + self._addWidget('search_button', 'Button', nX1+105, nY1+11, 45, 12, Label = ui.get('search_button'), FontDescriptor = xFDSubTitle, TextColor = 0x555500) + self._addWidget('information_button', 'Button', nX1+155, nY1+11, 15, 12, Label = ui.get('information_button'), FontDescriptor = xFDSubTitle, TextColor = 0x555500) # Radio buttons: main POS tag # Note: the only way to group RadioButtons is to create them successively - self.xNA = self._addWidget('nom_adj', 'RadioButton', nX1, nY2+12, 60, nHeight, Label = self.dUI.get("nom_adj", "#err"), HelpText = ":N:A") - self.xN = self._addWidget('nom', 'RadioButton', nX1, nY2+22, 60, nHeight, Label = self.dUI.get("nom", "#err"), HelpText = ":N") - self.xA = self._addWidget('adj', 'RadioButton', nX1, nY2+32, 60, nHeight, Label = self.dUI.get("adj", "#err"), HelpText = ":A") - self.xM1 = self._addWidget('M1', 'RadioButton', nX1, nY3+12, 60, nHeight, Label = self.dUI.get("M1", "#err"), HelpText = ":M1") - self.xM2 = self._addWidget('M2', 'RadioButton', nX1, nY3+22, 60, nHeight, Label = self.dUI.get("M2", "#err"), HelpText = ":M2") - self.xMP = self._addWidget('MP', 'RadioButton', nX1, nY3+32, 60, nHeight, Label = self.dUI.get("MP", "#err"), HelpText = ":MP") - self.xV = self._addWidget('verb', 'RadioButton', nX1, nY4+2, 35, nHeight, Label = self.dUI.get("verb", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":V") - self.xW = self._addWidget('adv', 'RadioButton', nX1, nY5+2, 35, nHeight, Label = self.dUI.get("adverb", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":W") - self.xX = self._addWidget('other', 'RadioButton', nX1, nY6+2, 35, nHeight, Label = self.dUI.get("other", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":X") + self.xNA = self._addWidget('nom_adj', 'RadioButton', nX1, nY2+12, 60, nHeight, Label = ui.get("nom_adj"), HelpText = ":N:A") + self.xN = self._addWidget('nom', 'RadioButton', nX1, nY2+22, 60, nHeight, Label = ui.get("nom"), HelpText = ":N") + self.xA = self._addWidget('adj', 'RadioButton', nX1, nY2+32, 60, nHeight, Label = ui.get("adj"), HelpText = ":A") + self.xM1 = self._addWidget('M1', 'RadioButton', nX1, nY3+12, 60, nHeight, Label = ui.get("M1"), HelpText = ":M1") + self.xM2 = self._addWidget('M2', 'RadioButton', nX1, nY3+22, 60, nHeight, Label = ui.get("M2"), HelpText = ":M2") + self.xMP = self._addWidget('MP', 'RadioButton', nX1, nY3+32, 60, nHeight, Label = ui.get("MP"), HelpText = ":MP") + self.xV = self._addWidget('verb', 'RadioButton', nX1, nY4+2, 35, nHeight, Label = ui.get("verb"), FontDescriptor = xFDSubTitle, HelpText = ":V") + self.xW = self._addWidget('adv', 'RadioButton', nX1, nY5+2, 35, nHeight, Label = ui.get("adverb"), FontDescriptor = xFDSubTitle, HelpText = ":W") + self.xX = self._addWidget('other', 'RadioButton', nX1, nY6+2, 35, nHeight, Label = ui.get("other"), FontDescriptor = xFDSubTitle, HelpText = ":X") # Nom, adjectif - self._addWidget("fl_nom_adj", 'FixedLine', nX1, nY2, 170, nHeight, Label = self.dUI.get("common_name", "#err"), FontDescriptor = xFDSubTitle) - self.xSepi = self._addWidget('Sepi', 'RadioButton', nX1+65, nY2+12, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e") - self.xSmas = self._addWidget('Smas', 'RadioButton', nX1+65, nY2+22, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m") - self.xSfem = self._addWidget('Sfem', 'RadioButton', nX1+65, nY2+32, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f") + self._addWidget("fl_nom_adj", 'FixedLine', nX1, nY2, 170, nHeight, Label = ui.get("common_name"), FontDescriptor = xFDSubTitle) + self.xSepi = self._addWidget('Sepi', 'RadioButton', nX1+65, nY2+12, 50, nHeight, Label = ui.get("epi"), HelpText = ":e") + self.xSmas = self._addWidget('Smas', 'RadioButton', nX1+65, nY2+22, 50, nHeight, Label = ui.get("mas"), HelpText = ":m") + self.xSfem = self._addWidget('Sfem', 'RadioButton', nX1+65, nY2+32, 50, nHeight, Label = ui.get("fem"), HelpText = ":f") self._addWidget("fl_sep1", 'FixedLine', nX1, nY2, 1, nHeight) - self.xSs = self._addWidget('Ss', 'RadioButton', nX1+115, nY2+12, 50, nHeight, Label = self.dUI.get("-s", "#err"), HelpText = "·s") - self.xSx = self._addWidget('Sx', 'RadioButton', nX1+115, nY2+22, 50, nHeight, Label = self.dUI.get("-x", "#err"), HelpText = "·x") - self.xSinv = self._addWidget('Sinv', 'RadioButton', nX1+115, nY2+32, 50, nHeight, Label = self.dUI.get("inv", "#err"), HelpText = ":i") + self.xSs = self._addWidget('Ss', 'RadioButton', nX1+115, nY2+12, 50, nHeight, Label = ui.get("-s"), HelpText = "·s") + self.xSx = self._addWidget('Sx', 'RadioButton', nX1+115, nY2+22, 50, nHeight, Label = ui.get("-x"), HelpText = "·x") + self.xSinv = self._addWidget('Sinv', 'RadioButton', nX1+115, nY2+32, 50, nHeight, Label = ui.get("inv"), HelpText = ":i") - self._addWidget("alt_lemma_label", 'FixedLine', nX1+10, nY2+42, 160, nHeight, Label = self.dUI.get("alt_lemma", "#err")) + self._addWidget("alt_lemma_label", 'FixedLine', nX1+10, nY2+42, 160, nHeight, Label = ui.get("alt_lemma")) self.xAltLemma = self._addWidget('alt_lemma', 'Edit', nX1+10, nY2+52, 110, nHeight) - self.xNA2 = self._addWidget('nom_adj2', 'RadioButton', nX1+10, nY2+65, 60, nHeight, Label = self.dUI.get("nom_adj", "#err"), HelpText = ":N:A") - self.xN2 = self._addWidget('nom2', 'RadioButton', nX1+10, nY2+75, 60, nHeight, Label = self.dUI.get("nom", "#err"), HelpText = ":N") - self.xA2 = self._addWidget('adj2', 'RadioButton', nX1+10, nY2+85, 60, nHeight, Label = self.dUI.get("adj", "#err"), HelpText = ":A") + self.xNA2 = self._addWidget('nom_adj2', 'RadioButton', nX1+10, nY2+65, 60, nHeight, Label = ui.get("nom_adj"), HelpText = ":N:A") + self.xN2 = self._addWidget('nom2', 'RadioButton', nX1+10, nY2+75, 60, nHeight, Label = ui.get("nom"), HelpText = ":N") + self.xA2 = self._addWidget('adj2', 'RadioButton', nX1+10, nY2+85, 60, nHeight, Label = ui.get("adj"), HelpText = ":A") self._addWidget("fl_sep2", 'FixedLine', nX1, nY2, 1, nHeight) - self.xSepi2 = self._addWidget('Sepi2', 'RadioButton', nX1+70, nY2+65, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e") - self.xSmas2 = self._addWidget('Smas2', 'RadioButton', nX1+70, nY2+75, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m") - self.xSfem2 = self._addWidget('Sfem2', 'RadioButton', nX1+70, nY2+85, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f") + self.xSepi2 = self._addWidget('Sepi2', 'RadioButton', nX1+70, nY2+65, 50, nHeight, Label = ui.get("epi"), HelpText = ":e") + self.xSmas2 = self._addWidget('Smas2', 'RadioButton', nX1+70, nY2+75, 50, nHeight, Label = ui.get("mas"), HelpText = ":m") + self.xSfem2 = self._addWidget('Sfem2', 'RadioButton', nX1+70, nY2+85, 50, nHeight, Label = ui.get("fem"), HelpText = ":f") self._addWidget("fl_sep3", 'FixedLine', nX1, nY2, 1, nHeight) - self.xSs2 = self._addWidget('Ss2', 'RadioButton', nX1+120, nY2+65, 50, nHeight, Label = self.dUI.get("-s", "#err"), HelpText = "·s") - self.xSx2 = self._addWidget('Sx2', 'RadioButton', nX1+120, nY2+75, 50, nHeight, Label = self.dUI.get("-x", "#err"), HelpText = "·x") - self.xSinv2 = self._addWidget('Sinv2', 'RadioButton', nX1+120, nY2+85, 50, nHeight, Label = self.dUI.get("inv", "#err"), HelpText = ":i") + self.xSs2 = self._addWidget('Ss2', 'RadioButton', nX1+120, nY2+65, 50, nHeight, Label = ui.get("-s"), HelpText = "·s") + self.xSx2 = self._addWidget('Sx2', 'RadioButton', nX1+120, nY2+75, 50, nHeight, Label = ui.get("-x"), HelpText = "·x") + self.xSinv2 = self._addWidget('Sinv2', 'RadioButton', nX1+120, nY2+85, 50, nHeight, Label = ui.get("inv"), HelpText = ":i") # Nom propre - self._addWidget("fl_M", 'FixedLine', nX1, nY3, 170, nHeight, Label = self.dUI.get("proper_name", "#err"), FontDescriptor = xFDSubTitle) - self.xMepi = self._addWidget('Mepi', 'RadioButton', nX1+65, nY3+12, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e") - self.xMmas = self._addWidget('Mmas', 'RadioButton', nX1+65, nY3+22, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m") - self.xMfem = self._addWidget('Mfem', 'RadioButton', nX1+65, nY3+32, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f") + self._addWidget("fl_M", 'FixedLine', nX1, nY3, 170, nHeight, Label = ui.get("proper_name"), FontDescriptor = xFDSubTitle) + self.xMepi = self._addWidget('Mepi', 'RadioButton', nX1+65, nY3+12, 50, nHeight, Label = ui.get("epi"), HelpText = ":e") + self.xMmas = self._addWidget('Mmas', 'RadioButton', nX1+65, nY3+22, 50, nHeight, Label = ui.get("mas"), HelpText = ":m") + self.xMfem = self._addWidget('Mfem', 'RadioButton', nX1+65, nY3+32, 50, nHeight, Label = ui.get("fem"), HelpText = ":f") # Verbe self._addWidget("fl_verb", 'FixedLine', nX2+30, nY4, 130, nHeight, FontDescriptor = xFDSubTitle) - self.xV_i = self._addWidget('v_i', 'CheckBox', nX2, nY4+12, 60, nHeight, Label = self.dUI.get("v_i", "#err")) - self.xV_t = self._addWidget('v_t', 'CheckBox', nX2, nY4+20, 60, nHeight, Label = self.dUI.get("v_t", "#err")) - self.xV_n = self._addWidget('v_n', 'CheckBox', nX2, nY4+28, 60, nHeight, Label = self.dUI.get("v_n", "#err")) - self.xV_p = self._addWidget('v_p', 'CheckBox', nX2, nY4+36, 60, nHeight, Label = self.dUI.get("v_p", "#err")) - self.xV_m = self._addWidget('v_m', 'CheckBox', nX2, nY4+44, 60, nHeight, Label = self.dUI.get("v_m", "#err")) - - self._addWidget('aux', 'FixedText', nX2+75, nY4+10, 90, nHeight, Label = self.dUI.get("aux", "#err")) - self.xV_ae = self._addWidget('v_ae', 'CheckBox', nX2+75, nY4+20, 90, nHeight, Label = self.dUI.get("v_ae", "#err")) - self.xV_aa = self._addWidget('v_aa', 'CheckBox', nX2+75, nY4+28, 90, nHeight, Label = self.dUI.get("v_aa", "#err")) - - self.xV_pp = self._addWidget('v_pp', 'CheckBox', nX2+75, nY4+44, 90, nHeight, Label = self.dUI.get("v_pp", "#err")) - - self._addWidget('v_pattern_label', 'FixedText', nX2, nY4+56, 75, nHeight, Label = self.dUI.get('v_pattern', "#err"), Align = 2) + self.xV_i = self._addWidget('v_i', 'CheckBox', nX2, nY4+12, 60, nHeight, Label = ui.get("v_i")) + self.xV_t = self._addWidget('v_t', 'CheckBox', nX2, nY4+20, 60, nHeight, Label = ui.get("v_t")) + self.xV_n = self._addWidget('v_n', 'CheckBox', nX2, nY4+28, 60, nHeight, Label = ui.get("v_n")) + self.xV_p = self._addWidget('v_p', 'CheckBox', nX2, nY4+36, 60, nHeight, Label = ui.get("v_p")) + self.xV_m = self._addWidget('v_m', 'CheckBox', nX2, nY4+44, 60, nHeight, Label = ui.get("v_m")) + + self._addWidget('aux', 'FixedText', nX2+75, nY4+10, 90, nHeight, Label = ui.get("aux")) + self.xV_ae = self._addWidget('v_ae', 'CheckBox', nX2+75, nY4+20, 90, nHeight, Label = ui.get("v_ae")) + self.xV_aa = self._addWidget('v_aa', 'CheckBox', nX2+75, nY4+28, 90, nHeight, Label = ui.get("v_aa")) + + self.xV_pp = self._addWidget('v_pp', 'CheckBox', nX2+75, nY4+44, 90, nHeight, Label = ui.get("v_pp")) + + self._addWidget('v_pattern_label', 'FixedText', nX2, nY4+56, 75, nHeight, Label = ui.get('v_pattern'), Align = 2) self.xVpattern = self._addWidget('v_pattern', 'Edit', nX2+80, nY4+56, 80, nHeight) # Adverbe self._addWidget("fl_adv", 'FixedLine', nX2+30, nY5, 130, nHeight, FontDescriptor = xFDSubTitle) # Autre self._addWidget("fl_other", 'FixedLine', nX2+30, nY6, 130, nHeight, FontDescriptor = xFDSubTitle) - self._addWidget('flexion_label', 'FixedText', nX2, nY6+11, 22, nHeight, Label = self.dUI.get('flexion', "#err"), Align = 2) + self._addWidget('flexion_label', 'FixedText', nX2, nY6+11, 22, nHeight, Label = ui.get('flexion'), Align = 2) self.xFlexion = self._addWidget('flexion', 'Edit', nX2+25, nY6+10, 50, nHeight) - self._addWidget('tags_label', 'FixedText', nX2+80, nY6+11, 27, nHeight, Label = self.dUI.get('tags', "#err"), Align = 2) + self._addWidget('tags_label', 'FixedText', nX2+80, nY6+11, 27, nHeight, Label = ui.get('tags'), Align = 2) self.xTags = self._addWidget('tags', 'Edit', nX2+110, nY6+10, 50, nHeight) #### Generated words - self._addWidget("gwords_section", 'FixedLine', nXB, nY1, 160, nHeight, Label = self.dUI.get("new_section", "#err"), FontDescriptor = xFDTitle) + self._addWidget("gwords_section", 'FixedLine', nXB, nY1, 160, nHeight, Label = ui.get("new_section"), FontDescriptor = xFDTitle) self.xGridModelNew = self._addGrid("list_grid_gwords", nXB, nY1+10, 160, 240, [ - {"Title": self.dUI.get("lex_flex", "#err"), "ColumnWidth": 80}, - {"Title": self.dUI.get("lex_tags", "#err"), "ColumnWidth": 80} + {"Title": ui.get("lex_flex"), "ColumnWidth": 80}, + {"Title": ui.get("lex_tags"), "ColumnWidth": 80} ], SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI")) - self.xAdd = self._addWidget('add_button', 'Button', nXB, nY1+255, 75, 12, Label = self.dUI.get('add_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500, Enabled = False) - self.xDelete = self._addWidget('delete_button', 'Button', nXB+80, nY1+255, 80, 12, Label = self.dUI.get('delete_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x550000) + self.xAdd = self._addWidget('add_button', 'Button', nXB, nY1+255, 75, 12, Label = ui.get('add_button'), FontDescriptor = xFDSubTitle, TextColor = 0x005500, Enabled = False) + self.xDelete = self._addWidget('delete_button', 'Button', nXB+80, nY1+255, 80, 12, Label = ui.get('delete_button'), FontDescriptor = xFDSubTitle, TextColor = 0x550000) #### Lexicon section - self._addWidget("lexicon_section", 'FixedLine', nXC, nY1, 200, nHeight, Label = self.dUI.get("lexicon_section", "#err"), FontDescriptor = xFDTitle) + self._addWidget("lexicon_section", 'FixedLine', nXC, nY1, 200, nHeight, Label = ui.get("lexicon_section"), FontDescriptor = xFDTitle) self.xGridModelLex = self._addGrid("list_grid_lexicon", nXC, nY1+10, 200, 240, [ - {"Title": self.dUI.get("lex_flex", "#err"), "ColumnWidth": 65}, - {"Title": self.dUI.get("lex_lemma", "#err"), "ColumnWidth": 50}, - {"Title": self.dUI.get("lex_tags", "#err"), "ColumnWidth": 65} + {"Title": ui.get("lex_flex"), "ColumnWidth": 65}, + {"Title": ui.get("lex_lemma"), "ColumnWidth": 50}, + {"Title": ui.get("lex_tags"), "ColumnWidth": 65} ], SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI")) - self._addWidget("num_of_entries_label1", 'FixedText', nXC, nY1+257, 60, nHeight, Label = self.dUI.get("num_of_entries_label", "#err"), FontDescriptor = xFDSubTitle) + self._addWidget("num_of_entries_label1", 'FixedText', nXC, nY1+257, 60, nHeight, Label = ui.get("num_of_entries_label"), FontDescriptor = xFDSubTitle) self.xNumLex = self._addWidget("num_of_entries1", 'FixedText', nXC+65, nY1+257, 40, nHeight, Label = "0", FontDescriptor = xFDSubTitle) - self.xSave = self._addWidget('save_button', 'Button', nXC+110, nY1+255, 45, 12, Label = self.dUI.get('save_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500) - self._addWidget('close_button', 'Button', nXC+160, nY1+255, 40, 12, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x550000) + self.xSave = self._addWidget('save_button', 'Button', nXC+110, nY1+255, 45, 12, Label = ui.get('save_button'), FontDescriptor = xFDSubTitle, TextColor = 0x005500) + self._addWidget('close_button', 'Button', nXC+160, nY1+255, 40, 12, Label = ui.get('close_button'), FontDescriptor = xFDSubTitle, TextColor = 0x550000) self.loadLexicon() # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) @@ -392,17 +392,17 @@ xGridDataModel.addRow(i, aEntry) self.xNumLex.Label = str(i) self.xNumDic.Label = str(i) self.xDateDic.Label = oIBDAWG.sDate except: - sMessage = self.dUI.get('not_loaded', "#err") + sMessage = ui.get('not_loaded') sMessage += traceback.format_exc() - MessageBox(self.xDocument, sMessage, self.dUI.get('load_title', "#err"), ERRORBOX) + MessageBox(self.xDocument, sMessage, ui.get('load_title'), ERRORBOX) else: self.xNumLex.Label = 0 self.xNumDic.Label = 0 - self.xDateDic.Label = self.dUI.get("void", "#err") + self.xDateDic.Label = ui.get("void") @_waitPointer def importDictionary (self): spfImported = "" try: @@ -427,19 +427,19 @@ with open(spfImported, "r", encoding="utf-8") as hDst: sJSON = hDst.read() try: sTest = json.loads(sJSON) except: - sMessage = self.dUI.get('wrong_json', "#err_msg: %s") % spfImported - MessageBox(self.xDocument, sMessage, self.dUI.get('import_title', "#err"), ERRORBOX) + sMessage = ui.get('wrong_json', "#err_msg: %s") % spfImported + MessageBox(self.xDocument, sMessage, ui.get('import_title'), ERRORBOX) else: self.xOptionNode.setPropertyValue("personal_dic", sJSON) self.xSettingNode.commitChanges() self.loadLexicon() else: - sMessage = self.dUI.get('file_not_found', "#err_msg: %s") % spfImported - MessageBox(self.xDocument, sMessage, self.dUI.get('import_title', "#err"), ERRORBOX) + sMessage = ui.get('file_not_found', "#err_msg: %s") % spfImported + MessageBox(self.xDocument, sMessage, ui.get('import_title'), ERRORBOX) @_waitPointer def saveLexicon (self): xGridDataModel = self.xGridModelLex.GridDataModel lEntry = [] @@ -454,12 +454,12 @@ self.xDateDic.Label = self.oPersonalDicJSON["sDate"] else: self.xOptionNode.setPropertyValue("personal_dic", "") self.xSettingNode.commitChanges() self.xNumDic.Label = "0" - self.xDateDic.Label = self.dUI.get("void", "#err") - MessageBox(self.xDocument, self.dUI.get('save_message', "#err"), self.dUI.get('save_title', "#err")) + self.xDateDic.Label = ui.get("void") + MessageBox(self.xDocument, ui.get('save_message'), ui.get('save_title')) def exportDictionary (self): try: xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.FilePicker', self.ctx) # other possibility: com.sun.star.ui.dialogs.SystemFilePicker xFilePicker.initialize([uno.getConstantByName("com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_SIMPLE")]) # seems useless @@ -477,17 +477,17 @@ #spfExported = os.path.join(os.path.expanduser("~"), "fr.personal.json") sJSON = self.xOptionNode.getPropertyValue("personal_dic") if sJSON: with open(spfExported, "w", encoding="utf-8") as hDst: hDst.write(sJSON) - sMessage = self.dUI.get('export_message', "#err_msg: %s") % spfExported + sMessage = ui.get('export_message', "#err_msg: %s") % spfExported else: - sMessage = self.dUI.get('empty_dictionary', "#err") - MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err")) + sMessage = ui.get('empty_dictionary') + MessageBox(self.xDocument, sMessage, ui.get('export_title')) except: sMessage = traceback.format_exc() - MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"), ERRORBOX) + MessageBox(self.xDocument, sMessage, ui.get('export_title'), ERRORBOX) def _getRadioValue (self, *args): for x in args: if x.State: return x.HelpText Index: gc_lang/fr/oxt/DictOptions/SearchWords.py ================================================================== --- gc_lang/fr/oxt/DictOptions/SearchWords.py +++ gc_lang/fr/oxt/DictOptions/SearchWords.py @@ -6,11 +6,11 @@ import uno import traceback import re import helpers -import sw_strings +import sw_strings as ui import grammalecte.graphspell as sc import grammalecte.graphspell.ibdawg as ibdawg from com.sun.star.task import XJobExecutor from com.sun.star.awt import XActionListener @@ -96,18 +96,18 @@ self.xDialog.insertByName(name, xGridModel) return xGridModel def run (self, sLang, oPersonalDicJSON): # ui lang - self.dUI = sw_strings.getUI(sLang) + ui.selectLang(sLang) self.oPersonalDicJSON = oPersonalDicJSON # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 350 self.xDialog.Height = 305 - self.xDialog.Title = self.dUI.get('title', "#title#") + self.xDialog.Title = ui.get('title') #xWindowSize = helpers.getWindowSize() #self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) #self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) # fonts @@ -130,33 +130,33 @@ nY2 = nY1 + 60 nHeight = 10 #### Search - self._addWidget("search_section", 'FixedLine', nX1, nY0, 120, nHeight, Label = self.dUI.get("search_section", "#err"), FontDescriptor = xFDTitle) - self._addWidget("similar_search_section", 'FixedLine', nX1, nY1, 120, nHeight, Label = self.dUI.get("similar_search_section", "#err"), FontDescriptor = xFDSubTitle) + self._addWidget("search_section", 'FixedLine', nX1, nY0, 120, nHeight, Label = ui.get("search_section"), FontDescriptor = xFDTitle) + self._addWidget("similar_search_section", 'FixedLine', nX1, nY1, 120, nHeight, Label = ui.get("similar_search_section"), FontDescriptor = xFDSubTitle) self.xWord = self._addWidget('word', 'Edit', nX1, nY1+10, 100, nHeight) - self._addWidget('similar_search_button', 'Button', nX1, nY1+22, 55, 12, Label = self.dUI.get('similar_search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500) + self._addWidget('similar_search_button', 'Button', nX1, nY1+22, 55, 12, Label = ui.get('similar_search_button'), FontDescriptor = xFDSubTitle, TextColor = 0x005500) - self._addWidget("regex_search_section", 'FixedLine', nX1, nY2, 120, nHeight, Label = self.dUI.get("regex_search_section", "#err"), FontDescriptor = xFDSubTitle) - self._addWidget('flexion_label', 'FixedText', nX1, nY2+10, 30, nHeight, Label = self.dUI.get('flexion', "#err")) + self._addWidget("regex_search_section", 'FixedLine', nX1, nY2, 120, nHeight, Label = ui.get("regex_search_section"), FontDescriptor = xFDSubTitle) + self._addWidget('flexion_label', 'FixedText', nX1, nY2+10, 30, nHeight, Label = ui.get('flexion')) self.xFlexion = self._addWidget('flexion', 'Edit', nX1+35, nY2+10, 85, nHeight) - self._addWidget('tags_label', 'FixedText', nX1, nY2+22, 30, nHeight, Label = self.dUI.get('tags', "#err")) + self._addWidget('tags_label', 'FixedText', nX1, nY2+22, 30, nHeight, Label = ui.get('tags')) self.xTags = self._addWidget('tags', 'Edit', nX1+35, nY2+22, 85, nHeight) - self._addWidget('regex_search_button', 'Button', nX1, nY2+34, 55, 12, Label = self.dUI.get('regex_search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500) - self._addWidget('result_warning', 'FixedText', nX1, nY2+50, 120, nHeight*7, Label = self.dUI.get('result_warning', '#err'), MultiLine = True) + self._addWidget('regex_search_button', 'Button', nX1, nY2+34, 55, 12, Label = ui.get('regex_search_button'), FontDescriptor = xFDSubTitle, TextColor = 0x005500) + self._addWidget('result_warning', 'FixedText', nX1, nY2+50, 120, nHeight*7, Label = ui.get('result_warning'), MultiLine = True) #### Results - self._addWidget("result_section", 'FixedLine', nX2, nY0, 200, nHeight, Label = self.dUI.get("result_section", "#err"), FontDescriptor = xFDTitle) + self._addWidget("result_section", 'FixedLine', nX2, nY0, 200, nHeight, Label = ui.get("result_section"), FontDescriptor = xFDTitle) self.xGridModel = self._addGrid("list_grid_search", nX2, nY0+10, 200, 265, [ - {"Title": self.dUI.get("res_flexion", "#err"), "ColumnWidth": 70}, - {"Title": self.dUI.get("res_lemma", "#err"), "ColumnWidth": 60}, - {"Title": self.dUI.get("res_tags", "#err"), "ColumnWidth": 70} + {"Title": ui.get("res_flexion"), "ColumnWidth": 70}, + {"Title": ui.get("res_lemma"), "ColumnWidth": 60}, + {"Title": ui.get("res_tags"), "ColumnWidth": 70} ]) - self._addWidget('close_button', 'Button', self.xDialog.Width-50, self.xDialog.Height-20, 40, 12, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x550000) + self._addWidget('close_button', 'Button', self.xDialog.Width-50, self.xDialog.Height-20, 40, 12, Label = ui.get('close_button'), FontDescriptor = xFDSubTitle, TextColor = 0x550000) # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) self.xContainer.setModel(self.xDialog) self.xGridControlSearch = self.xContainer.getControl('list_grid_search') @@ -193,11 +193,11 @@ self.initSpellChecker() sWord = self.xWord.Text.strip() if sWord: xGridDataModel = self.xGridModel.GridDataModel xGridDataModel.removeAllRows() - lResult = self.oSpellChecker.getSimilarEntries(sWord, 20); + lResult = self.oSpellChecker.getSimilarEntries(sWord, 20) for i, aEntry in enumerate(lResult): xGridDataModel.addRow(i, aEntry) @_waitPointer def searchRegex (self): @@ -206,20 +206,20 @@ sTagsPattern = self.xTags.Text.strip() try: if sFlexPattern: re.compile(sFlexPattern) except: - MessageBox(self.xDocument, self.dUI.get("regex_error_flexion", "#err"), self.dUI.get("error", "#err"), nBoxType=ERRORBOX) + MessageBox(self.xDocument, ui.get("regex_error_flexion"), ui.get("error"), nBoxType=ERRORBOX) sFlexPattern = "" try: if sTagsPattern: re.compile(sTagsPattern) except: - MessageBox(self.xDocument, self.dUI.get("regex_error_tags", "#err"), self.dUI.get("error", "#err"), nBoxType=ERRORBOX) + MessageBox(self.xDocument, ui.get("regex_error_tags"), ui.get("error"), nBoxType=ERRORBOX) sTagsPattern = "" xGridDataModel = self.xGridModel.GridDataModel xGridDataModel.removeAllRows() for i, aEntry in enumerate(self.oSpellChecker.select(sFlexPattern, sTagsPattern)): xGridDataModel.addRow(i, aEntry) i += 1 if i >= 2000: break Index: gc_lang/fr/oxt/DictOptions/TagsInfo.py ================================================================== --- gc_lang/fr/oxt/DictOptions/TagsInfo.py +++ gc_lang/fr/oxt/DictOptions/TagsInfo.py @@ -5,11 +5,11 @@ import unohelper import uno import traceback import helpers -import ti_strings +import ti_strings as ui import grammalecte.graphspell.lexgraph_fr as lxg from com.sun.star.task import XJobExecutor from com.sun.star.awt import XActionListener @@ -56,17 +56,17 @@ self.xDialog.insertByName(name, xGridModel) return xGridModel def run (self, sLang): # ui lang - self.dUI = ti_strings.getUI(sLang) + ui.selectLang(sLang) # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 360 self.xDialog.Height = 305 - self.xDialog.Title = self.dUI.get('title', "#title#") + self.xDialog.Title = ui.get('title') #xWindowSize = helpers.getWindowSize() #self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) #self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) # fonts @@ -94,32 +94,32 @@ nXB = nX1 + 110 nHeight = 10 #### Add word - self._addWidget("add_section", 'FixedLine', nX1, nY0, 100, nHeight, Label = self.dUI.get("information_section", "#err"), FontDescriptor = xFDTitle) - - self._addWidget('save_label', 'FixedText', nX1, nY1, 100, nHeight, Label = self.dUI.get('save', "#err"), FontDescriptor = xFDTitle) - self._addWidget('save_desc_label', 'FixedText', nX1, nY1+10, 100, nHeight*5, Label = self.dUI.get('save_desc', "#err"), MultiLine=True) - - self._addWidget('duplicates_label', 'FixedText', nX1, nY2, 100, nHeight, Label = self.dUI.get('duplicates', "#err"), FontDescriptor = xFDTitle) - self._addWidget('duplicates_desc_label', 'FixedText', nX1, nY2+10, 100, nHeight*5, Label = self.dUI.get('duplicates_desc', "#err"), MultiLine=True) - - self._addWidget('compilation_label', 'FixedText', nX1, nY3, 100, nHeight, Label = self.dUI.get('compilation', "#err"), FontDescriptor = xFDTitle) - self._addWidget('compilation_desc_label', 'FixedText', nX1, nY3+10, 100, nHeight*7, Label = self.dUI.get('compilation_desc', "#err"), MultiLine=True) - - self._addWidget('warning_label', 'FixedText', nX1, nY4, 100, nHeight, Label = self.dUI.get('warning', "#err"), FontDescriptor = xFDTitle) - self._addWidget('warning_desc_label', 'FixedText', nX1, nY4+10, 100, nHeight*7, Label = self.dUI.get('warning_desc', "#err"), MultiLine=True) + self._addWidget("add_section", 'FixedLine', nX1, nY0, 100, nHeight, Label = ui.get("information_section"), FontDescriptor = xFDTitle) + + self._addWidget('save_label', 'FixedText', nX1, nY1, 100, nHeight, Label = ui.get('save'), FontDescriptor = xFDTitle) + self._addWidget('save_desc_label', 'FixedText', nX1, nY1+10, 100, nHeight*5, Label = ui.get('save_desc'), MultiLine=True) + + self._addWidget('duplicates_label', 'FixedText', nX1, nY2, 100, nHeight, Label = ui.get('duplicates'), FontDescriptor = xFDTitle) + self._addWidget('duplicates_desc_label', 'FixedText', nX1, nY2+10, 100, nHeight*5, Label = ui.get('duplicates_desc'), MultiLine=True) + + self._addWidget('compilation_label', 'FixedText', nX1, nY3, 100, nHeight, Label = ui.get('compilation'), FontDescriptor = xFDTitle) + self._addWidget('compilation_desc_label', 'FixedText', nX1, nY3+10, 100, nHeight*7, Label = ui.get('compilation_desc'), MultiLine=True) + + self._addWidget('warning_label', 'FixedText', nX1, nY4, 100, nHeight, Label = ui.get('warning'), FontDescriptor = xFDTitle) + self._addWidget('warning_desc_label', 'FixedText', nX1, nY4+10, 100, nHeight*7, Label = ui.get('warning_desc'), MultiLine=True) #### Tags - self._addWidget("tags_section", 'FixedLine', nXB, nY0, 230, nHeight, Label = self.dUI.get("tags_section", "#err"), FontDescriptor = xFDTitle) + self._addWidget("tags_section", 'FixedLine', nXB, nY0, 230, nHeight, Label = ui.get("tags_section"), FontDescriptor = xFDTitle) self.xGridModel = self._addGrid("list_grid_tags", nXB, nY0+10, 230, 265, [ - {"Title": self.dUI.get("tags", "#err"), "ColumnWidth": 40}, - {"Title": self.dUI.get("meaning", "#err"), "ColumnWidth": 190} + {"Title": ui.get("tags"), "ColumnWidth": 40}, + {"Title": ui.get("meaning"), "ColumnWidth": 190} ]) - self._addWidget('close_button', 'Button', self.xDialog.Width-50, self.xDialog.Height-20, 40, 12, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x550000) + self._addWidget('close_button', 'Button', self.xDialog.Width-50, self.xDialog.Height-20, 40, 12, Label = ui.get('close_button'), FontDescriptor = xFDSubTitle, TextColor = 0x550000) self.loadData() # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) Index: gc_lang/fr/oxt/DictOptions/do_strings.py ================================================================== --- gc_lang/fr/oxt/DictOptions/do_strings.py +++ gc_lang/fr/oxt/DictOptions/do_strings.py @@ -1,9 +1,23 @@ -def getUI (sLang): +# Strings for Dictionary Options + + +sUI = "fr" + + +def selectLang (sLang): + global sUI if sLang in dStrings: - return dStrings[sLang] - return dStrings["fr"] + sUI = sLang + + +def get (sMsgCode): + try: + return dStrings[sUI].get(sMsgCode, sMsgCode) + except: + return "#error" + dStrings = { "fr": { "title": "Grammalecte · Options orthographiques", Index: gc_lang/fr/oxt/DictOptions/lxe_strings.py ================================================================== --- gc_lang/fr/oxt/DictOptions/lxe_strings.py +++ gc_lang/fr/oxt/DictOptions/lxe_strings.py @@ -1,9 +1,23 @@ -def getUI (sLang): +# Strings for Lexicon Editor + + +sUI = "fr" + + +def selectLang (sLang): + global sUI if sLang in dStrings: - return dStrings[sLang] - return dStrings["fr"] + sUI = sLang + + +def get (sMsgCode): + try: + return dStrings[sUI].get(sMsgCode, sMsgCode) + except: + return "#error" + dStrings = { "fr": { "title": "Grammalecte · Éditeur lexical", Index: gc_lang/fr/oxt/DictOptions/sw_strings.py ================================================================== --- gc_lang/fr/oxt/DictOptions/sw_strings.py +++ gc_lang/fr/oxt/DictOptions/sw_strings.py @@ -1,9 +1,23 @@ -def getUI (sLang): +# Strings for Search Word + + +sUI = "fr" + + +def selectLang (sLang): + global sUI if sLang in dStrings: - return dStrings[sLang] - return dStrings["fr"] + sUI = sLang + + +def get (sMsgCode): + try: + return dStrings[sUI].get(sMsgCode, sMsgCode) + except: + return "#error" + dStrings = { "fr": { "title": "Grammalecte · Recherche et informations", @@ -20,21 +34,21 @@ "result_section": "Résultats", "res_flexion": "Flexions", "res_lemma": "Lemmes", "res_tags": "Étiquettes", - + "close_button": "Fermer", "error": "Erreur", "regex_error_flexion": "L’expression régulière du champ ‹Flexion› est erronée.", "regex_error_tags": "L’expression régulière du champ ‹Étiquettes› est erronée." }, "en": { "title": "Grammalecte · Search and informations", - + "search_section": "Search", "similar_search_section": "Similar words", "similar_search_button": "Search", @@ -46,13 +60,13 @@ "result_section": "Results", "res_flexion": "Flexions", "res_lemma": "Lemmas", "res_tags": "Tags", - + "close_button": "Close", "error": "Error", "regex_error_flexion": "The regular expression in field ‹Flexion› is wrong.", "regex_error_tags": "The regular expression in field ‹Tags› is wrong." }, } Index: gc_lang/fr/oxt/DictOptions/ti_strings.py ================================================================== --- gc_lang/fr/oxt/DictOptions/ti_strings.py +++ gc_lang/fr/oxt/DictOptions/ti_strings.py @@ -1,9 +1,23 @@ -def getUI (sLang): +# Strings for Tags Info + + +sUI = "fr" + + +def selectLang (sLang): + global sUI if sLang in dStrings: - return dStrings[sLang] - return dStrings["fr"] + sUI = sLang + + +def get (sMsgCode): + try: + return dStrings[sUI].get(sMsgCode, sMsgCode) + except: + return "#error" + dStrings = { "fr": { "title": "Grammalecte · Informations", @@ -28,11 +42,11 @@ "close_button": "Fermer" }, "en": { "title": "Grammalecte · Informations", - + "information_section": "Informations", "save": "Save", "save_desc": "Modifications to the lexicon are only saved in the dictionary when you click on ‹Save›.", Index: gc_lang/fr/oxt/GraphicOptions/GraphicOptions.py ================================================================== --- gc_lang/fr/oxt/GraphicOptions/GraphicOptions.py +++ gc_lang/fr/oxt/GraphicOptions/GraphicOptions.py @@ -6,11 +6,11 @@ import uno import re import traceback import helpers -import go_strings +import go_strings as ui from com.sun.star.task import XJobExecutor from com.sun.star.awt import XActionListener from com.sun.star.beans import PropertyValue @@ -34,21 +34,21 @@ setattr(xWidget, k, w) self.xDialog.insertByName(name, xWidget) return xWidget def run (self, sLang): - self.dUI = go_strings.getUI(sLang) + ui.selectLang(sLang) self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx) self.xDocument = self.xDesktop.getCurrentComponent() self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True) # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 200 self.xDialog.Height = 220 - self.xDialog.Title = self.dUI.get('title', "#title#") + self.xDialog.Title = ui.get('title') xWindowSize = helpers.getWindowSize() self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) # fonts @@ -71,30 +71,30 @@ nWidth = self.xDialog.Width - 20 nHeight = 10 # Info - self._addWidget("graphic_info", 'FixedText', nX, nY1, nWidth, nHeight*2, Label = self.dUI.get("graphic_info", "#err"), MultiLine = True, FontDescriptor = xFDSubTitle) - self._addWidget("spell_info", 'FixedText', nX, nY1+20, nWidth, nHeight*2, Label = self.dUI.get("spell_info", "#err"), MultiLine = True) + self._addWidget("graphic_info", 'FixedText', nX, nY1, nWidth, nHeight*2, Label = ui.get("graphic_info"), MultiLine = True, FontDescriptor = xFDSubTitle) + self._addWidget("spell_info", 'FixedText', nX, nY1+20, nWidth, nHeight*2, Label = ui.get("spell_info"), MultiLine = True) # Line type - self._addWidget('linetype_section', 'FixedLine', nX, nY2, nWidth, nHeight, Label = self.dUI.get('linetype_section', "#err"), FontDescriptor = xFDTitle) - self.xWaveLine = self._addWidget('wave_line', 'RadioButton', nX, nY2+15, nWidth, nHeight, Label = self.dUI.get('wave_line', "#err")) - self.xBoldWaveLine = self._addWidget('boldwave_line', 'RadioButton', nX, nY2+25, nWidth, nHeight, Label = self.dUI.get('boldwave_line', "#err")) - self.xBoldLine = self._addWidget('bold_line', 'RadioButton', nX, nY2+35, nWidth, nHeight, Label = self.dUI.get('bold_line', "#err")) + self._addWidget('linetype_section', 'FixedLine', nX, nY2, nWidth, nHeight, Label = ui.get('linetype_section'), FontDescriptor = xFDTitle) + self.xWaveLine = self._addWidget('wave_line', 'RadioButton', nX, nY2+15, nWidth, nHeight, Label = ui.get('wave_line')) + self.xBoldWaveLine = self._addWidget('boldwave_line', 'RadioButton', nX, nY2+25, nWidth, nHeight, Label = ui.get('boldwave_line')) + self.xBoldLine = self._addWidget('bold_line', 'RadioButton', nX, nY2+35, nWidth, nHeight, Label = ui.get('bold_line')) # Color - self._addWidget("color_section", 'FixedLine', nX, nY3, nWidth, nHeight, Label = self.dUI.get("color_section", "#err"), FontDescriptor = xFDTitle) - self.xMulticolor = self._addWidget('multicolor_line', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = self.dUI.get('multicolor_line', "#err")) - self._addWidget('multicolor_descr', 'FixedText', nX, nY3+25, nWidth, nHeight*4, Label = self.dUI.get('multicolor_descr', "#err"), MultiLine = True) + self._addWidget("color_section", 'FixedLine', nX, nY3, nWidth, nHeight, Label = ui.get("color_section"), FontDescriptor = xFDTitle) + self.xMulticolor = self._addWidget('multicolor_line', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = ui.get('multicolor_line')) + self._addWidget('multicolor_descr', 'FixedText', nX, nY3+25, nWidth, nHeight*4, Label = ui.get('multicolor_descr'), MultiLine = True) # Restart message - self._addWidget('restart', 'FixedText', nX, nY4, nWidth, nHeight*2, Label = self.dUI.get('restart', "#err"), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000) + self._addWidget('restart', 'FixedText', nX, nY4, nWidth, nHeight*2, Label = ui.get('restart'), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000) # Button - self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = self.dUI.get('apply_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500) - self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = self.dUI.get('cancel_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000) + self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = ui.get('apply_button'), FontDescriptor = xFDTitle, TextColor = 0x005500) + self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = ui.get('cancel_button'), FontDescriptor = xFDTitle, TextColor = 0x550000) self._loadOptions() # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) Index: gc_lang/fr/oxt/GraphicOptions/go_strings.py ================================================================== --- gc_lang/fr/oxt/GraphicOptions/go_strings.py +++ gc_lang/fr/oxt/GraphicOptions/go_strings.py @@ -1,9 +1,22 @@ -def getUI (sLang): +# strings for Graphic Options + +sUI = "fr" + + +def selectLang (sLang): + global sUI if sLang in dStrings: - return dStrings[sLang] - return dStrings["fr"] + sUI = sLang + + +def get (sMsgCode): + try: + return dStrings[sUI].get(sMsgCode, sMsgCode) + except: + return "#error" + dStrings = { "fr": { "title": "Grammalecte · Options graphiques", Index: gc_lang/fr/oxt/Lexicographer/Enumerator.py ================================================================== --- gc_lang/fr/oxt/Lexicographer/Enumerator.py +++ gc_lang/fr/oxt/Lexicographer/Enumerator.py @@ -6,11 +6,11 @@ import uno import traceback import platform import helpers -import enum_strings +import enum_strings as ui import grammalecte.graphspell as sc from com.sun.star.task import XJobExecutor from com.sun.star.awt import XActionListener from com.sun.star.awt import XTopWindowListener @@ -101,17 +101,17 @@ setattr(xGridModel, k, w) self.xDialog.insertByName(name, xGridModel) return xGridModel def run (self, sLang): - self.dUI = enum_strings.getUI(sLang) + ui.selectLang(sLang) # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 240 self.xDialog.Height = 280 - self.xDialog.Title = self.dUI.get('title', "#title#") + self.xDialog.Title = ui.get('title') xWindowSize = helpers.getWindowSize() self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) # fonts @@ -132,41 +132,41 @@ nWidth = self.xDialog.Width - 20 nHeight = 10 # List - self._addWidget("list_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = self.dUI.get("list_section", "#err"), FontDescriptor = xFDTitle) - self._addWidget('count_button', 'Button', nX, nY1+12, 70, 11, Label = self.dUI.get('count_button', "#err")) - self._addWidget('count2_button', 'Button', nX+75, nY1+12, 70, 11, Label = self.dUI.get('count2_button', "#err")) - self._addWidget('unknown_button', 'Button', nX+150, nY1+12, 70, 11, Label = self.dUI.get('unknown_button', "#err")) + self._addWidget("list_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = ui.get("list_section"), FontDescriptor = xFDTitle) + self._addWidget('count_button', 'Button', nX, nY1+12, 70, 11, Label = ui.get('count_button')) + self._addWidget('count2_button', 'Button', nX+75, nY1+12, 70, 11, Label = ui.get('count2_button')) + self._addWidget('unknown_button', 'Button', nX+150, nY1+12, 70, 11, Label = ui.get('unknown_button')) self.xGridModel = self._addGrid("list_grid", nX, nY1+25, nWidth, 181, \ - [ {"Title": self.dUI.get("words", "#err"), "ColumnWidth": 175}, {"Title": "Occurrences", "ColumnWidth": 45} ], \ + [ {"Title": ui.get("words"), "ColumnWidth": 175}, {"Title": "Occurrences", "ColumnWidth": 45} ], \ SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI") \ ) - self._addWidget('num_of_entries', 'FixedText', nX, nY1+210, 30, nHeight, Label = self.dUI.get('num_of_entries', "#err"), Align = 2) + self._addWidget('num_of_entries', 'FixedText', nX, nY1+210, 30, nHeight, Label = ui.get('num_of_entries'), Align = 2) self.xNumWord = self._addWidget('num_of_entries_res', 'FixedText', nX+35, nY1+210, 25, nHeight, Label = "—") - self._addWidget('tot_of_entries', 'FixedText', nX+60, nY1+210, 30, nHeight, Label = self.dUI.get('tot_of_entries', "#err"), Align = 2) + self._addWidget('tot_of_entries', 'FixedText', nX+60, nY1+210, 30, nHeight, Label = ui.get('tot_of_entries'), Align = 2) self.xTotWord = self._addWidget('tot_of_entries_res', 'FixedText', nX+95, nY1+210, 30, nHeight, Label = "—") - self.xSearch = self._addWidget('search_button', 'Button', nX+145, nY1+210, 30, nHeight, Label = ">>>", HelpText=self.dUI.get('goto', "#err"), Enabled = False) - self.xExport = self._addWidget('export_button', 'Button', nX+180, nY1+210, 40, nHeight, Label = self.dUI.get('export', "#err"), Enabled = False) + self.xSearch = self._addWidget('search_button', 'Button', nX+145, nY1+210, 30, nHeight, Label = ">>>", HelpText=ui.get('goto'), Enabled = False) + self.xExport = self._addWidget('export_button', 'Button', nX+180, nY1+210, 40, nHeight, Label = ui.get('export'), Enabled = False) # Tag # Note: the only way to group RadioButtons is to create them successively - self._addWidget("charstyle_section", 'FixedLine', nX, nY2, 200, nHeight, Label = self.dUI.get("charstyle_section", "#err"), FontDescriptor = xFDTitle) - self.xAccent = self._addWidget('emphasis', 'RadioButton', nX, nY2+12, 55, nHeight, Label = self.dUI.get('emphasis', "#err")) - self.xStrongAccent = self._addWidget('strong_emphasis', 'RadioButton', nX+60, nY2+12, 70, nHeight, Label = self.dUI.get('strong_emphasis', "#err")) - self.xNoAccent = self._addWidget('nostyle', 'RadioButton', nX+140, nY2+12, 45, nHeight, Label = self.dUI.get('nostyle', "#err")) + self._addWidget("charstyle_section", 'FixedLine', nX, nY2, 200, nHeight, Label = ui.get("charstyle_section"), FontDescriptor = xFDTitle) + self.xAccent = self._addWidget('emphasis', 'RadioButton', nX, nY2+12, 55, nHeight, Label = ui.get('emphasis')) + self.xStrongAccent = self._addWidget('strong_emphasis', 'RadioButton', nX+60, nY2+12, 70, nHeight, Label = ui.get('strong_emphasis')) + self.xNoAccent = self._addWidget('nostyle', 'RadioButton', nX+140, nY2+12, 45, nHeight, Label = ui.get('nostyle')) - self.xTag = self._addWidget('tag_button', 'Button', self.xDialog.Width-40, nY2+10, 30, 11, Label = self.dUI.get('tag_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500, Enabled=False) + self.xTag = self._addWidget('tag_button', 'Button', self.xDialog.Width-40, nY2+10, 30, 11, Label = ui.get('tag_button'), FontDescriptor = xFDTitle, TextColor = 0x005500, Enabled=False) # Progress bar self.xProgressBar = self._addWidget('progress_bar', 'ProgressBar', nX, self.xDialog.Height-25, 160, 14) self.xProgressBar.ProgressValueMin = 0 self.xProgressBar.ProgressValueMax = 1 # to calculate later # Close - self._addWidget('close_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000) + self._addWidget('close_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = ui.get('close_button'), FontDescriptor = xFDTitle, TextColor = 0x550000) # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) self.xContainer.setModel(self.xDialog) self.xGridControl = self.xContainer.getControl('list_grid') @@ -192,21 +192,21 @@ # XActionListener def actionPerformed (self, xActionEvent): try: if xActionEvent.ActionCommand == "Count": - self.count(self.dUI.get("words", "#err")) + self.count(ui.get("words")) self.xTag.Enabled = True self.xSearch.Enabled = True self.xExport.Enabled = True elif xActionEvent.ActionCommand == "CountByLemma": - self.count(self.dUI.get("lemmas", "#err"), bByLemma=True) + self.count(ui.get("lemmas"), bByLemma=True) self.xTag.Enabled = False self.xSearch.Enabled = False self.xExport.Enabled = True elif xActionEvent.ActionCommand == "UnknownWords": - self.count(self.dUI.get("unknown_words", "#err"), bOnlyUnknownWords=True) + self.count(ui.get("unknown_words"), bOnlyUnknownWords=True) self.xTag.Enabled = True self.xSearch.Enabled = True self.xExport.Enabled = True elif xActionEvent.ActionCommand == "Search": if not self.xGridControl.hasSelectedRows(): @@ -346,11 +346,11 @@ #spfExported = os.path.join(os.path.expanduser("~"), "fr.personal.json") with open(spfExported, "w", encoding="utf-8") as hDst: hDst.write(sText) except: sMessage = traceback.format_exc() - MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"), ERRORBOX) + MessageBox(self.xDocument, sMessage, ui.get('export_title'), ERRORBOX) @_waitPointer def tagText (self, aWord, sAction=""): if not sAction: return Index: gc_lang/fr/oxt/Lexicographer/enum_strings.py ================================================================== --- gc_lang/fr/oxt/Lexicographer/enum_strings.py +++ gc_lang/fr/oxt/Lexicographer/enum_strings.py @@ -1,9 +1,22 @@ -def getUI (sLang): +# strings for Enumerator + +sUI = "fr" + + +def selectLang (sLang): + global sUI if sLang in dStrings: - return dStrings[sLang] - return dStrings["fr"] + sUI = sLang + + +def get (sMsgCode): + try: + return dStrings[sUI].get(sMsgCode, sMsgCode) + except: + return "#error" + dStrings = { "fr": { "title": "Grammalecte · Recenseur de mots", Index: gc_lang/fr/rules.grx ================================================================== --- gc_lang/fr/rules.grx +++ gc_lang/fr/rules.grx @@ -21259,11 +21259,11 @@ à [fond|fonts] [perdu+ses] <<- /conf/ ->> à fonds perdus && Confusion : fonds (ce qui constitue une richesse) ≠ fond (partie la plus basse/profonde). [fond|fonts] [>monétaire|spéculatif+s|>international|souverain+s] [fond|fonts] [de|d’] [commerce|garantie|roulement|pension|placement|retraite|roulement|solidarité] - [fond|fonts] d’ [aide|investissement|indemnisation] + [fond|fonts] d’ [aide|investissement|indemnisation|urgence] <<- /conf/ -1>> fonds && Confusion : fonds (ce qui constitue une richesse) ≠ fond (partie la plus basse/profonde). fonds baptismaux <<- /conf/ -1>> fonts && Confusion. Écrivez “fonts”, qui vient du mot latin ‹fons› et signifie « fontaine, source ».