Browse Source
Merge in DESIGN/design from ~OBO/design:feature/x to feature/x * commit '83ad455a6794b2661942849b12b965f32c8c3f51': 配置放在设计器模块 配置放在设计器模块 REPORT-135046 feat:设计器语言切换支持扩展新语种feature/x
Obo-王学仁
2 months ago
3 changed files with 84 additions and 6 deletions
@ -0,0 +1,56 @@ |
|||||||
|
package com.fr.design.i18n; |
||||||
|
|
||||||
|
import com.fr.config.ConfigContext; |
||||||
|
import com.fr.config.DefaultConfiguration; |
||||||
|
import com.fr.config.Identifier; |
||||||
|
import com.fr.config.holder.factory.Holders; |
||||||
|
import com.fr.config.holder.impl.MapConf; |
||||||
|
|
||||||
|
import java.util.Collections; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 设计器语言扩展配置 |
||||||
|
* |
||||||
|
* @author obo |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/09/26 |
||||||
|
*/ |
||||||
|
public class DesignExtendLanguageConfig extends DefaultConfiguration { |
||||||
|
|
||||||
|
private static volatile DesignExtendLanguageConfig designExtendLanguageConfig = null; |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取实例 |
||||||
|
*/ |
||||||
|
public static DesignExtendLanguageConfig getInstance() { |
||||||
|
if (designExtendLanguageConfig == null) { |
||||||
|
designExtendLanguageConfig = ConfigContext.getConfigInstance(DesignExtendLanguageConfig.class); |
||||||
|
} |
||||||
|
return designExtendLanguageConfig; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 设计器扩展的语言 |
||||||
|
* key为localeString,例如en_US或en;value为改语言对应的国际化翻译key |
||||||
|
*/ |
||||||
|
@Identifier("extendDesignLocales") |
||||||
|
private MapConf<Map<String, String>> extendDesignLocales = Holders.map(new HashMap<>(), String.class, String.class); |
||||||
|
|
||||||
|
public Map<String, String> getExtendedDesignLocales() { |
||||||
|
return Collections.unmodifiableMap(extendDesignLocales.get()); |
||||||
|
} |
||||||
|
|
||||||
|
public void setExtendedDesignLocales(Map<String, String> map) { |
||||||
|
extendDesignLocales.set(map); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Object clone() throws CloneNotSupportedException { |
||||||
|
DesignExtendLanguageConfig cloned = (DesignExtendLanguageConfig) super.clone(); |
||||||
|
cloned.extendDesignLocales = ( MapConf<Map<String, String>>) extendDesignLocales.clone(); |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue