1 /*
   2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * This class contains a map which records the locale list string for
  28  * each resource in sun.util.resources & sun.text.resources.
  29  * It is used to avoid loading non-existent localized resources so that
  30  * jar files won't be opened unnecessary to look up them.
  31  *
  32  * @since 1.6
  33  */
  34 package sun.util.locale.provider;
  35 
  36 import java.util.HashMap;
  37 
  38 public class JRENonENLocaleDataMetaInfo implements LocaleDataMetaInfo {
  39 
  40     private static final HashMap<String, String> resourceNameToLocales =
  41         new HashMap<>(7);
  42 
  43 
  44     static {
  45         resourceNameToLocales.put("FormatData",
  46                                   "ar ar-JO ar-LB ar-SY be be-BY bg bg-BG ca ca-ES cs cs-CZ da da-DK de de-AT de-CH de-DE de-LU el el-CY el-GR es es-AR es-BO es-CL es-CO es-CR es-DO es-EC es-ES es-GT es-HN es-MX es-NI es-PA es-PE es-PR es-PY es-SV es-US es-UY es-VE et et-EE fi fi-FI fr fr-BE fr-CA fr-CH fr-FR ga ga-IE hi-IN hr hr-HR hu hu-HU in in-ID is is-IS it it-CH it-IT iw iw-IL ja ja-JP ko ko-KR lt lt-LT lv lv-LV mk mk-MK ms ms-MY mt mt-MT nl nl-BE nl-NL no no-NO no-NO-NY pl pl-PL pt pt-BR pt-PT ro ro-RO ru ru-RU sk sk-SK sl sl-SI sq sq-AL sr sr-BA sr-CS sr-Latn sr-Latn-ME sr-ME sr-RS sv sv-SE th th-TH tr tr-TR uk uk-UA vi vi-VN zh zh-CN zh-Hans-CN zh-HK zh-Hant-HK zh-SG zh-Hans-SG zh-TW zh-Hant-TW");
  47         resourceNameToLocales.put("CollationData",
  48                                   "ar be bg ca cs da el es et fi fr hi hr hu is iw ja ko lt lv mk no pl ro ru sk sl sq sr sr-Latn sv th tr uk vi zh zh-HK zh-Hant-HK zh-TW zh-Hant-TW");
  49         resourceNameToLocales.put("TimeZoneNames",
  50                                   "de es fr hi it ja ko pt-BR sv zh-CN zh-Hans-CN zh-HK zh-Hant-HK zh-TW zh-Hant-TW");
  51         resourceNameToLocales.put("LocaleNames",
  52                                   "ar be bg ca cs da de el el-CY es es-US et fi fr ga hi hr hu in is it iw ja ko lt lv mk ms mt nl no no-NO-NY pl pt pt-BR pt-PT ro ru sk sl sq sr sr-Latn sv th tr uk vi zh zh-HK zh-Hant-HK zh-SG zh-Hans-SG zh-TW zh-Hant-TW");
  53         resourceNameToLocales.put("CurrencyNames",
  54                                   "ar-AE ar-BH ar-DZ ar-EG ar-IQ ar-JO ar-KW ar-LB ar-LY ar-MA ar-OM ar-QA ar-SA ar-SD ar-SY ar-TN ar-YE be-BY bg-BG ca-ES cs-CZ da-DK de de-AT de-CH de-DE de-GR de-LU el-CY el-GR es es-AR es-BO es-CL es-CO es-CR es-CU es-DO es-EC es-ES es-GT es-HN es-MX es-NI es-PA es-PE es-PR es-PY es-SV es-US es-UY es-VE et-EE fi-FI fr fr-BE fr-CA fr-CH fr-FR fr-LU ga-IE hi-IN hr-HR hu-HU in-ID is-IS it it-CH it-IT iw-IL ja ja-JP ko ko-KR lt-LT lv-LV mk-MK ms-MY mt-MT nl-BE nl-NL no-NO pl-PL pt pt-BR pt-PT ro-RO ru-RU sk-SK sl-SI sq-AL sr-BA sr-CS sr-Latn-BA sr-Latn-ME sr-Latn-RS sr-ME sr-RS sv sv-SE th-TH tr-TR uk-UA vi-VN zh-CN zh-Hans-CN zh-HK zh-Hant-HK zh-SG zh-Hans-SG zh-TW zh-Hant-TW");
  55         resourceNameToLocales.put("CalendarData",
  56                                   "ar be bg ca cs da de el el-CY es es-ES es-US et fi fr fr-CA hi hr hu in-ID is it iw ja ko lt lv mk ms-MY mt mt-MT nl no pl pt pt-BR pt-PT ro ru sk sl sq sr sr-Latn-BA sr-Latn-ME sr-Latn-RS sv th tr uk vi zh");
  57         resourceNameToLocales.put("AvailableLocales",
  58                                   "ar ar-AE ar-BH ar-DZ ar-EG ar-IQ ar-JO ar-KW ar-LB ar-LY ar-MA ar-OM ar-QA ar-SA ar-SD ar-SY ar-TN ar-YE be be-BY bg bg-BG ca ca-ES cs cs-CZ da da-DK de de-AT de-CH de-DE de-GR de-LU el el-CY el-GR es es-AR es-BO es-CL es-CO es-CR es-CU es-DO es-EC es-ES es-GT es-HN es-MX es-NI es-PA es-PE es-PR es-PY es-SV es-US es-UY es-VE et et-EE fi fi-FI fr fr-BE fr-CA fr-CH fr-FR fr-LU ga ga-IE hi hi-IN hr hr-HR hu hu-HU in in-ID is is-IS it it-CH it-IT iw iw-IL ja ja-JP ja-JP-JP ko ko-KR lt lt-LT lv lv-LV mk mk-MK ms ms-MY mt mt-MT nb-NO nl nl-BE nl-NL nn-NO no no-NO no-NO-NY pl pl-PL pt pt-BR pt-PT ro ro-RO ru ru-RU sk sk-SK sl sl-SI sq sq-AL sr sr-BA sr-CS sr-Latn sr-Latn-BA sr-Latn-ME sr-Latn-RS sr-ME sr-RS sv sv-SE th th-TH th-TH-TH tr tr-TR uk uk-UA vi vi-VN zh zh-CN zh-HK zh-Hans-CN zh-Hans-SG zh-Hant-HK zh-Hant-TW zh-SG zh-TW");
  59     }
  60 
  61     /*
  62      * @param resourceName the resource name
  63      * @return the supported locale string for the passed in resource.
  64      */
  65     public static String getSupportedLocaleString(String resourceName) {
  66         return resourceNameToLocales.get(resourceName);
  67     }
  68 
  69     @Override
  70     public LocaleProviderAdapter.Type getType() {
  71         return LocaleProviderAdapter.Type.JRE;
  72     }
  73 
  74     @Override
  75     public String availableLanguageTags(String category) {
  76         return getSupportedLocaleString(category);
  77     }
  78 }