wizards/source/scriptforge/SF_Platform.xba |    2 +-
 wizards/source/scriptforge/SF_Root.xba     |    2 +-
 wizards/source/scriptforge/SF_Services.xba |    2 +-
 wizards/source/scriptforge/SF_String.xba   |   14 +++++++-------
 wizards/source/scriptforge/SF_Utils.xba    |   26 +++++++++++++-------------
 5 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit 6983e9e0a299d3645a1eaaad9ff1b0a79ea2d207
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Thu Nov 25 17:26:06 2021 +0100
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Thu Nov 25 17:35:45 2021 +0100

    ScriptForge - (SF_Platform) fix Locale should return the OS locale
    
    So far it returned the LO locale.
    Discussed on Telegram
    
    Change-Id: I2cf66ca3acebe695354de9185e0698ffa4d8cf05
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125820
    Tested-by: Jean-Pierre Ledure <j...@ledure.be>
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>

diff --git a/wizards/source/scriptforge/SF_Platform.xba 
b/wizards/source/scriptforge/SF_Platform.xba
index c504de6b9809..a19ee2bc7a6c 100644
--- a/wizards/source/scriptforge/SF_Platform.xba
+++ b/wizards/source/scriptforge/SF_Platform.xba
@@ -351,7 +351,7 @@ Const cstSubArgs = &quot;&quot;
                        &apos;  Remove leading and trailing commas
                        If Len(sFonts) &gt; 1 Then _PropertyGet = 
Split(Mid(sFonts, 2, Len(sFonts) - 2), &quot;,&quot;) Else _PropertyGet = 
Array()
                Case &quot;Locale&quot;
-                       Set oLocale = 
SF_Utils._GetUNOService(&quot;Locale&quot;)
+                       Set oLocale = 
SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
                        _PropertyGet = oLocale.Language &amp; &quot;-&quot; 
&amp; oLocale.Country
                Case &quot;OfficeVersion&quot;
                        _PropertyGet = _GetProductName()
diff --git a/wizards/source/scriptforge/SF_Root.xba 
b/wizards/source/scriptforge/SF_Root.xba
index 258eea4bde2f..3ec4c2936908 100644
--- a/wizards/source/scriptforge/SF_Root.xba
+++ b/wizards/source/scriptforge/SF_Root.xba
@@ -283,7 +283,7 @@ Try:
                &apos;  Build the po file name
                With SF_FileSystem
                        sInstallFolder = ._SFInstallFolder()    &apos;  
ScriptForge installation folder
-                       sLocale = 
SF_Utils._GetUNOService(&quot;Locale&quot;).Language
+                       sLocale = 
SF_Utils._GetUNOService(&quot;SystemLocale&quot;).Language
                        sPOFolder = .BuildPath(sInstallFolder, &quot;po&quot;)
                        sPOFile = .BuildPath(sPOFolder, sLocale &amp; 
&quot;.po&quot;)
                        If Not .FileExists(sPOFile) Then        &apos;  File 
not found =&gt; load texts from code below
diff --git a/wizards/source/scriptforge/SF_Services.xba 
b/wizards/source/scriptforge/SF_Services.xba
index a5f360fa386e..74bc110c9371 100644
--- a/wizards/source/scriptforge/SF_Services.xba
+++ b/wizards/source/scriptforge/SF_Services.xba
@@ -547,7 +547,7 @@ Check:
                        sLocale = pvArgs(1)
                End If
                If Len(sLocale) = 0 Then        &apos;  Called from Python, the 
Locale argument may be the zero-length string
-                       Set oLocale = 
SF_Utils._GetUNOService(&quot;Locale&quot;)
+                       Set oLocale = 
SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
                        sLocale = oLocale.Language &amp; &quot;-&quot; &amp; 
oLocale.Country
                End If
                If UBound(pvArgs) &gt;= 2 Then
diff --git a/wizards/source/scriptforge/SF_String.xba 
b/wizards/source/scriptforge/SF_String.xba
index 28145ab42750..10ce48045ab8 100644
--- a/wizards/source/scriptforge/SF_String.xba
+++ b/wizards/source/scriptforge/SF_String.xba
@@ -173,7 +173,7 @@ Check:
 Try:
        lLength = Len(InputStr)
        If lLength &gt; 0 Then
-               Set oLocale = SF_Utils._GetUNOService(&quot;Locale&quot;)
+               Set oLocale = SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
                Set oChar = SF_Utils._GetUNOService(&quot;CharacterClass&quot;)
                sCapital = oChar.toTitle(InputStr, 0, lLength * 4, oLocale)     
&apos;  length * 4 because length is expressed in bytes
        End If
@@ -444,7 +444,7 @@ Try:
        lLength = Len(InputStr)
        lReplace = Len(ReplacedBy)
        If lLength &gt; 0 Then
-               Set oLocale = SF_Utils._GetUNOService(&quot;Locale&quot;)
+               Set oLocale = SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
                Set oChar = SF_Utils._GetUNOService(&quot;CharacterClass&quot;)
                For i = 0 To lLength - 1
                        sChar = Mid(InputStr, i + 1, 1)
@@ -804,7 +804,7 @@ Check:
 Try:
        lLength = Len(InputStr)
        If lLength &gt; 0 Then
-               Set oLocale = SF_Utils._GetUNOService(&quot;Locale&quot;)
+               Set oLocale = SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
                Set oChar = SF_Utils._GetUNOService(&quot;CharacterClass&quot;)
                For i = 0 To lLength - 1
                        lType = oChar.getCharacterType(InputStr, i, oLocale)
