Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-3603

localization needed

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Patch Available
    • Major
    • Resolution: Fixed
    • 1.1.0
    • None
    • Core UI

    Description

      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'));

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              1925432244@qq.com PetterWang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m