<commit_before>package com.x.base.core.project.tools;

import org.apache.commons.lang3.StringUtils;

import java.util.Locale;
import java.util.ResourceBundle;

public class LanguageTools {

    public static String getValueByKey(String key) {
        return getValueByKey(key, null);
    }

    public static String getValueByKey(String key, String locale) {
        if(StringUtils.isBlank(key)){
            return null;
        }
        ResourceBundle resourceBundle = null;
        if(StringUtils.isBlank(locale)){
            resourceBundle = ResourceBundle.getBundle("language.platform", Locale.getDefault());
        }else if("zh".equalsIgnoreCase(locale) || "zh_CN".equalsIgnoreCase(locale)) {
            resourceBundle = ResourceBundle.getBundle("language.platform", Locale.SIMPLIFIED_CHINESE);
        }else if(locale.toLowerCase().startsWith("en")) {
            resourceBundle = ResourceBundle.getBundle("language.platform", Locale.ENGLISH);
        }else if("zh_HK".equalsIgnoreCase(locale) || "zh_TW".equalsIgnoreCase(locale)) {
            resourceBundle = ResourceBundle.getBundle("language.platform", Locale.TRADITIONAL_CHINESE);
        }

        return resourceBundle.getString(key);
    }
}<commit_msg>国语言国际化2<commit_after>package com.x.base.core.project.tools;

import org.apache.commons.lang3.StringUtils;

import java.util.Locale;
import java.util.ResourceBundle;

public class LanguageTools {

    private final static String LANGUAGE_PLATFORM = "language.platform";

    public static String getValueByKey(String key) {
        return getValueByKey(key, null);
    }

    public static String getValueByKey(String key, String locale) {
        if(StringUtils.isBlank(key)){
            return null;
        }
        ResourceBundle resourceBundle = null;
        if(StringUtils.isBlank(locale)){
            resourceBundle = ResourceBundle.getBundle(LANGUAGE_PLATFORM, Locale.getDefault());
        }else if("zh".equalsIgnoreCase(locale) || "zh_CN".equalsIgnoreCase(locale)) {
            resourceBundle = ResourceBundle.getBundle(LANGUAGE_PLATFORM, Locale.SIMPLIFIED_CHINESE);
        }else if(locale.toLowerCase().startsWith("en")) {
            resourceBundle = ResourceBundle.getBundle(LANGUAGE_PLATFORM, Locale.ENGLISH);
        }else if("zh_HK".equalsIgnoreCase(locale) || "zh_TW".equalsIgnoreCase(locale)) {
            resourceBundle = ResourceBundle.getBundle(LANGUAGE_PLATFORM, Locale.TRADITIONAL_CHINESE);
        }

        return resourceBundle.getString(key);
    }

    public static String getValueByKey(String baseName ,String key, String locale) {
        if(StringUtils.isBlank(key)){
            return null;
        }
        ResourceBundle resourceBundle = null;
        if(StringUtils.isBlank(locale)){
            resourceBundle = ResourceBundle.getBundle(baseName, Locale.getDefault());
        }else if("zh".equalsIgnoreCase(locale) || "zh_CN".equalsIgnoreCase(locale)) {
            resourceBundle = ResourceBundle.getBundle(baseName, Locale.SIMPLIFIED_CHINESE);
        }else if(locale.toLowerCase().startsWith("en")) {
            resourceBundle = ResourceBundle.getBundle(baseName, Locale.ENGLISH);
        }else if("zh_HK".equalsIgnoreCase(locale) || "zh_TW".equalsIgnoreCase(locale)) {
            resourceBundle = ResourceBundle.getBundle(baseName, Locale.TRADITIONAL_CHINESE);
        }

        return resourceBundle.getString(key);
    }
}
{'fraction_non_alphanumeric': 0.1111111111111111, 'fraction_numerical': 0.0008818342151675485, 'mean_word_length': 3.4953764861294583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4234989', 'n_tokens_mistral': 977, 'n_tokens_neox': 971, 'n_words': 154}