Java Code Examples for com.badlogic.gdx.utils.I18NBundle

The following examples show how to use com.badlogic.gdx.utils.I18NBundle. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: xibalba   Source File: ActionLog.java    License: MIT License 5 votes vote down vote up
/**
 * Handles adding messages to the HUD.
 */
public ActionLog() {
  i18n = Main.assets.get("i18n/xibalba", I18NBundle.class);
  actions = new ArrayList<>();

  add("intro");
}
 
Example 2
@Initiate(priority = HIGH_PRIORITY)
public void initVisUiI18n(final InterfaceService interfaceService, final LocaleService localeService) {
    Locales.setLocale(localeService.getCurrentLocale());
    interfaceService.setActionOnBundlesReload(new Runnable() {
        @Override
        public void run() {
            Locale locale = localeService.getCurrentLocale();
            Locales.setButtonBarBundle(I18NBundle.createBundle(Gdx.files.internal("i18n/visui/buttonbar"), locale));
            Locales.setColorPickerBundle(I18NBundle.createBundle(Gdx.files.internal("i18n/visui/colorpicker"), locale));
            Locales.setDialogsBundle(I18NBundle.createBundle(Gdx.files.internal("i18n/visui/dialogs"), locale));
            Locales.setFileChooserBundle(I18NBundle.createBundle(Gdx.files.internal("i18n/visui/filechooser"), locale));
            Locales.setTabbedPaneBundle(I18NBundle.createBundle(Gdx.files.internal("i18n/visui/tabbedpane"), locale));
        }
    });
}
 
Example 3
public static void setup( Languages lang ){
	//seeing as missing keys are part of our process, this is faster than throwing an exception
	I18NBundle.setExceptionOnMissingKey(false);

	bundles = new ArrayList<>();
	Messages.lang = lang;
	Locale locale = new Locale(lang.code());

	for (String file : prop_files) {
		bundles.add(I18NBundle.createBundle(Gdx.files.internal(file), locale));
	}
}
 
Example 4
private static String getFromBundle(String key){
	String result;
	for (I18NBundle b : bundles){
		result = b.get(key);
		//if it isn't the return string for no key found, return it
		if (result.length() != key.length()+6 || !result.contains(key)){
			return result;
		}
	}
	return null;
}
 
Example 5
Source Project: xibalba   Source File: EntityFactory.java    License: MIT License 4 votes vote down vote up
public EntityFactory() {
  i18n = Main.assets.get("i18n/xibalba", I18NBundle.class);
}
 
Example 6
Source Project: gdx-texture-packer-gui   Source File: GlobalDebugActions.java    License: Apache License 2.0 4 votes vote down vote up
@LmlAction("reloadLocalization") public void reloadLocalization() {
    String language = localeService.getCurrentLocale().getLanguage();
    I18NBundle bundle = I18NBundle.createBundle(Gdx.files.internal("i18n/bundle"), new Locale(language));
    interfaceService.getParser().getData().addI18nBundle("default", bundle);
}
 
Example 7
Source Project: vis-ui   Source File: Dialogs.java    License: Apache License 2.0 4 votes vote down vote up
private static I18NBundle getBundle () {
	return Locales.getDialogsBundle();
}
 
Example 8
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 4 votes vote down vote up
/** Returns common I18N bundle. If current bundle is null, a default bundle is set and returned */
public static I18NBundle getCommonBundle () {
	if (commonBundle == null) commonBundle = getBundle("com/kotcrab/vis/ui/i18n/Common");
	return commonBundle;
}
 
Example 9
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 4 votes vote down vote up
/** Returns I18N bundle used by {@link FileChooser}, if current bundle is null, a default bundle is set and returned */
public static I18NBundle getFileChooserBundle () {
	if (fileChooserBundle == null) fileChooserBundle = getBundle("com/kotcrab/vis/ui/i18n/FileChooser");
	return fileChooserBundle;
}
 
Example 10
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 4 votes vote down vote up
/** Returns I18N bundle used by {@link Dialogs}, if current bundle is null, a default bundle is set and returned */
public static I18NBundle getDialogsBundle () {
	if (dialogsBundle == null) dialogsBundle = getBundle("com/kotcrab/vis/ui/i18n/Dialogs");
	return dialogsBundle;
}
 
