Ning Sheng created NIFI-4785:
--------------------------------
Summary: localization needed
Key: NIFI-4785
URL: https://issues.apache.org/jira/browse/NIFI-4785
Project: Apache NiFi
Issue Type: New Feature
Components: Core UI
Affects Versions: 1.5.0
Reporter: Ning Sheng
JSP :
1.Use the JSTL standard fmt tag for multilingualization
1.The resource file is placed under the org.apache.nifi.web.resources package
2.Resource file name rules Messages_en.properties English resource file,
Messages_cn.properties for Chinese resource file
Bulletin-board-content-bullet-bullet-bullet-shell-content-bullet
3.Will be around the jsp Chinese characters in accordance with <fmt: message
key = "canvas.about-dailog.nf-version" /> replace
2.In nifi-web-ui in the web.xml configuration in the following content
specified properties file location, has been used language
<Context-param>
<Param-name> javax.servlet.jsp.jstl.fmt.localizationContext </ param-name>
<Param-value> org.apache.nifi.web.resources.Messages </ param-value>
</ Context-param>
<Context-param>
<Param-name> javax.servlet.jsp.jstl.fmt.locale </ param-name>
<Param-value> en </ param-value>
</ Context-param>
3.Add the * .properties file to the nifi-web-ui pom.xml war plugin
<Plugin>
<GroupId> org.apache.maven.plugins </ groupId>
<ArtifactId> maven-war-plugin </ artifactId>
<Configuration>
<WebXml> $
{staging.dir}
/WEB-INF/web.xml </ webXml>
<WebResources>
<Resource> <! — newly added part --->
<Directory> src / main / java / org / apache / nifi / web / resources / </
directory>
<TargetPath> WEB-INF / classes / org / apache / nifi / web / resources / </
targetPath>
<Includes>
<Include> *. Properties </ include>
</ Includes>
<Filtering> true </ filtering>
</ Resource>
4.JSP page of the internationalization of the two general situation
1. Directly replace the tag in the text content, for example: replace english
content
<Div> Relationships </ div> Replace with the result
<Div> <fmt: message key = "partials.connection-details.Relationships" /> </ div>
2.Replace the div in the attribute content, for example: replace the test
content
<Img class = "setting-icon icon-info" src = "images / iconInfo.png" alt =
"Info" title = "Relationships" />
<Fmt: message key =
"partials.connection-details.configuration-tab.read-only-relationship-names-container.title"
var = "Relationships"
<Img class = "setting-icon icon-info" src = "images / iconInfo.png" alt =
"Info" title = "$
{Relationships}
" />
3.In the jsp page to increase the fmt reference
<% @ Taglib uri = "http://java.sun.com/jsp/jstl/fmt" prefix = "fmt"%>
4.Properties file rules
There are two rules
Bulletin-board-content-bullet-bullet-bullet-shell-content-bullet
If the text information is not unique xpath or id, you can use the original
information to name enable-controller-service-dialog.Canceling = Canceling ...
JS :
1.Make nf / globalization / resources.js add translation files
2.Global.js initialization, according to the current run of the file name and
messsage to determine the resources to find json
3.Add the resources.js javascript into the war package in pif.xml for
nifi-web-ui
<Plugin>
<GroupId> org.apache.maven.plugins </ groupId>
<ArtifactId> maven-war-plugin </ artifactId>
<Version> 2.5 </ version>
<Configuration>
<PackagingIncludes>
Js / nf / globalization / resources.js
4.Add a reference to resources.js in jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / bulletin-board.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / canvas.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / cluster.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / counters.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / history.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / login.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / provenance.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / summary.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / templates.jsp
Modify: nifi-nar-bundles / nifi-framework-bundle / nifi-framework / nifi-web /
nifi-web-ui / src / main / webapp / WEB-INF / pages / users.jsp
5.Replace the text of js ,like this
$('#message-title').text(nf._.msg('nf-canvas.Browser'));
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)