Hi Drew,
Drew Jensen escribió:
Thanks to the folks that sent fixes to the languages ( German, French,
Russian ) and for the suggestions for features also.
So - 16 languages - and 57 Locals...whehw...
Final piece on this and I just don't know what, if anything I am doing
wrong.
I need to ask OOo what the current language setting is when I display
the OverWriteFile warning. So I need the language not the local..
OK - here is my routine:
function getLanguage() as string
dim oLocale as new com.sun.star.lang.Locale
dim oConfigProvider as variant
Dim aSettings as variant
Dim aProps(0) As new com.sun.star.beans.PropertyValue
oConfigProvider = createUnoService(
"com.sun.star.configuration.ConfigurationProvider" )
aProps(0) = MakePropertyValue( "nodepath", "/org.openoffice.Setup/L10N" )
aSettings =
oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
aProps() )
oLocale = aSettings.getLocale
getLanguage = oLocale.Language
End function
problem is the oLocal structure is empty?
Any help would be appreciated.
see the following:
Sub OOoLocale
Dim oConfig as Object
oConfig = getConfigurationAccess("/org.openoffice.Setup/L10N", false)
Dim sOfficeLocaleAsString$
sOfficeLocaleAsString = oConfig.getByName( "ooLocale" )
Dim sOfficeLanguage$
Dim sLocale() as Variant
sLocale =Split(sOfficeLocaleAsString, "-")
'simpler
sOfficeLanguage = sLocale(0)
'if you need a css.lang.Locale
Dim aLocale as New com.sun.star.lang.Locale
If UBound(sLocale)=1 Then
aLocale.Language = sLocale(0)
aLocale.Country = sLocale(1)
Else
aLocale.Language = sLocale(0)
aLocale.Country = ""
End If
End Sub
Function getConfigurationAccess( _
sNodePath$,_
bUpdate
as Boolean,_
Optional aLocale$ _
)
REM Param. aLocale es STRING, NO com.sun.star.lang.Locale
' p.e. "es", "es-AR"
' "*" para TODAS
On Error GoTo getConfigurationAccessErrorHandler
Dim sConfigurationProvider$, oConfigurationProvider as Object
Dim sConfigurationAccess$, sConfigurationUpdateAccess$, sConfiguration$
Dim oConfigurationAccess as Object
sConfigurationProvider =
"com.sun.star.configuration.ConfigurationProvider"
oConfigurationProvider = createUNOService(sConfigurationProvider)
Dim oParametros(0) As New com.sun.star.beans.PropertyValue
oParametros(0).Name = "nodepath"
oParametros(0).Value = sNodePath
sConfigurationAccess =
"com.sun.star.configuration.ConfigurationAccess"
sConfigurationUpdateAccess =
"com.sun.star.configuration.ConfigurationUpdateAccess"
if bUpdate then
ReDim Preserve oParametros(1)
oParametros(1).Name = "EnableAsync"
oParametros(1).Value = FALSE
sConfiguration = sConfigurationUpdateAccess
else
sConfiguration = sConfigurationAccess
end if
if NOT IsMissing(aLocale) then
Dim n%
n = UBound(oParametros)+1
ReDim Preserve oParametros(n)
oParametros(n).Name = "Locale"
oParametros(n).Value = aLocale
end if
oConfigurationAccess =
oConfigurationProvider.createInstanceWithArguments(_
sConfiguration, oParametros())
getConfigurationAccessCleanUp:
getConfigurationAccess() = oConfigurationAccess
Exit Function
getConfigurationAccessErrorHandler:
Resume getConfigurationAccessCleanUp
End Function
--
Ariel Constenla-Haile
La Plata, Argentina
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.ArielConstenlaHaile.com.ar/ooo/
"Aus der Kriegsschule des Lebens
- Was mich nicht umbringt,
macht mich härter."
Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]