Example 11
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 4 votes vote down vote up
/** Returns I18N bundle used by {@link TabbedPane}, if current bundle is null, a default bundle is set and returned */
public static I18NBundle getTabbedPaneBundle () {
	if (tabbedPaneBundle == null) tabbedPaneBundle = getBundle("com/kotcrab/vis/ui/i18n/TabbedPane");
	return tabbedPaneBundle;
}
 
Example 12
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 4 votes vote down vote up
/** Returns I18N bundle used by {@link ColorPicker}, if current bundle is null, a default bundle is set and returned */
public static I18NBundle getColorPickerBundle () {
	if (colorPickerBundle == null) colorPickerBundle = getBundle("com/kotcrab/vis/ui/i18n/ColorPicker");
	return colorPickerBundle;
}
 
Example 13
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 4 votes vote down vote up
/** Returns I18N bundle used by {@link ButtonBar}, if current bundle is null, a default bundle is set and returned */
public static I18NBundle getButtonBarBundle () {
	if (buttonBarBundle == null) buttonBarBundle = getBundle("com/kotcrab/vis/ui/i18n/ButtonBar");
	return buttonBarBundle;
}
 
Example 14
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 4 votes vote down vote up
private static I18NBundle getBundle (String path) {
	FileHandle bundleFile = Gdx.files.classpath(path);
	return I18NBundle.createBundle(bundleFile, locale);
}
 
Example 15
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 4 votes vote down vote up
private static I18NBundle getBundle () {
	return Locales.getCommonBundle();
}
 
Example 16
Source Project: vis-ui   Source File: TabbedPane.java    License: Apache License 2.0 4 votes vote down vote up
private static I18NBundle getBundle () {
	return Locales.getTabbedPaneBundle();
}
 
Example 17
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Changes common bundle. Since this bundle may be used by multiple VisUI parts it should be changed before loading VisUI.
 * If set to null then {@link #getCommonBundle()} will return default bundle.
 */
public static void setCommonBundle (I18NBundle commonBundle) {
	Locales.commonBundle = commonBundle;
}
 
Example 18
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Changes bundle used by {@link FileChooser}, will not affect already created FileChoosers.
 * If set to null then {@link #getFileChooserBundle()} will return default bundle.
 */
public static void setFileChooserBundle (I18NBundle fileChooserBundle) {
	Locales.fileChooserBundle = fileChooserBundle;
}
 
Example 19
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Changes bundle used by {@link Dialogs}, will not affect already created dialogs.
 * If set to null then {@link #getDialogsBundle()} will return default bundle.
 */
public static void setDialogsBundle (I18NBundle dialogsBundle) {
	Locales.dialogsBundle = dialogsBundle;
}
 
Example 20
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Changes bundle used by {@link TabbedPane}, will not affect already created TabbedPane.
 * If set to null then {@link #getTabbedPaneBundle()} will return default bundle.
 */
public static void setTabbedPaneBundle (I18NBundle tabbedPaneBundle) {
	Locales.tabbedPaneBundle = tabbedPaneBundle;
}
 
Example 21
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Changes bundle used by {@link ColorPicker}, will not affect already created pickers.
 * If set to null then {@link #getColorPickerBundle()} will return default bundle.
 */
public static void setColorPickerBundle (I18NBundle colorPickerBundle) {
	Locales.colorPickerBundle = colorPickerBundle;
}
 
Example 22
Source Project: vis-ui   Source File: Locales.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Changes bundle used by {@link ButtonBar}, will not affect already created bars.
 * If set to null then {@link #getButtonBarBundle()} ()} will return default bundle.
 */
public static void setButtonBarBundle (I18NBundle buttonBarBundle) {
	Locales.buttonBarBundle = buttonBarBundle;
}
 
Example 23
Source Project: gdx-texture-packer-gui   Source File: App.java    License: Apache License 2.0 votes vote down vote up
public I18NBundle getI18n() { return localeService.getI18nBundle(); }