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

org.thymeleaf.dialect.springdata.util.Messages Maven / Gradle / Ivy

package org.thymeleaf.dialect.springdata.util;

import java.text.MessageFormat;
import java.util.Collections;
import java.util.Locale;
import java.util.ResourceBundle;

public final class Messages {
	private static final String BASE_PATH = "thymeleaf-spring-data-dialect/";
	
	private Messages() {}
	
	public static String getMessage(String bundleName, String key, Locale locale, Object... arguments){
		final String resourceName = Strings.concat(BASE_PATH, bundleName);
		final String msg = ResourceBundle.getBundle(resourceName, locale).getString(key);
		
		return MessageFormat.format(msg, arguments);
	}
	
	public static String getMessage(String bundleName, String key, Locale locale){
		return getMessage(bundleName, key, locale, Collections.EMPTY_LIST);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy