Can't append custom translations to messages properties file

I need to create a custom translation for Nuxeo DM.

I created a bundle to deploy the files but append doesn't work.

I tried the following in deployment-fragment.xml:

Try number 1:

    <unzip from="${bundle.fileName}" to="/" prefix="web">
        <include>/web/nuxeo.war/**</include>
    </unzip>
    <delete path="language.tmp" />
    <mkdir path="language.tmp" />
    <unzip from="${bundle.fileName}" to="language.tmp" prefix="web">
        <include>/web/language/**</include>
    </unzip>
    <append from="language.tmp/language/messages_en.properties"
        to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true" />

try number 2:

<unzip from="${bundle.fileName}" to="/" prefix="web">
  <include>web/nuxeo.war/**</include>
</unzip>

<delete path="${bundle.fileName}.tmp" />
<mkdir path="${bundle.fileName}.tmp" />
<unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp" />

<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages.properties"
  to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true" />
<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_en.properties"
  to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true" />
----------------------------------------------------------

Deploying any of the above will unzip the contents to the right places, so the bundle works, I can even put new files on the deployment but no appending to existing files is done.

Supposely the append command should add the lines from the unzipped file to the messages properties files, but nothing happens although the files are correctly unzipped. There is no error in the server.log file.

I created the bundle following the cookbook example from nuxeo documentation, build the jar using maven and put the jar on the plugins folder.

I'm getting desperate, can you help me.

0 votes

3 answers

3313 views

ANSWER



@patrek: Yes, I look into the file under nxserver/nuxeo.war/WEB-INF/classes/messages_en.properties and nothing changes.

Where do I need to put the sentence? Is it in the deployment-fragment.xml file?

@Julien Carsique: I use the same code and nothing happens. The customized messages_en.properties file is in the following folder of the bundle structure:

/src/main/resources/OSGI-INF/l10n

I assume this is the correct location.

1 votes



Where do I need to put the &lt;required&gt;overriden.contribution&lt;/required&gt; sentence? Is it in the deployment-fragment.xml file?

You must put into the XML fragment like that:

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;fragment version=&quot;1&quot;&gt;
  &lt;require&gt;org.nuxeo.the.bundle.name.you.want.override&lt;/require&gt;
  ...

value contained into the require item is the value of the Bundle-SymbolicName into the MANIFEST.MF of the jar that contains the messages.properties that contains the default value you want override.

12/09/2011


Hello,

The following is appending translations from the bundle to “nuxeo.war/WEB-INF/classes/messages_en.properties”:

  <install>
    <unzip from="${bundle.fileName}" to="/" prefix="web">
      <include>web/nuxeo.war/**</include>
    </unzip>
    <!-- translations -->
    <delete path="${bundle.fileName}.tmp" />
    <mkdir path="${bundle.fileName}.tmp" />
    <unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp" />
    <append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_en.properties"
      to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true" />
    <delete path="${bundle.fileName}.tmp" />
  </install>
0 votes



Did you look into the file under nxserver/nuxeo.war/WEB-INF/classes/messages_en.properties ?

Are you trying to override the translation? In that case, you need to add a <required>overriden.contribution</required> to make sure your translation appears after the original sentences.

0 votes