summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2021-03-09 17:08:18 +0100
committerJean-Pierre Ledure <jp@ledure.be>2021-03-10 16:28:15 +0100
commit1f842e3aa07af26776a8583e5b0ed1bdb178af9b (patch)
tree605075a892c7dd2e05299def328f87e16e44e4fc
parent7921f47ec6292ea2bd4807423ac46d9dacdd906e (diff)
ScriptForge - (scriptforge.py) L10N class
Addition of SF_L10N class Correction in Languages() property: selection of file based on *.po filter i.o. ??-??.po Change-Id: I5c57d1973265f2aeb7a3cfb4f507ffd50a28785a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112211 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
-rw-r--r--wizards/source/scriptforge/SF_L10N.xba2
-rw-r--r--wizards/source/scriptforge/python/scriptforge.py29
2 files changed, 29 insertions, 2 deletions
diff --git a/wizards/source/scriptforge/SF_L10N.xba b/wizards/source/scriptforge/SF_L10N.xba
index 8f526388d4c7..ced25a25bc78 100644
--- a/wizards/source/scriptforge/SF_L10N.xba
+++ b/wizards/source/scriptforge/SF_L10N.xba
@@ -661,7 +661,7 @@ Dim cstSubArgs As String
If Len(_POFolder) &gt; 0 Then _PropertyGet = ._ConvertFromUrl(_POFolder) Else _PropertyGet = &quot;&quot;
Case &quot;Languages&quot;
If Len(_POFolder) &gt; 0 Then
- vFiles = .Files(._ConvertFromUrl(_POFolder), &quot;??-??.po&quot;)
+ vFiles = .Files(._ConvertFromUrl(_POFolder), &quot;*.po&quot;)
For i = 0 To UBound(vFiles)
vFiles(i) = SF_FileSystem.GetBaseName(vFiles(i))
Next i
diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py
index a131329308bb..7547367d3ed6 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -682,6 +682,33 @@ class SFScriptForge:
return self.SIMPLEEXEC('ScriptForge.SF_FileSystem._ConvertFromUrl', filename)
# #########################################################################
+ # SF_L10N CLASS
+ # #########################################################################
+ class SF_L10N(SFServices):
+ """
+ This service provides a number of methods related to the translation of strings
+ with minimal impact on the program's source code.
+ The methods provided by the L10N service can be used mainly to:
+ Create POT files that can be used as templates for translation of all strings in the program.
+ Get translated strings at runtime for the language defined in the Locale property.
+ """
+ # Mandatory class properties for service registration
+ serviceimplementation = 'basic'
+ servicename = 'ScriptForge.L10N'
+ serviceProperties = dict(Folder = False, Languages = False, Locale = False)
+
+ def AddText(self, context = '', msgid = '', comment = ''):
+ return self.Execute(self.vbMethod, 'AddText', context, msgid, context)
+
+ def ExportToPOTFile(self, filename, header = '', encoding= 'UTF-8'):
+ return self.Execute(self.vbMethod, 'ExportToPOTFile', filename, header, encoding)
+
+ def GetText(self, msgid, *args):
+ return self.Execute(self.vbMethod, 'GetText', msgid, *args)
+
+ _ = GetText
+
+ # #########################################################################
# SF_TextStream CLASS
# #########################################################################
class SF_TextStream(SFServices):
@@ -727,7 +754,7 @@ class SFScriptForge:
# #########################################################################
class SF_Timer(SFServices):
"""
- The "Timer" service measures the amount of time it takes to run user scripts..
+ The "Timer" service measures the amount of time it takes to run user scripts.
"""
# Mandatory class properties for service registration
serviceimplementation = 'basic'