0N/A/*
2362N/A * Copyright (c) 2007, 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 @test
0N/A @summary checking localised language/country names in finnish
0N/A @bug 4429024 4964035 6558856
0N/A*/
0N/A
0N/Aimport java.util.Locale;
0N/A
0N/Apublic class Bug4429024 {
0N/A
0N/A public static void main(String[] args) throws Exception {
0N/A
0N/A int errors=0;
0N/A
0N/A String [][] fiLocales = {
0N/A { "ar", "arabia" },
0N/A { "ba", "baski" },
0N/A { "bg", "bulgaria" },
0N/A { "ca", "katalaani" },
0N/A { "cs", "tsekki" },
0N/A { "da", "tanska" },
0N/A { "de", "saksa" },
0N/A { "el", "kreikka" },
0N/A { "en", "englanti" },
0N/A { "es", "espanja" },
0N/A { "fi", "suomi" },
2054N/A { "fr", "ranska" },
0N/A { "he", "heprea" },
0N/A { "hi", "hindi" },
0N/A { "it", "italia" },
0N/A { "ja", "japani" },
0N/A { "lt", "liettua" },
0N/A { "lv", "latvia" },
0N/A { "nl", "hollanti" },
0N/A { "no", "norja" },
0N/A { "pl", "puola" },
0N/A { "pt", "portugali" },
0N/A { "ru", "ven\u00e4j\u00e4" },
0N/A { "sv", "ruotsi" },
0N/A { "th", "thai" },
0N/A { "tr", "turkki" },
0N/A { "zh", "kiina" }
0N/A };
0N/A
0N/A String[][] fiCountries = {
0N/A { "BE", "Belgia" },
0N/A { "BR", "Brasilia" },
0N/A { "CA", "Kanada" },
0N/A { "CH", "Sveitsi" },
0N/A { "CN", "Kiina" },
0N/A { "CZ", "Tsekin tasavalta" },
0N/A { "DE", "Saksa" },
0N/A { "DK", "Tanska" },
0N/A { "ES", "Espanja" },
0N/A { "FI", "Suomi" },
2054N/A { "FR", "Ranska" },
0N/A { "GB", "Iso-Britannia" },
0N/A { "GR", "Kreikka" },
0N/A { "IE", "Irlanti" },
0N/A { "IT", "Italia" },
0N/A { "JP", "Japani" },
0N/A { "KR", "Korea" },
0N/A { "NL", "Alankomaat" },
0N/A { "NO", "Norja" },
0N/A { "PL", "Puola" },
0N/A { "PT", "Portugali" },
0N/A { "RU", "Ven\u00e4j\u00e4" },
0N/A { "SE", "Ruotsi" },
0N/A { "TR", "Turkki" },
0N/A { "US", "Yhdysvallat" }
0N/A };
0N/A
0N/A for (int i=0; i < fiLocales.length; i++) {
0N/A errors += getLanguage(fiLocales[i][0], fiLocales[i][1]);
0N/A }
0N/A
0N/A for (int i=0; i < fiCountries.length; i++) {
0N/A errors += getCountry(fiCountries[i][0], fiCountries[i][1]);
0N/A }
0N/A
0N/A if(errors > 0){
0N/A throw new RuntimeException();
0N/A }
0N/A };
0N/A
0N/A
0N/A static int getLanguage(String inLang, String localizedName){
0N/A
0N/A Locale fiLocale = new Locale("fi", "FI");
0N/A Locale inLocale = new Locale (inLang, "");
0N/A
0N/A if (!inLocale.getDisplayLanguage(fiLocale).equals(localizedName)){
0N/A System.out.println("Language " + inLang +" should be \"" + localizedName + "\", not \"" + inLocale.getDisplayLanguage(fiLocale) + "\"");
0N/A return 1;
0N/A }
0N/A else{
0N/A return 0;
0N/A }
0N/A }
0N/A
0N/A static int getCountry(String inCountry, String localizedName){
0N/A
0N/A Locale fiLocale = new Locale("fi", "FI");
0N/A Locale inLocale = new Locale ("", inCountry);
0N/A
0N/A if (!inLocale.getDisplayCountry(fiLocale).equals(localizedName)){
0N/A System.out.println("Country " + inCountry + " should be \"" + localizedName + "\", not \"" + inLocale.getDisplayCountry(fiLocale) + "\"");
0N/A return 1;
0N/A }
0N/A else{
0N/A return 0;
0N/A }
0N/A
0N/A }
0N/A}