1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?> 2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="i18n_XLocaleData" script:language="StarBasic"> 4*b1cdbd2cSJim Jagielski 5*b1cdbd2cSJim Jagielski 6*b1cdbd2cSJim Jagielski'************************************************************************* 7*b1cdbd2cSJim Jagielski' 8*b1cdbd2cSJim Jagielski' Licensed to the Apache Software Foundation (ASF) under one 9*b1cdbd2cSJim Jagielski' or more contributor license agreements. See the NOTICE file 10*b1cdbd2cSJim Jagielski' distributed with this work for additional information 11*b1cdbd2cSJim Jagielski' regarding copyright ownership. The ASF licenses this file 12*b1cdbd2cSJim Jagielski' to you under the Apache License, Version 2.0 (the 13*b1cdbd2cSJim Jagielski' "License"); you may not use this file except in compliance 14*b1cdbd2cSJim Jagielski' with the License. You may obtain a copy of the License at 15*b1cdbd2cSJim Jagielski' 16*b1cdbd2cSJim Jagielski' http://www.apache.org/licenses/LICENSE-2.0 17*b1cdbd2cSJim Jagielski' 18*b1cdbd2cSJim Jagielski' Unless required by applicable law or agreed to in writing, 19*b1cdbd2cSJim Jagielski' software distributed under the License is distributed on an 20*b1cdbd2cSJim Jagielski' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21*b1cdbd2cSJim Jagielski' KIND, either express or implied. See the License for the 22*b1cdbd2cSJim Jagielski' specific language governing permissions and limitations 23*b1cdbd2cSJim Jagielski' under the License. 24*b1cdbd2cSJim Jagielski' 25*b1cdbd2cSJim Jagielski'************************************************************************* 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielski 29*b1cdbd2cSJim Jagielski 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski' Be sure that all variables are dimensioned: 32*b1cdbd2cSJim Jagielskioption explicit 33*b1cdbd2cSJim Jagielski 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski 36*b1cdbd2cSJim JagielskiSub RunTest() 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim Jagielski'************************************************************************* 39*b1cdbd2cSJim Jagielski' INTERFACE: 40*b1cdbd2cSJim Jagielski' com.sun.star.i18n.XLocaleData 41*b1cdbd2cSJim Jagielski'************************************************************************* 42*b1cdbd2cSJim JagielskiOn Error Goto ErrHndl 43*b1cdbd2cSJim Jagielski Dim bOK As Boolean 44*b1cdbd2cSJim Jagielski Dim AllNames As Variant, nNamesCount As Integer, i As Integer 45*b1cdbd2cSJim Jagielski Dim Locale As Variant, oInfo As Variant, LocItem As Variant 46*b1cdbd2cSJim Jagielski Dim AllCalendars As Variant, AllCurrencies As Variant 47*b1cdbd2cSJim Jagielski Dim AllFormats As Variant, Implementations As Variant 48*b1cdbd2cSJim Jagielski Dim sOpt As Variant, size As Variant 49*b1cdbd2cSJim Jagielski Dim rtLit As Variant, fbc As Variant, rw As Variant 50*b1cdbd2cSJim Jagielski 51*b1cdbd2cSJim Jagielski Test.StartMethod("getAllInstalledLocaleNames()") 52*b1cdbd2cSJim Jagielski bOK = true 53*b1cdbd2cSJim Jagielski AllNames = oObj.getAllInstalledLocaleNames() 54*b1cdbd2cSJim Jagielski nNamesCount = ubound(AllNames) 55*b1cdbd2cSJim Jagielski Out.Log("Found " + nNamesCount + " Loacales registered in the system") 56*b1cdbd2cSJim Jagielski 57*b1cdbd2cSJim Jagielski for i = 0 to nNamesCount 58*b1cdbd2cSJim Jagielski Out.Log("" + i + "). " + AllNames(i).Country + ";" + AllNames(i).Language + ";" + AllNames(i).Variant) 59*b1cdbd2cSJim Jagielski next i 60*b1cdbd2cSJim Jagielski 61*b1cdbd2cSJim Jagielski Randomize 62*b1cdbd2cSJim Jagielski Locale = AllNames(rnd * nNamesCount) 63*b1cdbd2cSJim Jagielski Out.Log("Choose for testing : " + Locale.Country) 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski bOK = bOK AND NOT isNULL(Locale) 66*b1cdbd2cSJim Jagielski Test.MethodTested("getAllInstalledLocaleNames()", bOK) 67*b1cdbd2cSJim Jagielski 68*b1cdbd2cSJim Jagielski Test.StartMethod("getLanguageCountryInfo()") 69*b1cdbd2cSJim Jagielski bOK = true 70*b1cdbd2cSJim Jagielski oInfo = oObj.getLanguageCountryInfo(Locale) 71*b1cdbd2cSJim Jagielski bOK = bOK AND oInfo.Language = Locale.Language 72*b1cdbd2cSJim Jagielski bOK = bOK AND oInfo.Country = Locale.Country 73*b1cdbd2cSJim Jagielski Out.Log("Language: " + oInfo.Language + _ 74*b1cdbd2cSJim Jagielski ", LanguageDefaultName: " + oInfo.LanguageDefaultName + _ 75*b1cdbd2cSJim Jagielski ", Country: " + oInfo.Country + _ 76*b1cdbd2cSJim Jagielski ", CountryDefaultName: " + oInfo.CountryDefaultName + _ 77*b1cdbd2cSJim Jagielski ", Variant: " + oInfo.Variant) 78*b1cdbd2cSJim Jagielski 79*b1cdbd2cSJim Jagielski Test.MethodTested("getLanguageCountryInfo()", bOK) 80*b1cdbd2cSJim Jagielski 81*b1cdbd2cSJim Jagielski Test.StartMethod("getLocaleItem()") 82*b1cdbd2cSJim Jagielski bOK = true 83*b1cdbd2cSJim Jagielski LocItem = oObj.getLocaleItem(Locale) 84*b1cdbd2cSJim Jagielski bOK = bOK AND LocItem.unoID <> "" 85*b1cdbd2cSJim Jagielski Out.Log(" unoID: " + LocItem.unoID + _ 86*b1cdbd2cSJim Jagielski " dateSeparator: " + LocItem.dateSeparator + _ 87*b1cdbd2cSJim Jagielski " thousandSeparator: " + LocItem.thousandSeparator + _ 88*b1cdbd2cSJim Jagielski " decimalSeparator: " + LocItem.decimalSeparator + _ 89*b1cdbd2cSJim Jagielski " timeSeparator: " + LocItem.timeSeparator + _ 90*b1cdbd2cSJim Jagielski " time100SecSeparator: " + LocItem.time100SecSeparator + _ 91*b1cdbd2cSJim Jagielski " listSeparator: " + LocItem.listSeparator + _ 92*b1cdbd2cSJim Jagielski " quotationStart: " + LocItem.quotationStart + _ 93*b1cdbd2cSJim Jagielski " quotationEnd: " + LocItem.quotationEnd + _ 94*b1cdbd2cSJim Jagielski " doubleQuotationStart: " + LocItem.doubleQuotationStart + _ 95*b1cdbd2cSJim Jagielski " doubleQuotationEnd: " + LocItem.doubleQuotationEnd + _ 96*b1cdbd2cSJim Jagielski " timeAM: " + LocItem.timeAM + _ 97*b1cdbd2cSJim Jagielski " timePM: " + LocItem.timePM + _ 98*b1cdbd2cSJim Jagielski " measurementSystem: " + LocItem.measurementSystem + _ 99*b1cdbd2cSJim Jagielski " LongDateDayOfWeekSeparator: " + LocItem.LongDateDayOfWeekSeparator + _ 100*b1cdbd2cSJim Jagielski " LongDateDaySeparator: " + LocItem.LongDateDaySeparator + _ 101*b1cdbd2cSJim Jagielski " LongDateMonthSeparator: " + LocItem.LongDateMonthSeparator + _ 102*b1cdbd2cSJim Jagielski " LongDateYearSeparator: " + LocItem.LongDateYearSeparator) 103*b1cdbd2cSJim Jagielski Test.MethodTested("getLocaleItem()", bOK) 104*b1cdbd2cSJim Jagielski 105*b1cdbd2cSJim Jagielski Test.StartMethod("getAllCalendars()") 106*b1cdbd2cSJim Jagielski bOK = true 107*b1cdbd2cSJim Jagielski AllCalendars = oObj.getAllCalendars(Locale) 108*b1cdbd2cSJim Jagielski bOK = bOK AND NOT isNULL(AllCalendars(0)) 109*b1cdbd2cSJim Jagielski Out.Log("Found " + ubound(AllCalendars) + 1 + " calendar(s) used in this Locale") 110*b1cdbd2cSJim Jagielski 111*b1cdbd2cSJim Jagielski Dim Days As Variant, Months As Variant, Eras As Variant 112*b1cdbd2cSJim Jagielski Dim j As Integer 113*b1cdbd2cSJim Jagielski for i = 0 to ubound(AllCalendars) 114*b1cdbd2cSJim Jagielski 115*b1cdbd2cSJim Jagielski Out.Log("Calendar " + i + 1 + ":") 116*b1cdbd2cSJim Jagielski Out.Log(" Days:") 117*b1cdbd2cSJim Jagielski Days = AllCalendars(i).Days 118*b1cdbd2cSJim Jagielski for j = 0 to ubound(Days) 119*b1cdbd2cSJim Jagielski Out.Log(" " + j + ") ID: " + Days(j).ID + ", AbbrevName: " + Days(j).AbbrevName + ", FullName: " + Days(j).FullName) 120*b1cdbd2cSJim Jagielski next j 121*b1cdbd2cSJim Jagielski Out.Log(" Months:") 122*b1cdbd2cSJim Jagielski Months = AllCalendars(i).Months 123*b1cdbd2cSJim Jagielski for j = 0 to ubound(Months) 124*b1cdbd2cSJim Jagielski Out.Log(" " + j + ") ID: " + Months(j).ID + ", AbbrevName: " + Months(j).AbbrevName + ", FullName: " + Months(j).FullName) 125*b1cdbd2cSJim Jagielski next j 126*b1cdbd2cSJim Jagielski Out.Log(" Eras:") 127*b1cdbd2cSJim Jagielski Eras = AllCalendars(i).Eras 128*b1cdbd2cSJim Jagielski for j = 0 to ubound(Eras) 129*b1cdbd2cSJim Jagielski Out.Log(" " + j + ") ID: " + Eras(j).ID + ", AbbrevName: " + Eras(j).AbbrevName + ", FullName: " + Eras(j).FullName) 130*b1cdbd2cSJim Jagielski next j 131*b1cdbd2cSJim Jagielski Out.Log(" StartOfWeek: " + AllCalendars(i).StartOfWeek) 132*b1cdbd2cSJim Jagielski Out.Log(" MinimumNumberOfDaysForFirstWeek: " + AllCalendars(i).MinimumNumberOfDaysForFirstWeek) 133*b1cdbd2cSJim Jagielski Out.Log(" Default: " + AllCalendars(i).Default) 134*b1cdbd2cSJim Jagielski Out.Log(" Name: " + AllCalendars(i).Name) 135*b1cdbd2cSJim Jagielski next i 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski Test.MethodTested("getAllCalendars()", bOK) 138*b1cdbd2cSJim Jagielski 139*b1cdbd2cSJim Jagielski Test.StartMethod("getAllCurrencies()") 140*b1cdbd2cSJim Jagielski bOK = true 141*b1cdbd2cSJim Jagielski AllCurrencies = oObj.getAllCurrencies(Locale) 142*b1cdbd2cSJim Jagielski Out.Log("Found " + ubound(AllCurrencies) + 1 + " Currencies used in this Locale") 143*b1cdbd2cSJim Jagielski bOK = bOK AND NOT isNULL(AllCurrencies(0)) 144*b1cdbd2cSJim Jagielski for i = 0 to ubound(AllCurrencies) 145*b1cdbd2cSJim Jagielski Out.Log("Currency " + i + 1 + ":") 146*b1cdbd2cSJim Jagielski Out.Log(" ID: " + AllCurrencies(i).ID + _ 147*b1cdbd2cSJim Jagielski " Symbol: " + AllCurrencies(i).Symbol + _ 148*b1cdbd2cSJim Jagielski " BankSymbol: " + AllCurrencies(i).BankSymbol + _ 149*b1cdbd2cSJim Jagielski " Name: " + AllCurrencies(i).Name + _ 150*b1cdbd2cSJim Jagielski " Default: " + AllCurrencies(i).Default) 151*b1cdbd2cSJim Jagielski next i 152*b1cdbd2cSJim Jagielski 153*b1cdbd2cSJim Jagielski Test.MethodTested("getAllCurrencies()", bOK) 154*b1cdbd2cSJim Jagielski 155*b1cdbd2cSJim Jagielski Test.StartMethod("getAllFormats()") 156*b1cdbd2cSJim Jagielski bOK = true 157*b1cdbd2cSJim Jagielski AllFormats = oObj.getAllFormats(Locale) 158*b1cdbd2cSJim Jagielski Out.Log("Found " + ubound(AllFormats) + 1 + " FormatElement(s) used in this Locale") 159*b1cdbd2cSJim Jagielski bOK = bOK AND NOT isNULL(AllFormats(0)) 160*b1cdbd2cSJim Jagielski for i = 0 to ubound(AllFormats) 161*b1cdbd2cSJim Jagielski Out.Log("FormatElement " + i + 1 + ":") 162*b1cdbd2cSJim Jagielski Out.Log(" formatCode: " + AllFormats(i).formatCode + _ 163*b1cdbd2cSJim Jagielski " formatName: " + AllFormats(i).formatName + _ 164*b1cdbd2cSJim Jagielski " formatKey: " + AllFormats(i).formatKey + _ 165*b1cdbd2cSJim Jagielski " formatType: " + AllFormats(i).formatType + _ 166*b1cdbd2cSJim Jagielski " formatUsage: " + AllFormats(i).formatUsage + _ 167*b1cdbd2cSJim Jagielski " formatIndex: " + AllFormats(i).formatIndex + _ 168*b1cdbd2cSJim Jagielski " isDefault: " + AllFormats(i).isDefault) 169*b1cdbd2cSJim Jagielski next i 170*b1cdbd2cSJim Jagielski Test.MethodTested("getAllFormats()", bOK) 171*b1cdbd2cSJim Jagielski 172*b1cdbd2cSJim Jagielski Test.StartMethod("getCollatorImplementations()") 173*b1cdbd2cSJim Jagielski bOK = true 174*b1cdbd2cSJim Jagielski Implementations = oObj.getCollatorImplementations(Locale) 175*b1cdbd2cSJim Jagielski Out.Log("Found " + (ubound(Implementations) + 1) + " Implementation(s) used in this Locale") 176*b1cdbd2cSJim Jagielski bOK = bOK AND NOT isNULL(Implementations(0)) 177*b1cdbd2cSJim Jagielski for i = 0 to ubound(Implementations) 178*b1cdbd2cSJim Jagielski Out.Log("Implementation " + (i + 1) + ":") 179*b1cdbd2cSJim Jagielski Out.Log(" unoID: " + Implementations(i).unoID ) 180*b1cdbd2cSJim Jagielski Out.Log(" isDefault: " + Implementations(i).isDefault) 181*b1cdbd2cSJim Jagielski next i 182*b1cdbd2cSJim Jagielski Test.MethodTested("getCollatorImplementations()", bOK) 183*b1cdbd2cSJim Jagielski 184*b1cdbd2cSJim Jagielski Test.StartMethod("getSearchOptions()") 185*b1cdbd2cSJim Jagielski bOK = true 186*b1cdbd2cSJim Jagielski sOpt = oObj.getSearchOptions(Locale) 187*b1cdbd2cSJim Jagielski size = ubound(sOpt) 188*b1cdbd2cSJim Jagielski Out.Log("There are : " + (size + 1) + " search options.") 189*b1cdbd2cSJim Jagielski for i = 0 to size 190*b1cdbd2cSJim Jagielski Out.Log("'" + sOpt(i) + "'") 191*b1cdbd2cSJim Jagielski next i 192*b1cdbd2cSJim Jagielski bOK = bOK AND isArray(sOpt) 193*b1cdbd2cSJim Jagielski Test.MethodTested("getSearchOptions()", bOK) 194*b1cdbd2cSJim Jagielski 195*b1cdbd2cSJim Jagielski Test.StartMethod("getCollationOptions()") 196*b1cdbd2cSJim Jagielski bOK = true 197*b1cdbd2cSJim Jagielski sOpt = oObj.getCollationOptions(Locale) 198*b1cdbd2cSJim Jagielski size = ubound(sOpt) 199*b1cdbd2cSJim Jagielski Out.Log("There are : " + (size + 1) + " collation options.") 200*b1cdbd2cSJim Jagielski for i = 0 to size 201*b1cdbd2cSJim Jagielski Out.Log("'" + sOpt(i) + "'") 202*b1cdbd2cSJim Jagielski next i 203*b1cdbd2cSJim Jagielski bOK = bOK AND isArray(sOpt) 204*b1cdbd2cSJim Jagielski Test.MethodTested("getCollationOptions()", bOK) 205*b1cdbd2cSJim Jagielski 206*b1cdbd2cSJim Jagielski Test.StartMethod("getTransliterations()") 207*b1cdbd2cSJim Jagielski bOK = true 208*b1cdbd2cSJim Jagielski rtLit = oObj.getTransliterations(Locale) 209*b1cdbd2cSJim Jagielski bOK = bOK AND NOT isNULL(rtLit) 210*b1cdbd2cSJim Jagielski for i = 0 to ubound(rtLit) 211*b1cdbd2cSJim Jagielski Out.Log("" + i + 1 +") " + rtLit(i)) 212*b1cdbd2cSJim Jagielski next i 213*b1cdbd2cSJim Jagielski Test.MethodTested("getTransliterations()", bOK) 214*b1cdbd2cSJim Jagielski 215*b1cdbd2cSJim Jagielski Test.StartMethod("getForbiddenCharacters()") 216*b1cdbd2cSJim Jagielski bOK = true 217*b1cdbd2cSJim Jagielski fbc = oObj.getForbiddenCharacters(Locale) 218*b1cdbd2cSJim Jagielski 219*b1cdbd2cSJim Jagielski Out.Log(" beginLine: " + fbc.beginLine) 220*b1cdbd2cSJim Jagielski Out.Log(" endLine: " + fbc.endLine) 221*b1cdbd2cSJim Jagielski 222*b1cdbd2cSJim Jagielski bOK = bOK AND NOT isNULL(fbc) 223*b1cdbd2cSJim Jagielski Test.MethodTested("getForbiddenCharacters()", bOK) 224*b1cdbd2cSJim Jagielski 225*b1cdbd2cSJim Jagielski Test.StartMethod("getReservedWord()") 226*b1cdbd2cSJim Jagielski bOK = true 227*b1cdbd2cSJim Jagielski rw = oObj.getReservedWord(Locale) 228*b1cdbd2cSJim Jagielski bOK = bOK AND NOT isNULL(rw) 229*b1cdbd2cSJim Jagielski for i = 0 to ubound(rw) 230*b1cdbd2cSJim Jagielski Out.Log("" + i + 1 +") " + rw(i)) 231*b1cdbd2cSJim Jagielski next i 232*b1cdbd2cSJim Jagielski Test.MethodTested("getReservedWord()", bOK) 233*b1cdbd2cSJim Jagielski 234*b1cdbd2cSJim JagielskiExit Sub 235*b1cdbd2cSJim JagielskiErrHndl: 236*b1cdbd2cSJim Jagielski Test.Exception() 237*b1cdbd2cSJim Jagielski bOK = false 238*b1cdbd2cSJim Jagielski resume next 239*b1cdbd2cSJim JagielskiEnd Sub 240*b1cdbd2cSJim Jagielski</script:module> 241