Bonjour Didier,
Didier Dorange-Pattoret wrote:
Bonjour,
Je voudrais changer la langue locale d'un compte utilisateur OOo.
J'ai essayé la macro, mais sans succès :
Sub Main
oConfigAccess = GetConfigAccess( "/org.openoffice.Setup/L10N", True )
oConfigAccess.ooLocale = "de"
oConfigAccess.commitChanges()
End Sub
Function GetConfigAccess( ByVal cNodePath As String,ByVal bWriteAccess
As Boolean,Optional bEnableSync,Optional bLazyWrite) As Object
If IsMissing(bEnableSync) Then bEnableSync = True
If IsMissing( bLazyWrite ) Then bLazyWrite = False
Dim oConfigProvider, oConfigAccess as Object
oConfigProvider =
GetProcessServiceManager.createInstanceWithArguments("com.sun.star.configuration.ConfigurationProvider",Array(
MakePropertyValue( "enableasync", bEnableSync)))
If bWriteAccess Then
cServiceName =
"com.sun.star.configuration.ConfigurationUpdateAccess"
Else
cServiceName = "com.sun.star.configuration.ConfigurationAccess"
EndIf
oConfigAccess = oConfigProvider.createInstanceWithArguments(
cServiceName, Array( MakePropertyValue( "nodepath", cNodePath ),
MakePropertyValue( "lazywrite", bLazyWrite )))
GetConfigAccess() = oConfigAccess
End Function
Didier Dorange-Pattoret
www.dmaths.org
Cordialement.
Sur ooo.forum.org la macro suivante, qui semble fonctionner correctement.
http://www.oooforum.org/forum/viewtopic.phtml?t=77031&highlight=locale
Sub Snippet_10()
Dim oCP As Object
Dim oCUA As Object
Dim aProps(0) As New com.sun.star.beans.PropertyValue
Dim sooSetupCurrency As String
Dim sooLocale As String
oCP = CreateUnoService( _
"com.sun.star.configuration.ConfigurationProvider" )
aProps(0).Name = "nodepath"
aProps(0).Value = "/org.openoffice.Setup/L10N"
oCUA = oCP.createInstanceWithArguments( _
"com.sun.star.configuration.ConfigurationUpdateAccess", aProps )
' change Locale Setting
oCUA.setPropertyValue("ooSetupSystemLocale", "es-SV")
' change Default Currency
oCUA.setPropertyValue("ooSetupCurrency", "USD-en-US")
'oCUA.setPropertyValue("ooSetupCurrency", "SVC-es-SV")
oCUA.commitChanges()
End Sub
Francois Gatto
--
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
Rejoignez maintenant plus de 3 000 personnes, associations, entreprises et
collectivités qui soutiennent notre action
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]