com.yahacode.hiddenblade.app.support.I18nUtil Maven / Gradle / Ivy
The newest version!
package com.yahacode.hiddenblade.app.support;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
@Component
public class I18nUtil {
private static MessageSource ms;
public I18nUtil(MessageSource ms) {
this.ms = ms;
}
public static String get(String key) {
return get(key, null);
}
public static String get(String key, Object[] args) {
return ms.getMessage(key, args, LocaleContextHolder.getLocale());
}
}