package com.jld.vod.utils;

import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;

import java.util.Locale;

public class CommonUtil {
    public static void configLanguage(Context mContext, String language) {
        Configuration config = mContext.getResources().getConfiguration();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            if (language.equals("CHINESE")) {
                config.locale = Locale.SIMPLIFIED_CHINESE;
            } else if (language.equals("ENGLISH")) {
                config.locale = Locale.US;
            } else if(language.equals("JAPANESE")){
                config.locale = Locale.JAPAN;
            }else {
                config.locale = Locale.SIMPLIFIED_CHINESE;
            }
        } else {
            if (language.equals("CHINESE")) {
                config.locale = Locale.CHINESE;
            } else if (language.equals("ENGLISH")) {
                config.locale = Locale.ENGLISH;
            } else if (language.equals("JAPANESE")){
                config.locale = Locale.JAPAN;
            }else {
                config.locale = Locale.CHINESE;
            }
        }
        mContext.getResources().updateConfiguration(config, null);
    }
}
