All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.noear.rock.solon.RockCodeI18nBundle Maven / Gradle / Ivy

There is a newer version: 2.10.2
Show newest version
package org.noear.rock.solon;

import org.noear.rock.i18n.CodeContext;
import org.noear.solon.i18n.I18nBundle;

import java.util.Locale;
import java.util.Map;

/**
 * @author noear 2022/4/9 created
 */
public class RockCodeI18nBundle implements I18nBundle {
    final CodeContext context;
    final Locale locale;
    final String locale_lang;

    public RockCodeI18nBundle(CodeContext context, Locale locale) {
        this.context = context;
        this.locale = locale;
        this.locale_lang = locale.toString();
    }

    @Override
    public Map toMap() {
        return context.getMap(locale_lang);
    }

    @Override
    public Locale locale() {
        return locale;
    }

    @Override
    public String get(String key) {
        return context.get(key, locale_lang);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy