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