Uploaded image for project: 'Nuxeo Studio'
  1. Nuxeo Studio
  2. NXS-4374

Fix deployment fragment generation with custom deployments

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 73.0.2
    • Fix Version/s: 73.4
    • Component/s: Resources, Studio Packaging

      Description

      USE CASE

      • a Studio project defines translation messages for the English language, so a file messages_en_US.properties was added to the Resources > i18 files.
      • when users use another language (like French), the labels are not translated, because these messages are only appended to messages_en_US.properties and messages_en.properties global files by Studio:
        <install>
          <delete path="${bundle.fileName}.tmp"/>
          <unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp"/>
          <copy from="${bundle.fileName}.tmp/web/nuxeo.war" to="/"/>
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages_en_US.properties" addNewLine="true"/>
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true"/>
          <delete path="${bundle.fileName}.tmp"/>
        </install>
      

      Solution would be to add a new append command to contribute to the default messages.properties file:

      • Go to "Advanced Settings > Deployment Extensions"
      • Add similar instructions:
        <install>
          <delete path="${bundle.fileName}.tmp"/>
          <unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp"/>
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true"/>
          <delete path="${bundle.fileName}.tmp"/>
        </install>
      

      PROBLEM

      The Studio build seems to be confused by these instructions, because the result is not valid in the final deployment-fragment.xml file generated by Studio:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <fragment version="1"> 
        <extension target="application#MODULE"> 
          <module> 
            <java>${bundle.fileName}</java> 
          </module> 
        </extension>  
        <require>all</require>
        <install> 
          <delete path="${bundle.fileName}.tmp"/>  
          <unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp"/>  
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true"/>  
          <delete path="${bundle.fileName}.tmp"/>  
          <delete path="${bundle.fileName}.tmp"/>
        </install>
        <install>
          <delete path="${bundle.fileName}.tmp"/>
          <unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp"/>
          <copy from="${bundle.fileName}.tmp/web/nuxeo.war" to="/"/>
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages_en_US.properties" addNewLine="true"/>
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true"/>
        </install>
      </fragment>
      

      This interferes with proper deployment of the nuxeo.war contributed files.

      Expected result instead:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <fragment version="1"> 
        <extension target="application#MODULE"> 
          <module> 
            <java>${bundle.fileName}</java> 
          </module> 
        </extension>  
        <require>all</require>
        <install>
          <delete path="${bundle.fileName}.tmp"/>
          <unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp"/>
          <copy from="${bundle.fileName}.tmp/web/nuxeo.war" to="/"/>
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages_en_US.properties" addNewLine="true"/>
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true"/>
          <delete path="${bundle.fileName}.tmp"/>
        </install>
        <install> 
          <delete path="${bundle.fileName}.tmp"/>  
          <unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp"/>  
          <append from="${bundle.fileName}.tmp/data/i18n/messages_en_US.properties" to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true"/>  
          <delete path="${bundle.fileName}.tmp"/>  
        </install>
      </fragment>
      

      (added custom contribution at the end, and moved around misplaced "delete" command)

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day
                1d