0

嗨,我正在使用 liferay 版本 6.1.2 ce GA3。

我注意到,当我创建自己的结构并且它们包含选择中断时,其中的内容是不可翻译的。

选择中断中的每个内容都可以标记为“可本地化”,但即使我这样做,当我尝试添加翻译时,弹出窗口也是空的,只有网络内容的标题。

对我来说,自从我从 6.1.1 CE GA2 升级后就出现了这个问题,但我注意到即使使用全新的全新安装,它也是一样的。

希望有人可以在这里帮助我。

在 Issuetracker 上添加了 Ticket 在此处输入链接描述

4

1 回答 1

0

Liferay 6.1 中的国际化(i18n)完整的工作程序

我的项目名称是 AUIproj。

在 Language.properties 中,我们要翻译哪些标签或数据,然后我们必须在此文件中写入。假设在我的 AUIproj 中,我只想更改标签的名称和标题,所以我们必须按照以下步骤操作: 第 1 步:首先在 docroot/WEB-INF/src 中创建一个文件夹,名称为 content 文件夹,位于 content 文件夹中,创建文件Language.properties。

第 2 步:将此内容复制到 Language.properties

javax.portlet.title=AUI Portlet
product-name=Product Name
product-serial=Product Serial

第 3 步:右键单击项目,然后构建语言许多支持的语言文件将自动在您的内容文件夹中创建,并且所有文件都包含与 Language.properties 文件中相同的内容。

第 4 步:现在我们只需在该特定文件上写入该特定标签名称并更改该位置的内容。使用谷歌翻译器并将它们粘贴为我刚刚在印地语文件中写的印地语,如

javax.portlet.title=भाषा
product-name=उत्पाद नाम
product-serial=उत्पाद धारावाहिक

印地语语言文件的名称是 Language_hi_IN.properties。

在 init.jsp 中,我通过 import 语句声明了很多 taglib、很多 java 类。

初始化.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/security" prefix="liferay-security" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="java.util.Collections" %>
<%@ page import="com.liferay.portal.kernel.util.HtmlUtil" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@ page import="com.liferay.portal.kernel.util.CalendarFactoryUtil" %>
<%@ page import="com.liferay.portal.kernel.dao.search.ResultRow" %>
<%@ page import="com.liferay.portal.kernel.dao.search.SearchEntry" %>
<%@ page import="com.liferay.portal.kernel.exception.SystemException" %>
<%@ page import="com.liferay.portal.kernel.util.WebKeys" %>
<%@ page import="com.liferay.portal.security.permission.ActionKeys" %>
<%@ page import="com.liferay.portal.kernel.util.ListUtil" %>
<%@ page import="com.liferay.portal.service.permission.PortalPermissionUtil" %>
<%@ page import="com.liferay.portal.service.permission.PortletPermissionUtil" %>
<%@ page import="javax.portlet.PortletURL" %>
<liferay-theme:defineObjects />

在 view.jsp 中刚刚导入了 init.jsp view.jsp

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ include file="init.jsp" %>
<portlet:defineObjects />

This is the <b>AUI Portlet</b> portlet in View mode.

<portlet:actionURL name="addProduct" var="addProductURL" />
   <aui:form action="<%= addProductURL.toString() %>" method="post">
       <aui:fieldset>
           <aui:input name="productName" />
           <aui:input name="productSerial" />
           <aui:button-row>
               <aui:button type="submit" />
           </aui:button-row>
       </aui:fieldset>
   </aui:form>

构建.xml

<?xml version="1.0"?>
<!DOCTYPE project>

<project name="AUIproj-portlet" basedir="." default="deploy">
   <import file="../build-common-portlet.xml" />
   <target name="build-lang">
   <antcall target="build-lang-cmd">
   <param name="lang.dir" value="docroot/WEB-INF/src/content" />
   <param name="lang.file" value="Language" />
   </antcall>
   </target>
</project>

将此行粘贴到 portlet.xml 中的标记之后

<resource-bundle>content.Language</resource-bundle>

最后,第一次构建语言,如果您更改属性文件上的任何数据,则构建语言,否则无需一次又一次地构建语言。但是有时它会显示一些警告,例如将来......属性文件将被修改以便再次构建语言,这一次印地语属性文件的内容不会改变。最后进入liferay的控制面板->测试测试->我的账户->杂项->显示设置->语言选择印地语,你可以看到标题,我们的标签会变成印地语。如果您遇到任何问题,请与我分享谢谢和问候 asif aftab

于 2013-12-22T14:34:07.440 回答