0N/A/*
3261N/A * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A/*
0N/A *
0N/A *
0N/A * (C) Copyright IBM Corp. 1998 - All Rights Reserved
0N/A *
0N/A * Portions copyright (c) 2007 Sun Microsystems, Inc.
0N/A * All Rights Reserved.
0N/A *
0N/A * The original version of this source code and documentation
0N/A * is copyrighted and owned by Taligent, Inc., a wholly-owned
0N/A * subsidiary of IBM. These materials are provided under terms
0N/A * of a License Agreement between Taligent and Sun. This technology
0N/A * is protected by multiple US and International patents.
0N/A *
0N/A * This notice and attribution to Taligent may not be removed.
0N/A * Taligent is a registered trademark of Taligent, Inc.
0N/A *
0N/A * Permission to use, copy, modify, and distribute this software
0N/A * and its documentation for NON-COMMERCIAL purposes and without
0N/A * fee is hereby granted provided that this copyright notice
0N/A * appears in all copies. Please refer to the file "copyright.html"
0N/A * for further important copyright and licensing information.
0N/A *
0N/A * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
0N/A * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
0N/A * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
0N/A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
0N/A * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
0N/A * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
0N/A *
0N/A */
0N/A/*
0N/A @bug 4123370 4091969 4118731 4182108 4778440
0N/A
0N/A The "at-test" tag was removed from this file, because there's no way to
0N/A run this test in an automated test harness. It depends on having various
0N/A different locales installed on the machine, and on Windows it depends
0N/A on the user going to the "Regional Settings" control panel and changing
0N/A the settings before running the test for each bug. We can run this test
0N/A manually from time to time to ensure that there has been no regression,
0N/A but it's not automated. -- lwerner, 7/6/98
0N/A
0N/A INSTRUCTIONS FOR RUNNING THIS TEST
0N/A ==================================
0N/A This test is designed to check for problems in the JVM code that initializes the
0N/A default Java locale (the locale returned by Locale.getDefault()) from the system
0N/A locale settings (or from command-line arguments). Since detecting a regression
0N/A usually requires setting the environment up in some way prior to running the test,
0N/A this is a manual test.
0N/A
0N/A The test simply prints out the internal ID and display name of the default Java locale,
0N/A and the name of the default Java character encoding. It passes if these are what
0N/A you expect them to be, and fails if they're not.
0N/A
0N/A Bug #4091969:
0N/A To test for bug #4091969, run this test on a Korean-localized version of
0N/A Windows, with the default locale set to Korean. You should get "ko_KR"
0N/A as the default locale.
0N/A
0N/A Bug #4123370:
0N/A One part of bug #4123370 duplicates bug #4091969, which is covered by the
0N/A instructions above.
0N/A
0N/A To test the unique part of bug #4123370, use the "Regional Settings" control
0N/A panel to set the currect locale to each of the different Spanish-language locales.
0N/A Run this test once for each Spanish-language locale. You should see the appropriate
0N/A locale ID and name for each locale. Both "Spanish - Traditional Sort" and
0N/A "Spanish - Modern Sort" should produce "es_ES" and "Spanish (Spain)".
0N/A
0N/A Bug #4118731:
0N/A The basic issue here was that we had changed so that calling getDisplayName()
0N/A on a locale that didn't include a country code no longer included a country
0N/A name (instead of picking a default country name, as before), which is the
0N/A right answer. The problem is we weren't always getting back a system default
0N/A locale from Solaris that includes a country code, even though we should.
0N/A
0N/A To test this, set the system default locale to a locale that doesn't include
0N/A a country code, such as "fr" or "de", using (in the C shell) "setenv LC_ALL fr"
0N/A (or whatever the locale ID you want is). Running PrintDefaultLocale should
0N/A still produce a locale ID, and a locale display name, that include a country
0N/A code (and country name). [Remember to make sure the locale is actually installed
0N/A first.]
0N/A
0N/A To test the specific complaint in the bug, use "setenv LC_ALL ja". Also pay
0N/A special attention to Solaris locale IDs that don't match the corresponding java
0N/A locales, such as "su" (which should turn into "fi_FI"), "cz" (which should turn
0N/A into "cs_CZ"), and "en_UK" (which should turn into "en_GB").
0N/A
0N/A Bug #4079167:
0N/A Test this bug the same way you test bug #4118731. Set the locale to each of
0N/A the specified locale IDs (e.g., "setenv LC_ALL japanese"), and then run
0N/A PrintDefaultLocale. You should get the following results:
0N/A Solaris ID Java ID Java display name Encoding
0N/A ========== ======= ==================== ========
0N/A japanese ja_JP Japanese (Japan) --
0N/A korean ko_KR Korean (South Korea) --
0N/A tchinese zh_TW Chinese (Taiwan) --
0N/A big5 zh_TW Chinese (Taiwan) Big5
0N/A (Where "--" is marked for "encoding," the result isn't important-- it's the
0N/A default encoding for that locale, which we don't test. It should be something
0N/A plausible. Also note that this test presupposed you actually have locales
0N/A with these names installed on your system.)
0N/A
0N/A Bug #4154559, 4778440:
0N/A Set the locale to Norwegian (Bokmal) and Norwegian (Nynorsk) using the
0N/A Regional Settings control panel on Windows. For each setting, run this program.
0N/A You should see no_NO and no_NO_NY, respectively.
0N/A
0N/A Bug #4182108:
0N/A Test this bug the same way you test bug #4118731. Set the locale to
0N/A each of the specified locale IDs (e.g., "setenv LC_ALL japanese"), and
0N/A then run PrintDefaultLocale. You should get the following results:
0N/A
0N/A Solaris ID Java ID Encoding
0N/A ========== ======= ========
0N/A cz cs_CZ --
0N/A su fi_FI --
0N/A fr.ISO8859-15 fr_FR ISO8859-15
0N/A fr.ISO8859-15@euro fr_FR ISO8859-15
0N/A
0N/A Where "--" is marked for "encoding," the result isn't important-- it's
0N/A the default encoding for that locale, which we don't test. It should be
0N/A something plausible. Also note that this test presupposed you actually
0N/A have locales with these names installed on your system.
0N/A
0N/A As of this writing, there is a bug in Solaris or in the 8859-15/euro
0N/A patch for 2.6 (Solaris patch 106842-01) which causes nl_langinfo() to
0N/A return the wrong value for 8859-15 locales. As a result, the encoding
0N/A returned by this test is currency ISO8859-1 for 8859-15 locales.
0N/A
0N/A Bug #4778440, 5005601, 5074060, 5107154:
0N/A Run the "deflocale" tool found in "data" directory (deflocale.sh on Unix,
0N/A deflocale.exe on Windows), and check the following:
0N/A
0N/A 4778440: Check that iw_IL is the default locale if the OS's locale is
0N/A Hebrew, and in_ID for Indonesian.
0N/A 5005601: For Norwegian locales, no_NO is selected for Bokmal, and no_NO_NY
0N/A is selected for Nynorsk.
0N/A 5074060, 5107154: On Windows XP ServicePack 2, check the default locales for the
0N/A following Windows locales. Compare with the golden data (deflocale.win):
0N/A Bengali - India
0N/A Croatian - Bosnia and Herzegovina
0N/A Bosnian - Bosnia and Herzegovina
0N/A Serbian (Latin) - Bosnia and Herzegovina
0N/A Serbian (Cyrillic) - Bosnia and Herzegovina
0N/A Welsh - United Kingdom
0N/A Maori - New Zealand
0N/A Malayalam - India
0N/A Maltese - Malta
0N/A Quechua - Bolivia
0N/A Quechua - Ecuador
0N/A Quechua - Peru
0N/A Setswana (Tswana) - South Africa
0N/A isiXhosa (Xhosa) - South Africa
0N/A isiZulu ( Zulu) - South Africa
0N/A Sesotho sa Leboa (Northern Sotho) - South Africa
0N/A Sami, Northern - Norway
0N/A Sami, Northern - Sweden
0N/A Sami, Northern - Finland
0N/A Sami, Lule - Norway
0N/A Sami, Lule - Sweden
0N/A Sami, Southern - Norway
0N/A Sami, Southern - Sweden
0N/A Sami, Skolt - Finland
0N/A Sami, Inari - Finland
0N/A
0N/A Bug # 6409997:
0N/A Run the "deflocale.exe" tool found in "data" directory on Windows Vista.
0N/A It contains the following new locales:
0N/A Tajik (Cyrillic) (Tajikistan) - 1251
0N/A Upper Sorbian (Germany) - 1252
0N/A Turkmen (Turkmenistan) - 1250
0N/A Oriya (India) - 0
0N/A Assamese (India) - 0
0N/A Tibetan (People's Republic of China) - 0
0N/A Khmer (Cambodia) - 0
0N/A Lao (Lao P.D.R.) - 0
0N/A Sinhala (Sri Lanka) - 0
0N/A Inuktitut (Canada) - 0
0N/A Amharic (Ethiopia) - 0
0N/A Hausa (Latin) (Nigeria) - 1252
0N/A Yoruba (Nigeria) - 1252
0N/A Bashkir (Russia) - 1251
0N/A Greenlandic (Greenland) - 1252
0N/A Igbo (Nigeria) - 1252
0N/A Yi (People's Republic of China) - 0
0N/A Breton (France) - 1252
0N/A Uighur (People's Republic of China) - 1256
0N/A Occitan (France) - 1252
0N/A Corsican (France) - 1252
0N/A Alsatian (France) - 1252
0N/A Yakut (Russia) - 1251
0N/A K'iche (Guatemala) - 1252
0N/A Kinyarwanda (Rwanda) - 1252
0N/A Wolof (Senegal) - 1252
0N/A Dari (Afghanistan) - 1256
0N/A Lower Sorbian (Germany) - 1252
0N/A Bengali (Bangladesh) - 0
0N/A Mongolian (Traditional Mongolian) (People's Republic of China) - 0
0N/A Tamazight (Latin) (Algeria) - 1252
0N/A English (India) - 1252
0N/A English (Malaysia) - 1252
0N/A English (Singapore) - 1252
0N/A Spanish (United States) - 1252
0N/A
0N/A*/
0N/Aimport java.nio.charset.Charset;
0N/Aimport java.util.Locale;
0N/A
0N/Apublic class PrintDefaultLocale {
0N/A public static void main(String[] args) {
2700N/A System.out.printf("default locale: ID: %s, Name: %s\n",
2700N/A Locale.getDefault().toString(),
2700N/A Locale.getDefault().getDisplayName(Locale.US));
2700N/A System.out.printf("display locale: ID: %s, Name: %s\n",
2700N/A Locale.getDefault(Locale.Category.DISPLAY).toString(),
2700N/A Locale.getDefault(Locale.Category.DISPLAY).getDisplayName(Locale.US));
2700N/A System.out.printf("format locale: ID: %s, Name: %s\n",
2700N/A Locale.getDefault(Locale.Category.FORMAT).toString(),
2700N/A Locale.getDefault(Locale.Category.FORMAT).getDisplayName(Locale.US));
2700N/A System.out.printf("default charset: %s\n", Charset.defaultCharset());
0N/A }
0N/A}