1 package org.unicode.cldr.util;
2 
3 import java.util.HashMap;
4 import java.util.Map;
5 
6 /**
7  * This list needs updating as a new organizations are added; that's by design
8  * so that we know when new ones show up.
9  */
10 public enum Organization {
11     // Please update Locales.txt for default coverage when adding an organization here.
12     adlam("Winden Jangen Adlam"),
13     adobe("Adobe"),
14     afghan_csa("Afghan CSA"),
15     afghan_mcit("Afghan MCIT"),
16     afrigen("Afrigen"),
17     apple("Apple"),
18     bangladesh("Bangladesh", "Bangladesh Computer Council"),
19     bangor_univ("Bangor Univ."),
20     bhutan("Bhutan DDC"),
21     breton("Office of Breton Lang"),
22     cherokee("Cherokee Nation"),
23     cldr("Cldr"),
24     facebook("Facebook"),
25     gaeilge("Foras na Gaeilge"),
26     georgia_isi("Georgia ISI"),
27     gnome("Gnome Foundation"),
28     google("Google"),
29     guest("Guest (Unicode)"),
30     ibm("IBM"),
31     india("India MIT"),
32     iran_hci("Iran HCI"),
33     kendra("Kendra (Nepal)"),
34     kotoistus("Kotoistus (Finnish IT Ctr)"),
35     kunsill_malti("Il-Kunsill Nazzjonali tal-Ilsien Malti", "National Council for the Maltese Language", "malta", "malti"),
36     lakota_lc("Lakota LC"),
37     lao_dpt("Lao Posts/Telecom??"),
38     longnow("The Long Now Foundation", "Long Now","PanLex"),
39     microsoft("Microsoft"),
40     mozilla("Mozilla"),
41     netflix("Netflix"),
42     openinstitute("Open Inst (Cambodia)"),
43     openoffice_org("Open Office"),
44     oracle("Oracle", "sun", "Sun Micro"),
45     pakistan("Pakistan"),
46     rodakych("Rodakych", "Nigerian Pidgin"),
47     rumantscha("Lia Rumantscha"),
48     sil("SIL", "SIL International"),
49     srilanka("Sri Lanka ICTA", "Sri Lanka"),
50     surveytool("Survey Tool"),
51     welsh_lc("Welsh LC"),
52     wikimedia("Wikimedia Foundation"),
53     yahoo("Yahoo"),
54     // To be removed.
55     ;
56 
57     public final String displayName;
58     private final String[] names;
59 
fromString(String name)60     public static Organization fromString(String name) {
61         name = name.toLowerCase().replace('-', '_').replace('.', '_');
62         Organization org = OrganizationNameMap.get(name);
63         return org;
64     }
65 
getDisplayName()66     public String getDisplayName() {
67         return displayName;
68     }
69 
70     static Map<String, Organization> OrganizationNameMap;
71     static {
72         OrganizationNameMap = new HashMap<>();
73         for (Organization x : values()) {
74             OrganizationNameMap.put(x.displayName.toLowerCase().replace('-', '_').replace('.', '_'), x);
75             for (String name : x.names) {
76                 OrganizationNameMap.put(name.toLowerCase().replace('-', '_').replace('.', '_'), x);
77             }
78             OrganizationNameMap.put(x.name().toLowerCase().replace('-', '_').replace('.', '_'), x);
79         }
80     }
81 
82     /**
83      * @param displayName Preferred display name for the organization
84      * @param names Alternate aliases for this organization
85      */
Organization(String displayName, String... names)86     private Organization(String displayName, String... names) {
87         this.displayName = displayName;
88         this.names = names;
89     }
90 }
91