1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sal/config.h>
12 #include <cppunit/TestFixture.h>
13 #include <cppunit/TestAssert.h>
14 #include <cppunit/extensions/HelperMacros.h>
15 #include <cppunit/plugin/TestPlugIn.h>
17 #include <i18nlangtag/mslangid.hxx>
18 #include <i18nlangtag/languagetag.hxx>
19 #include <i18nlangtag/languagetagicu.hxx>
21 #include <rtl/ustring.hxx>
23 #include <com/sun/star/lang/Locale.hpp>
24 #include <com/sun/star/i18n/ScriptType.hpp>
26 using namespace com::sun::star
;
30 class TestLanguageTag
: public CppUnit::TestFixture
36 void testAllIsoLangEntries();
37 void testDisplayNames();
38 void testLanguagesWithoutHyphenation();
40 CPPUNIT_TEST_SUITE(TestLanguageTag
);
41 CPPUNIT_TEST(testAllTags
);
42 CPPUNIT_TEST(testAllIsoLangEntries
);
43 CPPUNIT_TEST(testDisplayNames
);
44 CPPUNIT_TEST(testLanguagesWithoutHyphenation
);
45 CPPUNIT_TEST_SUITE_END();
48 void TestLanguageTag::testAllTags()
51 LanguageTag
de_DE( "de-Latn-DE", true );
52 OUString aBcp47
= de_DE
.getBcp47();
53 lang::Locale aLocale
= de_DE
.getLocale();
54 LanguageType nLanguageType
= de_DE
.getLanguageType();
55 CPPUNIT_ASSERT_EQUAL_MESSAGE("Default script should be stripped after canonicalize.", OUString("de-DE"), aBcp47
);
56 CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale
.Language
);
57 CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale
.Country
);
58 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
59 CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN
, nLanguageType
);
60 CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE
.getLanguage() );
61 CPPUNIT_ASSERT_EQUAL( OUString("DE"), de_DE
.getCountry() );
62 CPPUNIT_ASSERT( de_DE
.getScript().isEmpty() );
63 CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE
.getLanguageAndScript() );
64 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE
.makeFallback().getBcp47() );
68 LanguageTag
klingon( "i-klingon", true );
69 lang::Locale aLocale
= klingon
.getLocale();
70 CPPUNIT_ASSERT_EQUAL( OUString("tlh"), klingon
.getBcp47() );
71 CPPUNIT_ASSERT_EQUAL( OUString("tlh"), aLocale
.Language
);
72 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
73 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
74 CPPUNIT_ASSERT( klingon
.isValidBcp47() );
75 CPPUNIT_ASSERT( klingon
.isIsoLocale() );
76 CPPUNIT_ASSERT( klingon
.isIsoODF() );
77 LanguageType nLang
= klingon
.getLanguageType();
78 LanguageTag
klingon_id( nLang
);
79 CPPUNIT_ASSERT_EQUAL( OUString("tlh"), klingon_id
.getBcp47() );
83 OUString
s_sr_RS( "sr-RS" );
84 LanguageTag
sr_RS( s_sr_RS
, true );
85 lang::Locale aLocale
= sr_RS
.getLocale();
86 CPPUNIT_ASSERT_EQUAL( s_sr_RS
, sr_RS
.getBcp47() );
87 CPPUNIT_ASSERT_EQUAL( OUString("sr"), aLocale
.Language
);
88 CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale
.Country
);
89 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
90 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA
, sr_RS
.getLanguageType() );
91 CPPUNIT_ASSERT( sr_RS
.isValidBcp47() );
92 CPPUNIT_ASSERT( sr_RS
.isIsoLocale() );
93 CPPUNIT_ASSERT( sr_RS
.isIsoODF() );
97 OUString
s_sr_Latn_RS( "sr-Latn-RS" );
98 LanguageTag
sr_RS( s_sr_Latn_RS
, true );
99 lang::Locale aLocale
= sr_RS
.getLocale();
100 CPPUNIT_ASSERT_EQUAL( s_sr_Latn_RS
, sr_RS
.getBcp47() );
101 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
102 CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale
.Country
);
103 CPPUNIT_ASSERT_EQUAL( s_sr_Latn_RS
, aLocale
.Variant
);
104 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA
, sr_RS
.getLanguageType() );
105 CPPUNIT_ASSERT( sr_RS
.isValidBcp47() );
106 CPPUNIT_ASSERT( !sr_RS
.isIsoLocale() );
107 CPPUNIT_ASSERT( sr_RS
.isIsoODF() );
108 CPPUNIT_ASSERT_EQUAL( OUString("sr"), sr_RS
.getLanguage() );
109 CPPUNIT_ASSERT_EQUAL( OUString("RS"), sr_RS
.getCountry() );
110 CPPUNIT_ASSERT_EQUAL( OUString("Latn"), sr_RS
.getScript() );
111 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sr_RS
.getLanguageAndScript() );
115 OUString
s_sr_Latn_CS( "sr-Latn-CS" );
116 LanguageTag
sr_Latn_CS( s_sr_Latn_CS
, true );
117 lang::Locale aLocale
= sr_Latn_CS
.getLocale();
118 CPPUNIT_ASSERT_EQUAL( s_sr_Latn_CS
, sr_Latn_CS
.getBcp47() );
119 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
120 CPPUNIT_ASSERT_EQUAL( OUString("CS"), aLocale
.Country
);
121 CPPUNIT_ASSERT_EQUAL( s_sr_Latn_CS
, aLocale
.Variant
);
122 CPPUNIT_ASSERT_EQUAL( LANGUAGE_SERBIAN_LATIN_SAM
, sr_Latn_CS
.getLanguageType() );
123 CPPUNIT_ASSERT( sr_Latn_CS
.isValidBcp47() );
124 CPPUNIT_ASSERT( !sr_Latn_CS
.isIsoLocale() );
125 CPPUNIT_ASSERT( sr_Latn_CS
.isIsoODF() );
126 CPPUNIT_ASSERT_EQUAL( OUString("sr"), sr_Latn_CS
.getLanguage() );
127 CPPUNIT_ASSERT_EQUAL( OUString("CS"), sr_Latn_CS
.getCountry() );
128 CPPUNIT_ASSERT_EQUAL( OUString("Latn"), sr_Latn_CS
.getScript() );
129 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sr_Latn_CS
.getLanguageAndScript() );
130 ::std::vector
< OUString
> sr_Latn_CS_Fallbacks( sr_Latn_CS
.getFallbackStrings( true));
131 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(9), sr_Latn_CS_Fallbacks
.size());
132 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-CS"), sr_Latn_CS_Fallbacks
[0]);
133 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-YU"), sr_Latn_CS_Fallbacks
[1]);
134 CPPUNIT_ASSERT_EQUAL( OUString("sh-CS"), sr_Latn_CS_Fallbacks
[2]);
135 CPPUNIT_ASSERT_EQUAL( OUString("sh-YU"), sr_Latn_CS_Fallbacks
[3]);
136 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sr_Latn_CS_Fallbacks
[4]);
137 CPPUNIT_ASSERT_EQUAL( OUString("sh"), sr_Latn_CS_Fallbacks
[5]);
138 CPPUNIT_ASSERT_EQUAL( OUString("sr-CS"), sr_Latn_CS_Fallbacks
[6]);
139 CPPUNIT_ASSERT_EQUAL( OUString("sr-YU"), sr_Latn_CS_Fallbacks
[7]);
140 CPPUNIT_ASSERT_EQUAL( OUString("sr"), sr_Latn_CS_Fallbacks
[8]);
141 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-CS"), sr_Latn_CS
.makeFallback().getBcp47());
144 // 'sh-RS' has an internal override to 'sr-Latn-RS'
146 LanguageTag
sh_RS( "sh-RS", true );
147 lang::Locale aLocale
= sh_RS
.getLocale();
148 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS
.getBcp47() );
149 CPPUNIT_ASSERT_EQUAL( OUString(I18NLANGTAG_QLT
) , aLocale
.Language
);
150 CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale
.Country
);
151 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), aLocale
.Variant
);
152 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA
, sh_RS
.getLanguageType() );
153 CPPUNIT_ASSERT( sh_RS
.isValidBcp47() );
154 CPPUNIT_ASSERT( !sh_RS
.isIsoLocale() );
155 CPPUNIT_ASSERT( sh_RS
.isIsoODF() );
156 CPPUNIT_ASSERT_EQUAL( OUString("sr"), sh_RS
.getLanguage() );
157 CPPUNIT_ASSERT_EQUAL( OUString("RS"), sh_RS
.getCountry() );
158 CPPUNIT_ASSERT_EQUAL( OUString("Latn"), sh_RS
.getScript() );
159 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sh_RS
.getLanguageAndScript() );
160 ::std::vector
< OUString
> sh_RS_Fallbacks( sh_RS
.getFallbackStrings( true));
161 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(6), sh_RS_Fallbacks
.size());
162 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS_Fallbacks
[0]);
163 CPPUNIT_ASSERT_EQUAL( OUString("sh-RS"), sh_RS_Fallbacks
[1]);
164 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn"), sh_RS_Fallbacks
[2]);
165 CPPUNIT_ASSERT_EQUAL( OUString("sh"), sh_RS_Fallbacks
[3]);
166 CPPUNIT_ASSERT_EQUAL( OUString("sr-RS"), sh_RS_Fallbacks
[4]);
167 CPPUNIT_ASSERT_EQUAL( OUString("sr"), sh_RS_Fallbacks
[5]);
168 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS
.makeFallback().getBcp47());
169 CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS
.getBcp47());
170 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA
, sh_RS
.getLanguageType() );
173 // 'bs-Latn-BA' with 'Latn' suppress-script, we map that ourselves for a
174 // known LangID with an override and canonicalization should work the same
175 // without liblangtag.
177 LanguageTag
bs_Latn_BA( "bs-Latn-BA", true );
178 lang::Locale aLocale
= bs_Latn_BA
.getLocale();
179 CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA
.getBcp47() );
180 CPPUNIT_ASSERT_EQUAL( OUString("bs"), aLocale
.Language
);
181 CPPUNIT_ASSERT_EQUAL( OUString("BA"), aLocale
.Country
);
182 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
183 CPPUNIT_ASSERT_EQUAL( LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA
, bs_Latn_BA
.getLanguageType() );
184 CPPUNIT_ASSERT( bs_Latn_BA
.isValidBcp47() );
185 CPPUNIT_ASSERT( bs_Latn_BA
.isIsoLocale() );
186 CPPUNIT_ASSERT( bs_Latn_BA
.isIsoODF() );
187 CPPUNIT_ASSERT_EQUAL( OUString("bs"), bs_Latn_BA
.getLanguage() );
188 CPPUNIT_ASSERT_EQUAL( OUString("BA"), bs_Latn_BA
.getCountry() );
189 CPPUNIT_ASSERT( bs_Latn_BA
.getScript().isEmpty() );
190 CPPUNIT_ASSERT_EQUAL( OUString("bs"), bs_Latn_BA
.getLanguageAndScript() );
191 ::std::vector
< OUString
> bs_Latn_BA_Fallbacks( bs_Latn_BA
.getFallbackStrings( true));
192 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), bs_Latn_BA_Fallbacks
.size());
193 CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA_Fallbacks
[0]);
194 CPPUNIT_ASSERT_EQUAL( OUString("bs"), bs_Latn_BA_Fallbacks
[1]);
195 CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA
.makeFallback().getBcp47());
196 CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA
.getBcp47());
197 CPPUNIT_ASSERT_EQUAL( LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA
, bs_Latn_BA
.getLanguageType() );
201 OUString
s_ca_ES_valencia( "ca-ES-valencia" );
202 LanguageTag
ca_ES_valencia( s_ca_ES_valencia
, true );
203 lang::Locale aLocale
= ca_ES_valencia
.getLocale();
204 CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia
, ca_ES_valencia
.getBcp47() );
205 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
206 CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale
.Country
);
207 CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia
, aLocale
.Variant
);
208 CPPUNIT_ASSERT_EQUAL( LANGUAGE_CATALAN_VALENCIAN
, ca_ES_valencia
.getLanguageType() );
209 CPPUNIT_ASSERT( ca_ES_valencia
.isValidBcp47() );
210 CPPUNIT_ASSERT( !ca_ES_valencia
.isIsoLocale() );
211 CPPUNIT_ASSERT( !ca_ES_valencia
.isIsoODF() );
212 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_ES_valencia
.getLanguage() );
213 CPPUNIT_ASSERT_EQUAL( OUString("ES"), ca_ES_valencia
.getCountry() );
214 CPPUNIT_ASSERT( ca_ES_valencia
.getScript().isEmpty() );
215 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_ES_valencia
.getLanguageAndScript() );
216 ::std::vector
< OUString
> ca_ES_valencia_Fallbacks( ca_ES_valencia
.getFallbackStrings( true));
217 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(5), ca_ES_valencia_Fallbacks
.size());
218 CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_ES_valencia_Fallbacks
[0]);
219 CPPUNIT_ASSERT_EQUAL( OUString("ca-XV"), ca_ES_valencia_Fallbacks
[1]);
220 CPPUNIT_ASSERT_EQUAL( OUString("ca-valencia"), ca_ES_valencia_Fallbacks
[2]);
221 CPPUNIT_ASSERT_EQUAL( OUString("ca-ES"), ca_ES_valencia_Fallbacks
[3]);
222 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_ES_valencia_Fallbacks
[4]);
223 CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_ES_valencia
.makeFallback().getBcp47());
227 OUString
s_ca_valencia( "ca-valencia" );
228 LanguageTag
ca_valencia( s_ca_valencia
, true );
229 lang::Locale aLocale
= ca_valencia
.getLocale();
230 CPPUNIT_ASSERT_EQUAL( s_ca_valencia
, ca_valencia
.getBcp47() );
231 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
232 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
233 CPPUNIT_ASSERT_EQUAL( s_ca_valencia
, aLocale
.Variant
);
234 CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( ca_valencia
.getLanguageType()) );
235 CPPUNIT_ASSERT( ca_valencia
.isValidBcp47() );
236 CPPUNIT_ASSERT( !ca_valencia
.isIsoLocale() );
237 CPPUNIT_ASSERT( !ca_valencia
.isIsoODF() );
238 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_valencia
.getLanguage() );
239 CPPUNIT_ASSERT( ca_valencia
.getCountry().isEmpty() );
240 CPPUNIT_ASSERT( ca_valencia
.getScript().isEmpty() );
241 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_valencia
.getLanguageAndScript() );
242 ::std::vector
< OUString
> ca_valencia_Fallbacks( ca_valencia
.getFallbackStrings( true));
243 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), ca_valencia_Fallbacks
.size());
244 CPPUNIT_ASSERT_EQUAL( OUString("ca-valencia"), ca_valencia_Fallbacks
[0]);
245 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_valencia_Fallbacks
[1]);
246 CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_valencia
.makeFallback().getBcp47());
249 // 'ca-XV' has an internal override to 'ca-ES-valencia'
251 OUString
s_ca_ES_valencia( "ca-ES-valencia" );
252 LanguageTag
ca_XV( "ca-XV", true );
253 lang::Locale aLocale
= ca_XV
.getLocale();
254 CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia
, ca_XV
.getBcp47() );
255 CPPUNIT_ASSERT_EQUAL( OUString(I18NLANGTAG_QLT
) , aLocale
.Language
);
256 CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale
.Country
);
257 CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia
, aLocale
.Variant
);
258 CPPUNIT_ASSERT_EQUAL( LANGUAGE_CATALAN_VALENCIAN
, ca_XV
.getLanguageType() );
259 CPPUNIT_ASSERT( ca_XV
.isValidBcp47() );
260 CPPUNIT_ASSERT( !ca_XV
.isIsoLocale() );
261 CPPUNIT_ASSERT( !ca_XV
.isIsoODF() );
262 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_XV
.getLanguage() );
263 CPPUNIT_ASSERT_EQUAL( OUString("ES"), ca_XV
.getCountry() );
264 CPPUNIT_ASSERT( ca_XV
.getScript().isEmpty() );
265 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_XV
.getLanguageAndScript() );
266 ::std::vector
< OUString
> ca_XV_Fallbacks( ca_XV
.getFallbackStrings( true));
267 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(5), ca_XV_Fallbacks
.size());
268 CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_XV_Fallbacks
[0]);
269 CPPUNIT_ASSERT_EQUAL( OUString("ca-XV"), ca_XV_Fallbacks
[1]);
270 CPPUNIT_ASSERT_EQUAL( OUString("ca-valencia"), ca_XV_Fallbacks
[2]);
271 CPPUNIT_ASSERT_EQUAL( OUString("ca-ES"), ca_XV_Fallbacks
[3]);
272 CPPUNIT_ASSERT_EQUAL( OUString("ca"), ca_XV_Fallbacks
[4]);
273 CPPUNIT_ASSERT_EQUAL( OUString("ca-ES-valencia"), ca_XV
.makeFallback().getBcp47());
277 OUString
s_de_DE( "de-DE" );
278 LanguageTag
de_DE( s_de_DE
, true );
279 lang::Locale aLocale
= de_DE
.getLocale();
280 CPPUNIT_ASSERT_EQUAL( s_de_DE
, de_DE
.getBcp47() );
281 CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale
.Language
);
282 CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale
.Country
);
283 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
284 CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN
, de_DE
.getLanguageType() );
285 CPPUNIT_ASSERT( de_DE
.isValidBcp47() );
286 CPPUNIT_ASSERT( de_DE
.isIsoLocale() );
287 CPPUNIT_ASSERT( de_DE
.isIsoODF() );
288 CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE
.getLanguage() );
289 CPPUNIT_ASSERT_EQUAL( OUString("DE"), de_DE
.getCountry() );
290 CPPUNIT_ASSERT( de_DE
.getScript().isEmpty() );
291 CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE
.getLanguageAndScript() );
292 ::std::vector
< OUString
> de_DE_Fallbacks( de_DE
.getFallbackStrings( true));
293 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), de_DE_Fallbacks
.size());
294 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE_Fallbacks
[0]);
295 CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE_Fallbacks
[1]);
296 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE
.makeFallback().getBcp47());
300 LanguageTag
de_DE( lang::Locale( "de", "DE", "" ) );
301 lang::Locale aLocale
= de_DE
.getLocale();
302 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE
.getBcp47() );
303 CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale
.Language
);
304 CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale
.Country
);
305 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
306 CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN
, de_DE
.getLanguageType() );
310 LanguageTag
de_DE( LANGUAGE_GERMAN
);
311 lang::Locale aLocale
= de_DE
.getLocale();
312 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de_DE
.getBcp47() );
313 CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale
.Language
);
314 CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale
.Country
);
315 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
316 CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN
, de_DE
.getLanguageType() );
319 // Unmapped but known language-only.
321 OUString
s_de( "de" );
322 LanguageTag
de( s_de
, true );
323 lang::Locale aLocale
= de
.getLocale();
324 CPPUNIT_ASSERT_EQUAL( s_de
, de
.getBcp47() );
325 CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale
.Language
);
326 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
327 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
328 LanguageType de_LangID
= de
.getLanguageType();
329 CPPUNIT_ASSERT( de_LangID
!= LANGUAGE_GERMAN
);
330 CPPUNIT_ASSERT_EQUAL( MsLangId::getPrimaryLanguage( LANGUAGE_GERMAN
) , de_LangID
);
331 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), de
.makeFallback().getBcp47());
332 // Check registered mapping.
333 LanguageTag
de_l( de_LangID
);
334 CPPUNIT_ASSERT_EQUAL( s_de
, de_l
.getBcp47() );
337 // "bo" and "dz" share the same primary language ID, only one gets it
338 // assigned, "dz" language-only has a special mapping.
340 LanguageTag
bo( "bo", true );
341 CPPUNIT_ASSERT_EQUAL( MsLangId::getPrimaryLanguage( LANGUAGE_TIBETAN
), bo
.getLanguageType() );
342 LanguageTag
dz( "dz", true );
343 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_DZONGKHA_MAP_LONLY
, dz
.getLanguageType() );
346 // "no", "nb" and "nn" share the same primary language ID, which even is
347 // assigned to "no-NO" for legacy so none gets it assigned, all on-the-fly
348 // except if there is a defined MS-LCID for LanguageScriptOnly (LSO).
350 LanguageTag
no( "no", true );
351 CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( no
.getLanguageType()) );
352 LanguageTag
nb( "nb", true );
353 CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN_BOKMAL_LSO
, nb
.getLanguageType() );
354 LanguageTag
nn( "nn", true );
355 CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN_NYNORSK_LSO
, nn
.getLanguageType() );
356 LanguageTag
no_NO( "no-NO", true );
357 CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN
, no_NO
.getLanguageType() );
360 // 'de-1901' derived from 'de-DE-1901' grandfathered to check that it is
361 // accepted as (DIGIT 3ALNUM) variant
363 OUString
s_de_1901( "de-1901" );
364 LanguageTag
de_1901( s_de_1901
);
365 lang::Locale aLocale
= de_1901
.getLocale();
366 CPPUNIT_ASSERT_EQUAL( s_de_1901
, de_1901
.getBcp47() );
367 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
368 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
369 CPPUNIT_ASSERT_EQUAL( s_de_1901
, aLocale
.Variant
);
370 CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( de_1901
.getLanguageType()) );
371 CPPUNIT_ASSERT( de_1901
.isValidBcp47() );
372 CPPUNIT_ASSERT( !de_1901
.isIsoLocale() );
373 CPPUNIT_ASSERT( !de_1901
.isIsoODF() );
374 CPPUNIT_ASSERT_EQUAL( OUString("de"), de_1901
.getLanguageAndScript() );
375 CPPUNIT_ASSERT_EQUAL( OUString("1901"), de_1901
.getVariants() );
376 ::std::vector
< OUString
> de_1901_Fallbacks( de_1901
.getFallbackStrings( true));
377 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), de_1901_Fallbacks
.size());
378 CPPUNIT_ASSERT_EQUAL( OUString("de-1901"), de_1901_Fallbacks
[0]);
379 CPPUNIT_ASSERT_EQUAL( OUString("de"), de_1901_Fallbacks
[1]);
382 // 'en-GB-oed' is known grandfathered for English, Oxford English
383 // Dictionary spelling.
384 // Deprecated as of 2015-04-17, prefer en-GB-oxendict instead.
385 // As of 2017-03-14 we also alias to en-GB-oxendict.
387 OUString
s_en_GB_oxendict( "en-GB-oxendict" );
388 LanguageTag
en_GB_oed( "en-GB-oed" );
389 lang::Locale aLocale
= en_GB_oed
.getLocale();
390 CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict
, en_GB_oed
.getBcp47() );
391 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
392 CPPUNIT_ASSERT_EQUAL( OUString("GB"), aLocale
.Country
);
393 CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict
, aLocale
.Variant
);
394 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_ENGLISH_UK_OXENDICT
, en_GB_oed
.getLanguageType() );
395 CPPUNIT_ASSERT( en_GB_oed
.isValidBcp47() );
396 CPPUNIT_ASSERT( !en_GB_oed
.isIsoLocale() );
397 CPPUNIT_ASSERT( !en_GB_oed
.isIsoODF() );
398 CPPUNIT_ASSERT_EQUAL( OUString("en"), en_GB_oed
.getLanguageAndScript() );
399 CPPUNIT_ASSERT_EQUAL( OUString("oxendict"), en_GB_oed
.getVariants() );
400 ::std::vector
< OUString
> en_GB_oed_Fallbacks( en_GB_oed
.getFallbackStrings( true));
401 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(5), en_GB_oed_Fallbacks
.size() );
402 CPPUNIT_ASSERT_EQUAL( OUString("en-GB-oxendict"), en_GB_oed_Fallbacks
[0]);
403 CPPUNIT_ASSERT_EQUAL( OUString("en-GB-oed"), en_GB_oed_Fallbacks
[1]);
404 CPPUNIT_ASSERT_EQUAL( OUString("en-oxendict"), en_GB_oed_Fallbacks
[2]);
405 CPPUNIT_ASSERT_EQUAL( OUString("en-GB"), en_GB_oed_Fallbacks
[3]);
406 CPPUNIT_ASSERT_EQUAL( OUString("en"), en_GB_oed_Fallbacks
[4]);
407 // 'en-oed' is not a valid fallback!
410 // 'en-GB-oxendict' as preferred over 'en-GB-oed'.
412 OUString
s_en_GB_oxendict( "en-GB-oxendict" );
413 LanguageTag
en_GB_oxendict( s_en_GB_oxendict
);
414 lang::Locale aLocale
= en_GB_oxendict
.getLocale();
415 CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict
, en_GB_oxendict
.getBcp47() );
416 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
417 CPPUNIT_ASSERT_EQUAL( OUString("GB"), aLocale
.Country
);
418 CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict
, aLocale
.Variant
);
419 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_ENGLISH_UK_OXENDICT
, en_GB_oxendict
.getLanguageType() );
420 CPPUNIT_ASSERT( en_GB_oxendict
.isValidBcp47() );
421 CPPUNIT_ASSERT( !en_GB_oxendict
.isIsoLocale() );
422 CPPUNIT_ASSERT( !en_GB_oxendict
.isIsoODF() );
423 CPPUNIT_ASSERT_EQUAL( OUString("en"), en_GB_oxendict
.getLanguageAndScript() );
424 CPPUNIT_ASSERT_EQUAL( OUString("oxendict"), en_GB_oxendict
.getVariants() );
425 ::std::vector
< OUString
> en_GB_oxendict_Fallbacks( en_GB_oxendict
.getFallbackStrings( true));
426 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(5), en_GB_oxendict_Fallbacks
.size() );
427 CPPUNIT_ASSERT_EQUAL( OUString("en-GB-oxendict"), en_GB_oxendict_Fallbacks
[0]);
428 CPPUNIT_ASSERT_EQUAL( OUString("en-GB-oed"), en_GB_oxendict_Fallbacks
[1]);
429 CPPUNIT_ASSERT_EQUAL( OUString("en-oxendict"), en_GB_oxendict_Fallbacks
[2]);
430 CPPUNIT_ASSERT_EQUAL( OUString("en-GB"), en_GB_oxendict_Fallbacks
[3]);
431 CPPUNIT_ASSERT_EQUAL( OUString("en"), en_GB_oxendict_Fallbacks
[4]);
434 // 'es-ES-u-co-trad' is a valid (and known) Extension U tag
436 OUString
s_es_ES_u_co_trad( "es-ES-u-co-trad" );
437 LanguageTag
es_ES_u_co_trad( s_es_ES_u_co_trad
);
438 lang::Locale aLocale
= es_ES_u_co_trad
.getLocale();
439 CPPUNIT_ASSERT_EQUAL( s_es_ES_u_co_trad
, es_ES_u_co_trad
.getBcp47() );
440 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
441 CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale
.Country
);
442 CPPUNIT_ASSERT_EQUAL( s_es_ES_u_co_trad
, aLocale
.Variant
);
443 CPPUNIT_ASSERT_EQUAL( LANGUAGE_SPANISH_DATED
, es_ES_u_co_trad
.getLanguageType() );
444 CPPUNIT_ASSERT( es_ES_u_co_trad
.isValidBcp47() );
445 CPPUNIT_ASSERT( !es_ES_u_co_trad
.isIsoLocale() );
446 CPPUNIT_ASSERT( !es_ES_u_co_trad
.isIsoODF() );
447 CPPUNIT_ASSERT_EQUAL( OUString("es"), es_ES_u_co_trad
.getLanguageAndScript() );
448 CPPUNIT_ASSERT_EQUAL( OUString("u-co-trad"), es_ES_u_co_trad
.getVariants() );
449 ::std::vector
< OUString
> es_ES_u_co_trad_Fallbacks( es_ES_u_co_trad
.getFallbackStrings( true));
450 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(4), es_ES_u_co_trad_Fallbacks
.size() );
451 CPPUNIT_ASSERT_EQUAL( OUString("es-ES-u-co-trad"), es_ES_u_co_trad_Fallbacks
[0]);
452 CPPUNIT_ASSERT_EQUAL( OUString("es-u-co-trad"), es_ES_u_co_trad_Fallbacks
[1]);
453 CPPUNIT_ASSERT_EQUAL( OUString("es-ES"), es_ES_u_co_trad_Fallbacks
[2]);
454 CPPUNIT_ASSERT_EQUAL( OUString("es"), es_ES_u_co_trad_Fallbacks
[3]);
456 CPPUNIT_ASSERT_EQUAL( OUString("es-ES_tradnl"), es_ES_u_co_trad
.getBcp47MS() );
459 // 'es-ES_tradnl' (broken MS) maps to 'es-ES-u-co-trad'
461 OUString
s_es_ES_u_co_trad( "es-ES-u-co-trad" );
462 OUString
s_es_ES_tradnl( "es-ES_tradnl" );
463 LanguageTag
es_ES_tradnl( s_es_ES_tradnl
);
464 lang::Locale aLocale
= es_ES_tradnl
.getLocale();
465 CPPUNIT_ASSERT_EQUAL( s_es_ES_u_co_trad
, es_ES_tradnl
.getBcp47() );
466 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
467 CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale
.Country
);
468 CPPUNIT_ASSERT_EQUAL( s_es_ES_u_co_trad
, aLocale
.Variant
);
469 CPPUNIT_ASSERT_EQUAL( LANGUAGE_SPANISH_DATED
, es_ES_tradnl
.getLanguageType() );
470 CPPUNIT_ASSERT( es_ES_tradnl
.isValidBcp47() );
471 CPPUNIT_ASSERT( !es_ES_tradnl
.isIsoLocale() );
472 CPPUNIT_ASSERT( !es_ES_tradnl
.isIsoODF() );
473 CPPUNIT_ASSERT_EQUAL( OUString("es"), es_ES_tradnl
.getLanguageAndScript() );
474 CPPUNIT_ASSERT_EQUAL( OUString("u-co-trad"), es_ES_tradnl
.getVariants() );
475 ::std::vector
< OUString
> es_ES_tradnl_Fallbacks( es_ES_tradnl
.getFallbackStrings( true));
476 CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(4), es_ES_tradnl_Fallbacks
.size() );
477 CPPUNIT_ASSERT_EQUAL( OUString("es-ES-u-co-trad"), es_ES_tradnl_Fallbacks
[0]);
478 CPPUNIT_ASSERT_EQUAL( OUString("es-u-co-trad"), es_ES_tradnl_Fallbacks
[1]);
479 CPPUNIT_ASSERT_EQUAL( OUString("es-ES"), es_ES_tradnl_Fallbacks
[2]);
480 CPPUNIT_ASSERT_EQUAL( OUString("es"), es_ES_tradnl_Fallbacks
[3]);
481 // Map back to broken MS.
482 CPPUNIT_ASSERT_EQUAL( s_es_ES_tradnl
, es_ES_tradnl
.getBcp47MS() );
485 // 'zh-yue-HK' uses redundant 'zh-yue' and should be preferred 'yue-HK'
487 /* XXX Disabled because liblangtag in lt_tag_canonicalize() after replacing
488 * 'zh-yue' with the preferred 'yue' does:
489 * "If the language tag starts with a primary language subtag that is also
490 * an extlang subtag, then the language tag is prepended with the extlang's
492 * Primary language 'yue' is also extlang 'yue' for which the prefix
493 * happens to be 'zh' ... so the result is 'zh-yue-HK' again. */
495 OUString
s_zh_yue_HK( "zh-yue-HK" );
496 LanguageTag
zh_yue_HK( s_zh_yue_HK
);
497 lang::Locale aLocale
= zh_yue_HK
.getLocale();
498 CPPUNIT_ASSERT( zh_yue_HK
.getBcp47() == "yue-HK" );
499 CPPUNIT_ASSERT( aLocale
.Language
== "yue" );
500 CPPUNIT_ASSERT( aLocale
.Country
== "HK" );
501 CPPUNIT_ASSERT( aLocale
.Variant
== "" );
502 CPPUNIT_ASSERT( zh_yue_HK
.getLanguageType() == LANGUAGE_YUE_CHINESE_HONGKONG
);
503 CPPUNIT_ASSERT( zh_yue_HK
.isValidBcp47() == true );
504 CPPUNIT_ASSERT( zh_yue_HK
.isIsoLocale() == true );
505 CPPUNIT_ASSERT( zh_yue_HK
.isIsoODF() == true );
506 CPPUNIT_ASSERT( zh_yue_HK
.getLanguageAndScript() == "yue" );
507 CPPUNIT_ASSERT( zh_yue_HK
.getVariants() == "" );
508 ::std::vector
< OUString
> zh_yue_HK_Fallbacks( zh_yue_HK
.getFallbackStrings( true));
509 CPPUNIT_ASSERT( zh_yue_HK_Fallbacks
.size() == 2);
510 CPPUNIT_ASSERT( zh_yue_HK_Fallbacks
[0] == "yue-HK");
511 CPPUNIT_ASSERT( zh_yue_HK_Fallbacks
[1] == "yue");
515 // 'qtz' is a local use known pseudolocale for key ID resource
517 OUString
s_qtz( "qtz" );
518 LanguageTag
qtz( s_qtz
);
519 lang::Locale aLocale
= qtz
.getLocale();
520 CPPUNIT_ASSERT_EQUAL( s_qtz
, qtz
.getBcp47() );
521 CPPUNIT_ASSERT_EQUAL( OUString("qtz"), aLocale
.Language
);
522 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
523 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
524 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_KEYID
, qtz
.getLanguageType() );
527 // 'qty' is a local use unknown locale
529 OUString
s_qty( "qty" );
530 LanguageTag
qty( s_qty
);
531 lang::Locale aLocale
= qty
.getLocale();
532 CPPUNIT_ASSERT_EQUAL( s_qty
, qty
.getBcp47() );
533 CPPUNIT_ASSERT_EQUAL( OUString("qty"), aLocale
.Language
);
534 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
535 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
536 CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( qty
.getLanguageType()) );
539 // 'qtx' is an unknown new mslangid
541 LanguageTag
qtx( "qtx" );
542 qtx
.setScriptType( LanguageTag::ScriptType::RTL
);
543 LanguageType n_qtx
= qtx
.getLanguageType();
544 CPPUNIT_ASSERT_EQUAL( css::i18n::ScriptType::COMPLEX
, MsLangId::getScriptType(n_qtx
) );
545 CPPUNIT_ASSERT( MsLangId::isRightToLeft(n_qtx
) );
546 CPPUNIT_ASSERT( !MsLangId::isCJK(n_qtx
) );
549 // 'x-comment' is a privateuse known "locale"
551 OUString
s_xcomment( "x-comment" );
552 LanguageTag
xcomment( s_xcomment
);
553 lang::Locale aLocale
= xcomment
.getLocale();
554 CPPUNIT_ASSERT_EQUAL( s_xcomment
, xcomment
.getBcp47() );
555 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
556 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
557 CPPUNIT_ASSERT_EQUAL( OUString("x-comment"), aLocale
.Variant
);
558 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_COMMENT
, xcomment
.getLanguageType() );
561 // 'x-foobar' is a privateuse unknown "locale"
563 OUString
s_xfoobar( "x-foobar" );
564 LanguageTag
xfoobar( s_xfoobar
);
565 lang::Locale aLocale
= xfoobar
.getLocale();
566 CPPUNIT_ASSERT_EQUAL( s_xfoobar
, xfoobar
.getBcp47() );
567 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
568 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
569 CPPUNIT_ASSERT_EQUAL( OUString("x-foobar"), aLocale
.Variant
);
570 CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( xfoobar
.getLanguageType()) );
573 // '*' the dreaded jolly joker is a "privateuse" known "locale"
575 OUString
s_joker( "*" );
576 LanguageTag
joker( s_joker
);
577 lang::Locale aLocale
= joker
.getLocale();
578 CPPUNIT_ASSERT_EQUAL( s_joker
, joker
.getBcp47() );
579 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
580 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
581 CPPUNIT_ASSERT_EQUAL( OUString("*"), aLocale
.Variant
);
582 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_JOKER
, joker
.getLanguageType() );
584 joker
.reset( LANGUAGE_USER_PRIV_JOKER
);
585 aLocale
= joker
.getLocale();
586 CPPUNIT_ASSERT_EQUAL( s_joker
, joker
.getBcp47() );
587 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
588 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
589 CPPUNIT_ASSERT_EQUAL( OUString("*"), aLocale
.Variant
);
590 CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_JOKER
, joker
.getLanguageType() );
593 // 'C' locale shall map to 'en-US'
595 LanguageTag
aTag( "C" );
596 CPPUNIT_ASSERT_EQUAL( OUString("en"), aTag
.getLanguage() );
597 CPPUNIT_ASSERT_EQUAL( OUString("US"), aTag
.getCountry() );
598 lang::Locale aLocale
= aTag
.getLocale();
599 CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aTag
.getBcp47() );
600 CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale
.Language
);
601 CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale
.Country
);
602 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
603 CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US
, aTag
.getLanguageType() );
606 LanguageTag
aTag( lang::Locale("C","","") );
607 CPPUNIT_ASSERT_EQUAL( OUString("en"), aTag
.getLanguage() );
608 CPPUNIT_ASSERT_EQUAL( OUString("US"), aTag
.getCountry() );
609 lang::Locale aLocale
= aTag
.getLocale();
610 CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aTag
.getBcp47() );
611 CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale
.Language
);
612 CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale
.Country
);
613 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
614 CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US
, aTag
.getLanguageType() );
617 // test reset() methods
619 LanguageTag
aTag( LANGUAGE_DONTKNOW
);
620 lang::Locale aLocale
;
622 aTag
.reset( LANGUAGE_GERMAN
);
623 aLocale
= aTag
.getLocale();
624 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), aTag
.getBcp47() );
625 CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale
.Language
);
626 CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale
.Country
);
627 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
628 CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN
, aTag
.getLanguageType() );
630 aTag
.reset( "en-US" );
631 aLocale
= aTag
.getLocale();
632 CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aTag
.getBcp47() );
633 CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale
.Language
);
634 CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale
.Country
);
635 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
636 CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US
, aTag
.getLanguageType() );
638 aTag
.reset( lang::Locale( "de", "DE", "" ) );
639 aLocale
= aTag
.getLocale();
640 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), aTag
.getBcp47() );
641 CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale
.Language
);
642 CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale
.Country
);
643 CPPUNIT_ASSERT( aLocale
.Variant
.isEmpty() );
644 CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN
, aTag
.getLanguageType() );
648 OUString
s_uab( "unreg-and-bad" );
649 LanguageTag
uab( s_uab
, true );
650 lang::Locale aLocale
= uab
.getLocale();
651 CPPUNIT_ASSERT_EQUAL( s_uab
, uab
.getBcp47() );
652 CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale
.Language
);
653 CPPUNIT_ASSERT( aLocale
.Country
.isEmpty() );
654 CPPUNIT_ASSERT_EQUAL( s_uab
, aLocale
.Variant
);
655 CPPUNIT_ASSERT_EQUAL( LANGUAGE_DONTKNOW
, uab
.getLanguageType() );
656 CPPUNIT_ASSERT( !uab
.isValidBcp47() );
657 CPPUNIT_ASSERT( !uab
.isIsoLocale() );
658 CPPUNIT_ASSERT( !uab
.isIsoODF() );
661 // test static isValidBcp47() method
663 OUString aCanonicalized
;
664 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", &aCanonicalized
) );
665 CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aCanonicalized
);
666 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "x-foobar", &aCanonicalized
) );
667 CPPUNIT_ASSERT_EQUAL( OUString("x-foobar"), aCanonicalized
);
668 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", &aCanonicalized
) );
669 CPPUNIT_ASSERT_EQUAL( OUString("qaa"), aCanonicalized
);
670 CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "unreg-and-bad", &aCanonicalized
) );
671 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", &aCanonicalized
, LanguageTag::PrivateUse::DISALLOW
) );
672 CPPUNIT_ASSERT_EQUAL( OUString("en-US"), aCanonicalized
);
673 CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "x-foobar", &aCanonicalized
, LanguageTag::PrivateUse::DISALLOW
) );
674 CPPUNIT_ASSERT_EQUAL( OUString("x-foobar"), aCanonicalized
);
675 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", &aCanonicalized
, LanguageTag::PrivateUse::DISALLOW
) );
676 CPPUNIT_ASSERT_EQUAL( OUString("qaa"), aCanonicalized
);
677 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "de-Latn-DE", &aCanonicalized
) );
678 CPPUNIT_ASSERT_EQUAL( OUString("de-DE"), aCanonicalized
);
679 /* TODO: at least some (those we know) grandfathered tags should be
680 * recognized by the replacement code. */
681 CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-GB-oed", &aCanonicalized
) );
682 // en-GB-oed has become deprecated in updated language-subtag-registry database
683 // (liblangtag 0.5.7)
684 CPPUNIT_ASSERT( ( aCanonicalized
== "en-GB-oxendict" ) || ( aCanonicalized
== "en-GB-oed" ) );
688 bool checkMapping( std::u16string_view rStr1
, std::u16string_view rStr2
)
690 if (rStr1
== u
"la" ) return rStr2
== u
"la-VA";
691 if (rStr1
== u
"la-Latn" ) return rStr2
== u
"la-VA";
692 if (rStr1
== u
"tzm-Latn-DZ" ) return rStr2
== u
"kab-DZ";
693 if (rStr1
== u
"bs-Latn-BA" ) return rStr2
== u
"bs-BA";
694 if (rStr1
== u
"bs-Latn" ) return rStr2
== u
"bs";
695 if (rStr1
== u
"cz" ) return rStr2
== u
"cs-CZ";
696 if (rStr1
== u
"iw-IL" ) return rStr2
== u
"he-IL";
697 if (rStr1
== u
"in-ID" ) return rStr2
== u
"id-ID";
698 if (rStr1
== u
"sr-YU" ) return rStr2
== u
"sr-CS";
699 if (rStr1
== u
"sh-RS" ) return rStr2
== u
"sr-Latn-RS";
700 if (rStr1
== u
"sh-YU" ) return rStr2
== u
"sr-Latn-CS";
701 if (rStr1
== u
"sh-CS" ) return rStr2
== u
"sr-Latn-CS";
702 if (rStr1
== u
"sh-ME" ) return rStr2
== u
"sr-Latn-ME";
703 if (rStr1
== u
"sh-BA" ) return rStr2
== u
"sr-Latn-BA";
704 if (rStr1
== u
"sh" ) return rStr2
== u
"sr-Latn";
705 if (rStr1
== u
"lah-PK" ) return rStr2
== u
"pnb-Arab-PK";
706 if (rStr1
== u
"pa-PK" ) return rStr2
== u
"pnb-Arab-PK";
707 if (rStr1
== u
"ca-XV" ) return rStr2
== u
"ca-ES-valencia";
708 if (rStr1
== u
"qcv-ES" ) return rStr2
== u
"ca-ES-valencia";
709 if (rStr1
== u
"ns-ZA" ) return rStr2
== u
"nso-ZA";
710 if (rStr1
== u
"ven-ZA" ) return rStr2
== u
"ve-ZA";
711 if (rStr1
== u
"qu-EC" ) return rStr2
== u
"quz-EC";
712 if (rStr1
== u
"qu-PE" ) return rStr2
== u
"quz-PE";
713 if (rStr1
== u
"ff-Latn-NG" ) return rStr2
== u
"ff-NG";
714 if (rStr1
== u
"fuv-NG" ) return rStr2
== u
"ff-NG";
715 if (rStr1
== u
"ji-IL" ) return rStr2
== u
"yi-IL";
716 if (rStr1
== u
"iu-CA" ) return rStr2
== u
"iu-Latn-CA";
717 if (rStr1
== u
"iu" ) return rStr2
== u
"iu-Latn";
718 if (rStr1
== u
"gbz-AF" ) return rStr2
== u
"prs-AF";
719 if (rStr1
== u
"ber-DZ" ) return rStr2
== u
"kab-DZ";
720 if (rStr1
== u
"tmz-MA" ) return rStr2
== u
"tzm-Tfng-MA";
721 if (rStr1
== u
"ber-MA" ) return rStr2
== u
"tzm-Tfng-MA";
722 if (rStr1
== u
"mg-MG" ) return rStr2
== u
"plt-MG";
723 if (rStr1
== u
"pli" ) return rStr2
== u
"pi-Latn";
724 if (rStr1
== u
"ks" ) return rStr2
== u
"ks-Arab";
725 if (rStr1
== u
"ks-IN" ) return rStr2
== u
"ks-Deva-IN";
726 if (rStr1
== u
"chr-US" ) return rStr2
== u
"chr-Cher-US";
727 if (rStr1
== u
"sd-PK" ) return rStr2
== u
"sd-Arab-PK";
728 if (rStr1
== u
"sr-Cyrl-RS" ) return rStr2
== u
"sr-RS";
729 if (rStr1
== u
"sr-Cyrl-ME" ) return rStr2
== u
"sr-ME";
730 if (rStr1
== u
"sr-Cyrl-BA" ) return rStr2
== u
"sr-BA";
731 if (rStr1
== u
"sr-Cyrl-CS" ) return rStr2
== u
"sr-CS";
732 if (rStr1
== u
"sr-Cyrl" ) return rStr2
== u
"sr";
733 if (rStr1
== u
"yi-Hebr-US" ) return rStr2
== u
"yi-US";
734 if (rStr1
== u
"yi-Hebr-IL" ) return rStr2
== u
"yi-IL";
735 if (rStr1
== u
"ha-NG" ) return rStr2
== u
"ha-Latn-NG";
736 if (rStr1
== u
"ha-GH" ) return rStr2
== u
"ha-Latn-GH";
737 if (rStr1
== u
"ku-Arab-IQ" ) return rStr2
== u
"ckb-IQ";
738 if (rStr1
== u
"ku-Arab" ) return rStr2
== u
"ckb";
739 if (rStr1
== u
"kmr-TR" ) return rStr2
== u
"kmr-Latn-TR";
740 if (rStr1
== u
"ku-TR" ) return rStr2
== u
"kmr-Latn-TR";
741 if (rStr1
== u
"kmr-SY" ) return rStr2
== u
"kmr-Latn-SY";
742 if (rStr1
== u
"ku-SY" ) return rStr2
== u
"kmr-Latn-SY";
743 if (rStr1
== u
"ku-IQ" ) return rStr2
== u
"ckb-IQ";
744 if (rStr1
== u
"ku-IR" ) return rStr2
== u
"ckb-IR";
745 if (rStr1
== u
"eu" ) return rStr2
== u
"eu-ES";
746 if (rStr1
== u
"crk-Latn-CN" ) return rStr2
== u
"crk-Latn-CA";
747 if (rStr1
== u
"crk-Cans-CN" ) return rStr2
== u
"crk-Cans-CA";
748 if (rStr1
== u
"en-GB-oed" ) return rStr2
== u
"en-GB-oxendict";
749 if (rStr1
== u
"es-ES_tradnl") return rStr2
== u
"es-ES-u-co-trad";
750 if (rStr1
== u
"sd-IN" ) return rStr2
== u
"sd-Deva-IN";
751 if (rStr1
== u
"cmn-CN" ) return rStr2
== u
"zh-CN";
752 if (rStr1
== u
"cmn-TW" ) return rStr2
== u
"zh-TW";
753 if (rStr1
== u
"kw-UK" ) return rStr2
== u
"kw-GB";
754 if (rStr1
== u
"oc-FR" ) return rStr2
== u
"oc-FR-lengadoc";
755 if (rStr1
== u
"oc-ES" ) return rStr2
== u
"oc-ES-aranes";
756 if (rStr1
== u
"zh-Hans-CN" ) return rStr2
== u
"zh-CN";
757 if (rStr1
== u
"zh-Hant-TW" ) return rStr2
== u
"zh-TW";
758 if (rStr1
== u
"zh-Hans-SG" ) return rStr2
== u
"zh-SG";
759 if (rStr1
== u
"zh-Hant-HK" ) return rStr2
== u
"zh-HK";
760 if (rStr1
== u
"zh-Hant-MO" ) return rStr2
== u
"zh-MO";
761 return rStr1
== rStr2
;
764 void TestLanguageTag::testAllIsoLangEntries()
766 const ::std::vector
< MsLangId::LanguagetagMapping
> aList( MsLangId::getDefinedLanguagetags());
767 for (auto const& elem
: aList
)
770 if (elem
.maBcp47
== "la-VA")
774 LanguageTag
aTagString( elem
.maBcp47
, true);
775 LanguageTag
aTagID( elem
.mnLang
);
776 if (!checkMapping( elem
.maBcp47
, aTagString
.getBcp47()))
778 CPPUNIT_ASSERT_EQUAL_MESSAGE( "defined elem to tag", elem
.maBcp47
, aTagString
.getBcp47() );
780 if (elem
.maBcp47
!= aTagID
.getBcp47())
782 // There are multiple mappings, ID must be equal after conversions.
783 LanguageTag
aTagBack( aTagID
.getBcp47(), true);
784 if (aTagString
.getLanguageType() != aTagBack
.getLanguageType())
786 OString
aMessage( OUStringToOString( elem
.maBcp47
, RTL_TEXTENCODING_ASCII_US
));
787 aMessage
+= " " + OUStringToOString( aTagString
.getBcp47(), RTL_TEXTENCODING_ASCII_US
) + ": " +
788 OUStringToOString( aTagString
.getBcp47(), RTL_TEXTENCODING_ASCII_US
) + " " +
789 OString::number( static_cast<sal_uInt16
>(aTagString
.getLanguageType()), 16) +
790 " -> " + OUStringToOString( aTagBack
.getBcp47(), RTL_TEXTENCODING_ASCII_US
) + " " +
791 OString::number( static_cast<sal_uInt16
>(aTagBack
.getLanguageType()), 16);
792 CPPUNIT_ASSERT_EQUAL_MESSAGE( aMessage
.getStr(), aTagBack
.getLanguageType(), aTagString
.getLanguageType());
796 // This does not hold, there are cases like 'ar'
797 // LANGUAGE_ARABIC_PRIMARY_ONLY that when mapped back results in
798 // 'ar-SA' as default locale.
799 if (elem
.mnLang
!= aTagString
.getLanguageType())
801 // There are multiple mappings, string must be equal after conversions.
802 LanguageTag
aTagBack( aTagString
.getLanguageType());
803 if (aTagID
.getBcp47() != aTagBack
.getBcp47())
805 OString
aMessage( OUStringToOString( elem
.maBcp47
, RTL_TEXTENCODING_ASCII_US
));
806 aMessage
+= " " + OUStringToOString( aTagID
.getBcp47(), RTL_TEXTENCODING_ASCII_US
) +
807 " -> " + OUStringToOString( aTagBack
.getBcp47(), RTL_TEXTENCODING_ASCII_US
);
808 CPPUNIT_ASSERT_MESSAGE( aMessage
.getStr(), aTagID
.getBcp47() == aTagBack
.getBcp47());
814 // Uncommenting this makes the test break and output SAL_WARN/INFO
815 //CPPUNIT_ASSERT( true == false );
818 void TestLanguageTag::testDisplayNames()
821 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-US"), LanguageTag("en-US"));
822 CPPUNIT_ASSERT_EQUAL( OUString("English (United States)"), aStr
);
823 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-US"), LanguageTag("en"));
824 CPPUNIT_ASSERT_EQUAL( OUString("English (United States)"), aStr
);
825 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en"), LanguageTag("en"));
826 CPPUNIT_ASSERT_EQUAL( OUString("English"), aStr
);
828 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-US"), LanguageTag("de-DE"));
829 CPPUNIT_ASSERT_EQUAL( OUString("Englisch (Vereinigte Staaten)"), aStr
);
830 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-US"), LanguageTag("de"));
831 CPPUNIT_ASSERT_EQUAL( OUString("Englisch (Vereinigte Staaten)"), aStr
);
832 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en"), LanguageTag("de"));
833 CPPUNIT_ASSERT_EQUAL( OUString("Englisch"), aStr
);
835 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("de-DE"), LanguageTag("en"));
836 CPPUNIT_ASSERT_EQUAL( OUString("German (Germany)"), aStr
);
837 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("de"), LanguageTag("en"));
838 CPPUNIT_ASSERT_EQUAL( OUString("German"), aStr
);
839 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("de-DE-1901"), LanguageTag("en"));
840 CPPUNIT_ASSERT_EQUAL( OUString("German (Germany, Traditional German orthography)"), aStr
);
841 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("de-DE-1901"), LanguageTag("de-DE"));
842 CPPUNIT_ASSERT_EQUAL( OUString("Deutsch (Deutschland, Alte deutsche Rechtschreibung)"), aStr
);
844 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-GB"), LanguageTag("en"));
845 CPPUNIT_ASSERT_EQUAL( OUString("English (United Kingdom)"), aStr
);
846 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-GB-oxendict"), LanguageTag("en"));
847 CPPUNIT_ASSERT_EQUAL( OUString("English (United Kingdom, Oxford English Dictionary spelling)"), aStr
);
849 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("ca-ES-valencia"), LanguageTag("en"));
850 CPPUNIT_ASSERT_EQUAL( OUString("Catalan (Spain, Valencian)"), aStr
);
852 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("sr-Cyrl-RS"), LanguageTag("en"));
853 CPPUNIT_ASSERT_EQUAL( OUString("Serbian (Serbia)"), aStr
);
854 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("sr-Latn-RS"), LanguageTag("en"));
855 CPPUNIT_ASSERT_EQUAL( OUString("Serbian (Latin, Serbia)"), aStr
);
857 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("tlh"), LanguageTag("en"));
858 CPPUNIT_ASSERT_EQUAL( OUString("Klingon"), aStr
);
860 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("und"), LanguageTag("en"));
861 CPPUNIT_ASSERT_EQUAL( OUString("Unknown language"), aStr
);
863 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("zxx"), LanguageTag("en"));
864 CPPUNIT_ASSERT_EQUAL( OUString("No linguistic content"), aStr
);
866 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("x-lala"), LanguageTag("en"));
867 CPPUNIT_ASSERT_EQUAL( OUString("Unknown language (Private-Use=lala)"), aStr
);
868 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("x-lala"), LanguageTag("de"));
869 CPPUNIT_ASSERT_EQUAL( OUString("Unbekannte Sprache (Privatnutzung=lala)"), aStr
);
870 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-GB"), LanguageTag("x-lala"));
871 CPPUNIT_ASSERT_EQUAL( OUString("en (GB)"), aStr
);
872 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-GB-oxendict"), LanguageTag("x-lala"));
873 CPPUNIT_ASSERT_EQUAL( OUString("en (GB, OXENDICT)"), aStr
);
875 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("unreg-and-bad"), LanguageTag("en"));
876 CPPUNIT_ASSERT_EQUAL( OUString("unreg (Andorra, BAD)"), aStr
); // a tad of a surprise..
878 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("en-029"), LanguageTag("en"));
879 CPPUNIT_ASSERT_EQUAL( OUString("English (Caribbean)"), aStr
);
880 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("fr-015"), LanguageTag("en"));
881 CPPUNIT_ASSERT_EQUAL( OUString("French (Northern Africa)"), aStr
);
883 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("qtz"), LanguageTag("en"));
884 CPPUNIT_ASSERT_EQUAL( OUString("qtz"), aStr
);
886 aStr
= LanguageTagIcu::getDisplayName( LanguageTag("*"), LanguageTag("en"));
887 CPPUNIT_ASSERT_EQUAL( OUString("*"), aStr
);
890 void TestLanguageTag::testLanguagesWithoutHyphenation()
893 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_PRIMARY_ONLY
));
894 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_ALGERIA
));
895 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_BAHRAIN
));
896 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_EGYPT
));
897 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_IRAQ
));
898 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_JORDAN
));
899 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_KUWAIT
));
900 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_LEBANON
));
901 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_LIBYA
));
902 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_MOROCCO
));
903 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_OMAN
));
904 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_QATAR
));
905 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_SAUDI_ARABIA
));
906 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_SYRIA
));
907 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_TUNISIA
));
908 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_UAE
));
909 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_ARABIC_YEMEN
));
912 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_PASHTO
));
915 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_FARSI
));
918 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_KASHMIRI
));
919 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_KASHMIRI_INDIA
));
921 // Central Kurdish (Sorani), uses Arabic script, does not have hyphenation
922 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_KURDISH_ARABIC_IRAQ
));
923 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_KURDISH_ARABIC_LSO
));
925 // Northern Kurdish (Kurmanji) -> uses Latin script, has hyphenation
926 CPPUNIT_ASSERT(MsLangId::usesHyphenation(LANGUAGE_USER_KURDISH_SYRIA
));
927 CPPUNIT_ASSERT(MsLangId::usesHyphenation(LANGUAGE_USER_KURDISH_TURKEY
));
929 // Southern Kurdish -> uses Arabic script, does not have hyphenation
930 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_USER_KURDISH_SOUTHERN_IRAN
));
931 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ
));
934 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_PUNJABI
));
935 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_PUNJABI_ARABIC_LSO
));
936 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_PUNJABI_PAKISTAN
));
939 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_SINDHI
));
940 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_SINDHI_ARABIC_LSO
));
941 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_SINDHI_PAKISTAN
));
944 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_MALAY_BRUNEI_DARUSSALAM
));
945 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_MALAY_MALAYSIA
));
946 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_USER_MALAY_ARABIC_BRUNEI
));
947 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_USER_MALAY_ARABIC_MALAYSIA
));
950 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_SOMALI
));
953 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_SWAHILI
));
954 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_USER_SWAHILI_TANZANIA
));
957 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_URDU_INDIA
));
958 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_URDU_PAKISTAN
));
962 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE
));
963 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE_HONGKONG
));
964 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE_LSO
));
965 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE_MACAU
));
966 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE_SIMPLIFIED
));
967 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE_SIMPLIFIED_LEGACY
));
968 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE_SINGAPORE
));
969 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE_TRADITIONAL
));
970 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_CHINESE_TRADITIONAL_LSO
));
971 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_YUE_CHINESE_HONGKONG
));
973 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_JAPANESE
));
975 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_KOREAN
));
976 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_KOREAN_JOHAB
));
977 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_USER_KOREAN_NORTH
));
980 CPPUNIT_ASSERT(!MsLangId::usesHyphenation(LANGUAGE_VIETNAMESE
));
983 CPPUNIT_TEST_SUITE_REGISTRATION( TestLanguageTag
);
987 CPPUNIT_PLUGIN_IMPLEMENT();
989 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */