001package org.hl7.fhir.r5.utils;
002
003import java.util.HashMap;
004import java.util.Map;
005
006/**
007 * This clas smaps between the jurisdictions defined for CanonicalResource.jurisdiction
008 * and Java Locale
009 * @author graha
010 *
011 */
012
013public class JurisdictionLocales {
014
015  private Map<String, String> map = new HashMap<>();
016
017  public JurisdictionLocales() {
018    super();
019    register();
020  }
021
022  private void register() {
023    register("USA", "US", "en-US");
024    register("AUS", "AU", "en-AU");
025    register("NZL", "NZ", "en-NZ");
026    register("GBR", "GB", "en-GB");
027    register("IND", "IN", "en-IN");
028    
029    register("AUT", "AT", "de-AT");
030    register("CHE", "CH", "de-CH");
031    register("DEU", "DE", "de-DE");
032    register("NOR", "NO", "no-NO");
033    register("SWE", "SE", "sv-SE");
034    register("FIN", "FI", "fi-FI");
035    register("DNK", "DK", "da-DK");
036    register("NLD", "NL", "nl-NL");
037    register("BEL", "BE", "nl-BE"); // but will be fr-BE if lang is specified
038    register("FRA", "FR", "fr-FR"); 
039    register("ITA", "IT", "it-IT"); 
040    register("RUS", "RU", "ru-RU"); 
041    
042    register("ESP", "ES", "es-ES"); 
043    register("ARG", "AR", "es-AR"); 
044    register("UGY", "UY", "es-UY"); 
045    
046    register("PRT", "PT", "pt-PT"); 
047    register("BRA", "BR", "pt-BR"); 
048
049    register("CHN", "CN", "zh-CN"); 
050    register("TWN", "TW", "zh-TW"); 
051    register("JPN", "JP", "ja-JP"); 
052    register("KOR", "KR", "ko-KR"); 
053    register("VNM", "VN", "vn-VN"); 
054  }
055
056  private void register(String code3, String code2, String locale) {
057    map.put(code3,  locale);
058    map.put(code2,  locale);
059  }
060
061  public String get(String c) {
062    return map.get(c.toUpperCase());
063  }
064  
065}