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