Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/make/scripts/localelist.sh
32280 views
#!/bin/sh12#3# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5#6# This code is free software; you can redistribute it and/or modify it7# under the terms of the GNU General Public License version 2 only, as8# published by the Free Software Foundation. Oracle designates this9# particular file as subject to the "Classpath" exception as provided10# by Oracle in the LICENSE file that accompanied this code.11#12# This code is distributed in the hope that it will be useful, but WITHOUT13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or14# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License15# version 2 for more details (a copy is included in the LICENSE file that16# accompanied this code).17#18# You should have received a copy of the GNU General Public License version19# 2 along with this work; if not, write to the Free Software Foundation,20# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.21#22# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA23# or visit www.oracle.com if you need additional information or have any24# questions.25#2627#28# This script is to generate the supported locale list string and replace the29# #LOCALE_LIST# in <ws>/src/share/classes/sun/util/CoreResourceBundleControl.java.30#31# NAWK & SED is passed in as environment variables.32#33LOCALE_LIST=$134INUT_FILE=$235OUTPUT_FILE=$33637LOCALES=`(for I in $LOCALE_LIST; do echo $I;done) | sort | uniq`38JAVA_LOCALES=3940toJavaLocale()41{42NewLocale=`echo $1 | $NAWK '43BEGIN {44# The following values have to be consistent with java.util.Locale.45javalocales["en"] = "ENGLISH";46javalocales["fr"] = "FRENCH";47javalocales["de"] = "GERMAN";48javalocales["it"] = "ITALIAN";49javalocales["ja"] = "JAPANESE";50javalocales["ko"] = "KOREAN";51javalocales["zh"] = "CHINESE";52javalocales["zh_CN"] = "SIMPLIFIED_CHINESE";53javalocales["zh_TW"] = "TRADITIONAL_CHINESE";54javalocales["fr_FR"] = "FRANCE";55javalocales["de_DE"] = "GERMANY";56javalocales["it_IT"] = "ITALY";57javalocales["ja_JP"] = "JAPAN";58javalocales["ko_KR"] = "KOREA";59javalocales["en_GB"] = "UK";60javalocales["en_US"] = "US";61javalocales["en_CA"] = "CANADA";62javalocales["fr_CA"] = "CANADA_FRENCH";63}64{65if ($0 in javalocales) {66print " Locale." javalocales[$0];67} else {68split($0, a, "_");69if (a[3] != "") {70print " new Locale(\"" a[1] "\", \"" a[2] "\", \"" a[3] "\")";71} else if (a[2] != "") {72print " new Locale(\"" a[1] "\", \"" a[2] "\")";73} else {74print " new Locale(\"" a[1] "\")";75}76}77}'`7879JAVA_LOCALES=$JAVA_LOCALES$NewLocale80}8182# count the number of locales83counter=084for i in $LOCALES85do86counter=`expr $counter + 1`87done8889index=090for locale in $LOCALES91do92index=`expr $index + 1`;93if [ $index != $counter ]94then95toJavaLocale $locale96JAVA_LOCALES=$JAVA_LOCALES","97else98toJavaLocale $locale99fi100done101102# replace the #LOCALE_LIST# in the precompiled CoreResourceBundleControl.java file.103104$SED -e "s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@" \105-e "s/#LOCALE_LIST#/$JAVA_LOCALES/g" $2 > $3106107108