You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
629 B
21 lines
629 B
package com.community.pocket.util;
|
|
|
|
import com.community.pocket.entity.vo.android.CustomMessage;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.MessageSource;
|
|
import org.springframework.context.i18n.LocaleContextHolder;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
/**
|
|
* 国际化配置
|
|
*/
|
|
@Service
|
|
public class MessageService {
|
|
|
|
@Autowired
|
|
private MessageSource messageSource;
|
|
|
|
public <T extends CustomMessage> String getMessage(T code, Object... args) {
|
|
return messageSource.getMessage(code.toString(), args, LocaleContextHolder.getLocale());
|
|
}
|
|
}
|
|
|