1

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,这在类属性中是必需的。有没有办法覆盖这个翻译?提前感谢您的帮助!

4

1 回答 1

0

The best solution is to create a translation module which extends from 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);

}

Your module project structure will be like this:

enter image description here

于 2017-07-20T15:29:12.133 回答