Sha256: 6d3dfc8f405b11372e3529a63d5eeb4f133404b65f34d4d7c75e4610c75c9b90

Contents?: true

Size: 1.8 KB

Versions: 119

Compression:

Stored size: 1.8 KB

Contents

package j2me.util;

public class Locale  {
	
    static public final Locale ENGLISH = new Locale("en","","");
    private final String language;
    private final String country;
    private final String variant;
    
    public Locale(String language, String country, String variant) {
        this.language = convertOldISOCodes(language);
        this.country = toUpperCase(country).intern();
        this.variant = variant.intern();
    }

    public Locale(String language, String country) {
        this(language, country, "");
    }
    
    public Locale(String language) {
        this(language, "", "");
    }
    
    public static Locale getDefault() {
    	return  ENGLISH;
    }
    
    public String getDisplayLanguage(Locale inLocale) {
    	return "English";
    }
    
    private String toLowerCase(String str) {
    	char[] buf = new char[str.length()];
            for (int i = 0; i < buf.length; i++) {
    	    buf[i] = Character.toLowerCase(str.charAt(i));
            }
            return new String( buf );
        }
    
    private String toUpperCase(String str) {
    	char[] buf = new char[str.length()];
            for (int i = 0; i < buf.length; i++) {
    	    buf[i] = Character.toUpperCase(str.charAt(i));
            }
            return new String( buf );
        }
    
    private String convertOldISOCodes(String language) {
        // we accept both the old and the new ISO codes for the languages whose ISO
        // codes have changed, but we always store the OLD code, for backward compatibility
        language = toLowerCase(language).intern();
        if (language == "he") {
            return "iw";
        } else if (language == "yi") {
            return "ji";
        } else if (language == "id") {
            return "in";
        } else {
            return language;
        }
    }
    
}

Version data entries

119 entries across 119 versions & 1 rubygems

Version Path
rhodes-2.0.0.beta10 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-2.0.0.beta9 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-2.0.0.beta8 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-2.0.0.beta7 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-2.0.0.beta6 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-2.0.0.beta4 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-2.0.0.beta3 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.5.5 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-2.0.0.beta2 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-2.0.0.beta1 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.5.4 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.5.3 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.5.2 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.5.1 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.5.0 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.4.2 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.4.1 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.4.0 platform/shared/rubyJVM/src/j2me/util/Locale.java
rhodes-1.2.2 platform/shared/rubyJVM/src/j2me/util/Locale.java