@@ -860,7 +860,7 @@ Try:
                bAlphanum = ( sFirst &lt; &quot;0&quot; Or sFirst &gt; 
&quot;9&quot; )
                If bAlphaNum Then
                        sInputStr = Replace(InputStr, &quot;_&quot;, 
&quot;A&quot;)             &apos;  Replace by an arbitrary alphabetic character
-                       Set oLocale = 
SF_Utils._GetUNOService(&quot;Locale&quot;)
+                       Set oLocale = 
SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
                        Set oChar = 
SF_Utils._GetUNOService(&quot;CharacterClass&quot;)
                        For i = 0 To lLength - 1
                                lType = oChar.getCharacterType(sInputStr, i, 
oLocale)
@@ -1303,7 +1303,7 @@ Check:
 Try:
        lLength = Len(InputStr)
        If lLength &gt; 0 Then
-               Set oLocale = SF_Utils._GetUNOService(&quot;Locale&quot;)
+               Set oLocale = SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
                Set oChar = SF_Utils._GetUNOService(&quot;CharacterClass&quot;)
                For i = 0 To lLength - 1
                        sChar = Mid(InputStr, i + 1, 1)
@@ -2337,7 +2337,7 @@ Try:
        Else
                If Occurrences &lt; 0 Then Occurrences = 0
                Set oCharacterClass = 
SF_Utils._GetUNOService(&quot;CharacterClass&quot;)
-               Set oLocale = SF_Utils._GetUNOService(&quot;Locale&quot;)
+               Set oLocale = SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
 
                &apos;  Build an array of start/end positions of quoted strings 
containing at least 1x the Delimiter
                vStart = Array()        :       vEnd = Array()
@@ -2571,7 +2571,7 @@ Try:
                sUnquote = InputStr
        Else
                Set oCharacterClass = 
SF_Utils._GetUNOService(&quot;CharacterClass&quot;)
-               Set oLocale = SF_Utils._GetUNOService(&quot;Locale&quot;)
+               Set oLocale = SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
 
                &apos;  
https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1i18n_1_1XCharacterClassification.html#ad5f1be91fbe86853200391f828d4166b
                Set oParse = oCharacterClass.parsePredefinedToken( _
diff --git a/wizards/source/scriptforge/SF_Utils.xba 
b/wizards/source/scriptforge/SF_Utils.xba
index b18a42781bab..b3031e33f09a 100644
--- a/wizards/source/scriptforge/SF_Utils.xba
+++ b/wizards/source/scriptforge/SF_Utils.xba
@@ -368,19 +368,6 @@ Dim vNodePath As Variant
                                        Set .Introspection = 
CreateUnoService(&quot;com.sun.star.beans.Introspection&quot;)
                                End If
                                Set _GetUNOService = .Introspection
-                       Case &quot;Locale&quot;
-                               If IsEmpty(.Locale) Or IsNull(.Locale) Then
-                                       .Locale = 
CreateUnoStruct(&quot;com.sun.star.lang.Locale&quot;)
-                                       &apos;  Derived from the Tools library
-                                       Set oConfigProvider = 
createUnoService(&quot;com.sun.star.configuration.ConfigurationProvider&quot;)
-                                       vNodePath = Array()     :       ReDim 
vNodePath(0)
-                                       vNodePath(0) = New 
com.sun.star.beans.PropertyValue
-                                       vNodePath(0).Name = 
&quot;nodepath&quot;        :       vNodePath(0).Value = 
&quot;org.openoffice.Setup/L10N&quot;
-                                       sLocale = 
oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationAccess&quot;,
 vNodePath()).getByName(&quot;ooLocale&quot;)
-                                       .Locale.Language = Left(sLocale, 2)
-                                       .Locale.Country = Right(sLocale, 2)
-                               End If
-                               Set _GetUNOService = .Locale
                        Case &quot;MacroExpander&quot;
                                Set oDefaultContext = GetDefaultContext()
                                If Not IsNull(oDefaultContext) Then Set 
_GetUNOService = 
oDefaultContext.getValueByName(&quot;/singletons/com.sun.star.util.theMacroExpander&quot;)
@@ -429,6 +416,19 @@ Dim vNodePath As Variant
                                        End With
                                End If
                                Set _GetUNOService = .SearchOptions
+                       Case &quot;SystemLocale&quot;, &quot;Locale&quot;
+                               If IsEmpty(.Locale) Or IsNull(.Locale) Then
+                                       .Locale = 
CreateUnoStruct(&quot;com.sun.star.lang.Locale&quot;)
+                                       &apos;  Derived from the Tools library
+                                       Set oConfigProvider = 
createUnoService(&quot;com.sun.star.configuration.ConfigurationProvider&quot;)
+                                       vNodePath = Array()     :       ReDim 
vNodePath(0)
+                                       vNodePath(0) = New 
com.sun.star.beans.PropertyValue
+                                       vNodePath(0).Name = 
&quot;nodepath&quot;        :       vNodePath(0).Value = 
&quot;org.openoffice.System/L10N&quot;
+                                       sLocale = 
oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationAccess&quot;,
 vNodePath()).getByName(&quot;SystemLocale&quot;)
+                                       .Locale.Language = Left(sLocale, 2)
+                                       .Locale.Country = Right(sLocale, 2)
+                               End If
+                               Set _GetUNOService = .Locale
                        Case &quot;SystemShellExecute&quot;
                                If IsEmpty(.SystemShellExecute) Or 
IsNull(.SystemShellExecute) Then
                                        Set .SystemShellExecute = 
CreateUnoService(&quot;com.sun.star.system.SystemShellExecute&quot;)

Reply via email to