android/src/com/mapswithme/util/Language.java
public static String localeToTwineLanguage(Locale locale)
  {
    if (locale == null)
    {
      Log.e(TAG, "localeToTwineLanguage was called with null Locale.");
      return "";
    }

    final String chinese = Locale.CHINESE.getLanguage();
    final String language = locale.getLanguage();
    final String country = locale.getCountry();

    if (chinese == null || language == null || country == null)
    {
      Log.e(TAG, "Methods Locale.getLanguage or Locale.getCountry return null.");
      return "";
    }

    if (chinese.equals(language))
    {
      if (country.equals("TW") || country.equals("MO") || country.equals("HK"))
      {
        return "zh-Hant"; // Chinese traditional
      }
      return "zh-Hans"; // Chinese simplified
    }
    if (TextUtils.isEmpty(language))
    {
      Log.e(TAG, "locale.getLanguage() returns null or empty string.");
      return "";
    }
    return language;
  }
// If not returns an empty string.
If not returns an empty string.
If not returns an empty string .
public static String localeToTwineLanguage(Locale locale)
  {
    if (locale == null)
    {
      Log.e(TAG, "localeToTwineLanguage was called with null Locale.");
      return "";
    }
    final String chinese = Locale.CHINESE.getLanguage();
    final String language = locale.getLanguage();
    final String country = locale.getCountry();
    if (chinese == null || language == null || country == null)
    {
      Log.e(TAG, "Methods Locale.getLanguage or Locale.getCountry return null.");
      return "";
    }
    if (chinese.equals(language))
    {
      if (country.equals("TW") || country.equals("MO") || country.equals("HK"))
      {
        return "zh-Hant"; 
      }
      return "zh-Hans"; 
    }
    if (TextUtils.isEmpty(language))
    {
      Log.e(TAG, "locale.getLanguage() returns null or empty string.");
      return "";
    }
    return language;
  }
public static String localeToTwineLanguage ( Locale locale ) { if ( locale == null ) { Log . e ( TAG , "localeToTwineLanguage was called with null Locale." ) ; return "" ; } final String chinese = Locale . CHINESE . getLanguage ( ) ; final String language = locale . getLanguage ( ) ; final String country = locale . getCountry ( ) ; if ( chinese == null || language == null || country == null ) { Log . e ( TAG , "Methods Locale.getLanguage or Locale.getCountry return null." ) ; return "" ; } if ( chinese . equals ( language ) ) { if ( country . equals ( "TW" ) || country . equals ( "MO" ) || country . equals ( "HK" ) ) { return "zh-Hant" ; } return "zh-Hans" ; } if ( TextUtils . isEmpty ( language ) ) { Log . e ( TAG , "locale.getLanguage() returns null or empty string." ) ; return "" ; } return language ; }
If not returns an empty string.
If not returns an empty string .
// Chinese traditional // Chinese simplified