言語設定
ロケール,言語や地域,国を使用するときが時々あります。 その,ロカールを設定するときには OOo Basic では com.sun.star.lang.Locale struct を使用します。 Dim aLocale As New com.sun.star.lang.Locale aLocale.Language = "ja" 'Japanese aLocale.Country = "JP" 'JAPAN 上記のコードでは言語を "日本語" ,国を "日本" に設定しています。ロケールの設定は com.sun.star.lang.Locale struct を使用して行われます。 Language element は言語を文字列で http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt UI 言語設定
コンフィグレーション /org.openoffice.Setup/L10N からooLocale を取得します。 Sub UILocale oCP = CreateUnoService("com.sun.star.configuration.ConfigurationProvider") Dim aNode(0) As New com.sun.star.beans.PropertyValue aNode(0).Name = "nodepath" aNode(0).Value = "/org.openoffice.Setup/L10N" oCA = oCP.createInstanceWithArguments( _ "com.sun.star.configuration.ConfigurationAccess", aNode ) msgbox oCA.ooLocale End Sub インストールされている UI 言語一覧
コンフィグレーション /org.openoffice.Setup/Office/InstalledLocales から getElementNames を取得します。 Sub ListOfUILocales oCP = CreateUnoService("com.sun.star.configuration.ConfigurationProvider") Dim aNode(0) As New com.sun.star.beans.PropertyValue aNode(0).Name = "nodepath" aNode(0).Value = "/org.openoffice.Setup/Office/InstalledLocales" oCA = oCP.createInstanceWithArguments( _ "com.sun.star.configuration.ConfigurationAccess", aNode ) sNames = oCA.getElementNames() for i = 0 To UBound(sNames) step 1 msgbox sNames(i) next End Sub |