diff options
author | Xisco Fauli <anistenis@gmail.com> | 2012-10-03 22:59:03 +0200 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2012-10-03 23:01:30 +0200 |
commit | 60211510d3a1c2f96bb6f6e96895f003d6beef74 (patch) | |
tree | 35eedc2a02c16a2e1ed8404386cebe34def116df | |
parent | 789c48251add484f3c912b700b418a733385181d (diff) |
pywizard: localise listbox at runtime
Change-Id: I667976f7f76776cc3ef76abe9935271a7a0c2923
3 files changed, 33 insertions, 8 deletions
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py index a213b7e4f444..0364a0ddcc99 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.py +++ b/wizards/com/sun/star/wizards/common/FileAccess.py @@ -307,7 +307,7 @@ class FileAccess(object): return False @classmethod - def getFolderTitles(self, xMSF, FilterName, FolderName): + def getFolderTitles(self, xMSF, FilterName, FolderName, resDict): #Returns and ordered dict containing the template's name and path LocLayoutFiles = {} @@ -321,12 +321,17 @@ class FileAccess(object): FilterName = None else: FilterName += "-" - + for i in nameList: fileName = self.getFilename(i) if FilterName is None or fileName.startswith(FilterName): xDocInterface.loadFromMedium(i, tuple()) - LocLayoutFiles[xDocInterface.Title] = i + if xDocInterface.Title in resDict: + # localise string at runtime + title = resDict[xDocInterface.Title] + else: + title = xDocInterface.Title + LocLayoutFiles[title] = i except Exception, exception: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py index b128a95ceab0..ae738009839e 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py @@ -299,9 +299,9 @@ class FaxWizardDialogImpl(FaxWizardDialog): "/wizard/fax") self.sWorkPath = FileAccess.getOfficePath2(xMSF, "Work", "", "") self.BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", - self.sFaxPath) + self.sFaxPath, self.resources.dictBusinessTemplate) self.PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", - self.sFaxPath) + self.sFaxPath, self.resources.dictPrivateTemplate) self.setControlProperty("lstBusinessStyle", "StringItemList", tuple(self.BusinessFiles.keys())) @@ -327,17 +327,17 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.myFaxDoc.updateDateFields() def initializeSalutation(self): - #'Saludation' dropdown list + #'Saludation' listbox self.setControlProperty("lstSalutation", "StringItemList", tuple(self.resources.SalutationLabels)) def initializeGreeting(self): - #'Complimentary Close' dropdown list + #'Complimentary Close' listbox self.setControlProperty("lstGreeting", "StringItemList", tuple(self.resources.GreetingLabels)) def initializeCommunication(self): - #'Type of message' dropdown list + #'Type of message' listbox self.setControlProperty("lstCommunicationType", "StringItemList", tuple(self.resources.CommunicationLabels)) diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py index 33bda5616e36..7cf37031a93b 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py @@ -140,6 +140,26 @@ class FaxWizardDialogResources(Resource): FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 47), FaxWizardDialogResources.resConsist3PlaceHolder : self.getResText( FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 48)} + + #Create a dictionary for localising the private template + self.dictPrivateTemplate = { + "Bottle" : self.getResText( + FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 49), + "Lines" : self.getResText( + FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 50), + "Marine" : self.getResText( + FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 51)} + + #Create a dictionary for localising the business template + self.dictBusinessTemplate = { + "Classic Fax" : self.getResText( + FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 52), + "Classic Fax from Private" : self.getResText( + FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 53), + "Modern Fax" : self.getResText( + FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 54), + "Modern Fax from Private" : self.getResText( + FaxWizardDialogResources.RID_FAXWIZARDDIALOG_START + 55)} #Common Resources self.resOverwriteWarning = self.getResText( |