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-3.5.1.12 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.5 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.4.2 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.4 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.3 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.3.beta.4 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.3.beta.3 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.3.beta.2 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.3.beta.1 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.2 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.2.beta.7 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.2.beta.6 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.2.beta.5 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.2.beta.4 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.2.beta.3 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.2.beta.2 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.2.beta.1 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.1 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.0 platform/bb/RubyVM/src/j2me/util/Locale.java
rhodes-3.3.0.beta.3 platform/bb/RubyVM/src/j2me/util/Locale.java