package eoa_Language;

import com.ur.urcap.api.domain.system.localization.Localization;
import java.util.Locale;

public class LanguagePack {
	public final static Locale rootLanguageLocale = Locale.ENGLISH;
	private static LanguagePack instance;
	private Localization localization;
	private TextResource textResource;

	public static LanguagePack getInstance() {
		return instance;
	}

	static {
		instance = new LanguagePack();
	}

	private LanguagePack() {
		createDefaultLocalization();
	}

	private void createDefaultLocalization() {
		createTextResource(Locale.ROOT);
	}

	public void setEnglishLocalization() {
		createDefaultLocalization();
	}

	public void setLocalization(Localization localization) {
		this.localization = localization;
		createTextResource(localization.getLocale());
	}

	public Localization getLocalization() {
		return localization;
	}

	public TextResource getTextResource() {
		return textResource;
	}

	private void createTextResource(Locale locale) {
		textResource = new TextResource(locale);
	}

}