annotate make/scripts/localelist.sh @ 11311:c942132c5014

Added tag jdk8u71-b01 for changeset e8b5e10a19d6
author asaha
date Tue, 22 Sep 2015 13:39:46 -0700
parents 9c60860b1812
children
rev   line source
erikj@5507 1 #!/bin/sh
erikj@5507 2
erikj@5507 3 #
alanb@6073 4 # Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
erikj@5507 5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@5507 6 #
erikj@5507 7 # This code is free software; you can redistribute it and/or modify it
erikj@5507 8 # under the terms of the GNU General Public License version 2 only, as
erikj@5507 9 # published by the Free Software Foundation. Oracle designates this
erikj@5507 10 # particular file as subject to the "Classpath" exception as provided
erikj@5507 11 # by Oracle in the LICENSE file that accompanied this code.
erikj@5507 12 #
erikj@5507 13 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@5507 14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@5507 15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@5507 16 # version 2 for more details (a copy is included in the LICENSE file that
erikj@5507 17 # accompanied this code).
erikj@5507 18 #
erikj@5507 19 # You should have received a copy of the GNU General Public License version
erikj@5507 20 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@5507 21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@5507 22 #
erikj@5507 23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@5507 24 # or visit www.oracle.com if you need additional information or have any
erikj@5507 25 # questions.
erikj@5507 26 #
erikj@5507 27
erikj@5507 28 #
erikj@5507 29 # This script is to generate the supported locale list string and replace the
erikj@5507 30 # #LOCALE_LIST# in <ws>/src/share/classes/sun/util/CoreResourceBundleControl.java.
erikj@5507 31 #
erikj@5507 32 # NAWK & SED is passed in as environment variables.
erikj@5507 33 #
erikj@5507 34 LOCALE_LIST=$1
erikj@5507 35 INUT_FILE=$2
erikj@5507 36 OUTPUT_FILE=$3
erikj@5507 37
erikj@5507 38 LOCALES=`(for I in $LOCALE_LIST; do echo $I;done) | sort | uniq`
erikj@5507 39 JAVA_LOCALES=
erikj@5507 40
erikj@5507 41 toJavaLocale()
erikj@5507 42 {
ihse@8330 43 NewLocale=`echo $1 | $NAWK '
ihse@8330 44 BEGIN {
ihse@8330 45 # The following values have to be consistent with java.util.Locale.
ihse@8330 46 javalocales["en"] = "ENGLISH";
ihse@8330 47 javalocales["fr"] = "FRENCH";
ihse@8330 48 javalocales["de"] = "GERMAN";
ihse@8330 49 javalocales["it"] = "ITALIAN";
ihse@8330 50 javalocales["ja"] = "JAPANESE";
ihse@8330 51 javalocales["ko"] = "KOREAN";
ihse@8330 52 javalocales["zh"] = "CHINESE";
ihse@8330 53 javalocales["zh_CN"] = "SIMPLIFIED_CHINESE";
ihse@8330 54 javalocales["zh_TW"] = "TRADITIONAL_CHINESE";
ihse@8330 55 javalocales["fr_FR"] = "FRANCE";
ihse@8330 56 javalocales["de_DE"] = "GERMANY";
ihse@8330 57 javalocales["it_IT"] = "ITALY";
ihse@8330 58 javalocales["ja_JP"] = "JAPAN";
ihse@8330 59 javalocales["ko_KR"] = "KOREA";
ihse@8330 60 javalocales["en_GB"] = "UK";
ihse@8330 61 javalocales["en_US"] = "US";
ihse@8330 62 javalocales["en_CA"] = "CANADA";
ihse@8330 63 javalocales["fr_CA"] = "CANADA_FRENCH";
ihse@8330 64 }
ihse@8330 65 {
ihse@8330 66 if ($0 in javalocales) {
ihse@8330 67 print " Locale." javalocales[$0];
ihse@8330 68 } else {
ihse@8330 69 split($0, a, "_");
ihse@8330 70 if (a[3] != "") {
ihse@8330 71 print " new Locale(\"" a[1] "\", \"" a[2] "\", \"" a[3] "\")";
ihse@8330 72 } else if (a[2] != "") {
ihse@8330 73 print " new Locale(\"" a[1] "\", \"" a[2] "\")";
ihse@8330 74 } else {
ihse@8330 75 print " new Locale(\"" a[1] "\")";
ihse@8330 76 }
ihse@8330 77 }
ihse@8330 78 }'`
erikj@5507 79
ihse@8330 80 JAVA_LOCALES=$JAVA_LOCALES$NewLocale
erikj@5507 81 }
erikj@5507 82
erikj@5507 83 # count the number of locales
erikj@5507 84 counter=0
erikj@5507 85 for i in $LOCALES
erikj@5507 86 do
ihse@8330 87 counter=`expr $counter + 1`
erikj@5507 88 done
erikj@5507 89
erikj@5507 90 index=0
erikj@5507 91 for locale in $LOCALES
erikj@5507 92 do
ihse@8330 93 index=`expr $index + 1`;
ihse@8330 94 if [ $index != $counter ]
ihse@8330 95 then
ihse@8330 96 toJavaLocale $locale
ihse@8330 97 JAVA_LOCALES=$JAVA_LOCALES","
ihse@8330 98 else
ihse@8330 99 toJavaLocale $locale
ihse@8330 100 fi
erikj@5507 101 done
erikj@5507 102
erikj@5507 103 # replace the #LOCALE_LIST# in the precompiled CoreResourceBundleControl.java file.
erikj@5507 104
erikj@5507 105 $SED -e "s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@" \
ihse@8330 106 -e "s/#LOCALE_LIST#/$JAVA_LOCALES/g" $2 > $3