mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-09 01:14:16 +08:00
refactor: 优化
This commit is contained in:
@@ -10,6 +10,8 @@ import java.util.Map;
|
||||
*
|
||||
* @author zhouhao
|
||||
* @since 4.0.18
|
||||
* @see SingleI18nSupportEntity
|
||||
* @see MultipleI18nSupportEntity
|
||||
*/
|
||||
public interface I18nSupportEntity {
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.hswebframework.web.i18n;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
public interface MultipleI18nSupportEntity extends I18nSupportEntity {
|
||||
|
||||
Map<String, Map<String, String>> getI18nMessages();
|
||||
|
||||
@Override
|
||||
default Map<String, String> getI18nMessages(String key) {
|
||||
Map<String, Map<String, String>> source = getI18nMessages();
|
||||
if (MapUtils.isNotEmpty(source)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
return source.get(key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.hswebframework.web.i18n;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface SingleI18nSupportEntity extends I18nSupportEntity {
|
||||
|
||||
Map<String, String> getI18nMessages();
|
||||
|
||||
default Map<String, String> getI18nMessages(String key) {
|
||||
return getI18nMessages();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user