Thera是com.liferay.plugins.admin.web
或com.liferay.portal.instances.web
模块中的一些转换,我想覆盖它们。通过其他模块,我成功地完成了本教程:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/overriding-a-modules-language-keys
在这种情况下,com.liferay.plugins.admin.web
模块没有servlet.context.name,这在类属性中是必需的。有没有办法覆盖这个翻译?提前感谢您的帮助!
答案 0 :(得分:0)
最佳解决方案是创建一个从ResourceBundle扩展的翻译模块:
package com.galian.extranet.resourcebundle;
import com.liferay.portal.kernel.language.UTF8Control;
import java.util.Enumeration;
import java.util.ResourceBundle;
import org.osgi.service.component.annotations.Component;
/**
* @author
*
*/
@Component(immediate = true, property = { "language.id=en_US" }, service = ResourceBundle.class)
public class DefaultCustomResourceBundle extends ResourceBundle {
@Override
public Enumeration<String> getKeys() {
return _resourceBundle.getKeys();
}
@Override
protected Object handleGetObject(String key) {
return _resourceBundle.getObject(key);
}
private final ResourceBundle _resourceBundle = ResourceBundle.getBundle("content.Language", UTF8Control.INSTANCE);
}
您的模块项目结构如下: