⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globalization.java

📁 J2ME上的一个播放器,可以更换皮肤.开源软件.
💻 JAVA
字号:
package inline.sys;

import java.util.*;

public class Globalization extends Hashtable
{
    private static Hashtable mytable;
    public static final int ENGLISH_LCID = 1033;
    public static final int RUSSIAN_LCID = 1049;
    private static int system_lcid;
    protected static final String[] langstmap  = {"en-en", "ru-ru"};
    protected static int[]    langintmap = {ENGLISH_LCID, RUSSIAN_LCID};

    public void remap(Integer[] langs, String[] table)
    {
	int syslcid = getSystemLCID();
	int id = 0;

	if (langs==null || table==null)
	{
	    return;
	}
	
	// find id
	for(int i=0;i<langs.length;i++)
	{
	    if (langs[i].intValue() == syslcid) 
	    {
		id = i; 
		break;
	    }
	}

	clear();
	
	// store in hashtable 
	for(int i=0;i<table.length;i=i+3)
	{
	    String td = table[i];
	    String tx = table[i+1+id];
	    
	    if (tx == null) tx = table[i+1]; // drop to defaults
	    if (put(td, tx) != null)
	    {
	        Log.fire("Dublicate lang string at "+Integer.toHexString(td.charAt(0)));
	    }   
	}
    }
    
    public String take(int code)
    {
	String res = (String)get(""+(char)code);
	
	if (res == null) res = "?";
	
	return res;
    }

    public static void setSystemLCID(int olcid)
    {
	system_lcid = olcid;
    }
    
    public static int getSystemLCID()
    {
	int syslcid = ENGLISH_LCID; // default

	if (system_lcid != 0)
	{
	    syslcid = system_lcid;
	}
	else
	{
	    // detect
	    String locale = System.getProperty("microedition.locale").toLowerCase();
	    for(int i=0;i<langstmap.length;i++)
	    {
		if (langstmap[i].compareTo(locale)==0)
		{
		    syslcid = langintmap[i]; 
		    break;
		}
	    }
	    system_lcid = syslcid;
	};
	
	return syslcid;
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -