Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Locale;

import android.text.TextUtils;

public class Main {
    public static String getLangCode() {
        String lang_code = Locale.getDefault().toString();
        if (!TextUtils.isEmpty(lang_code)) {
            if (lang_code.startsWith("zh") && !lang_code.endsWith("CN")) {
                lang_code = "zh_TW";
            }
            if (lang_code.startsWith("en")) {
                lang_code = "en_US";
            }
        } else {
            lang_code = "zh_CN";
        }
        return lang_code;
    }
}