10-28-2020 05:45 AM
nuxeo-wopi addon does not declare any package dependencies. However, it obviously depends on nuxeo-web-ui, since the latter includes the strings used for tooltips: wopiLink.*
in i18n/messages.json, that ends up in nuxeo.war/ui. These tooltips are generated also in that package: see _wopiTooltip.
This raises the question, when I want to prepare a simple addon atop of the nuxeo-wopi (so my addon depends on it), how do I provide more strings to the nuxeo.war/ui/i18n/messages.json
? My package does not include any jar packages, and only adds some icons to ${env.home}/nuxeo.war/ui/images
, and a config to ${env.config}
, using copy
scripting command.
But there seems to be no scripting command to extend existing json files; adding another json file to that directory is ignored by nuxeo; and manually editing the json gets overwritten on server restart.
What is the correct way to add some strings to nuxeo.war/ui/i18n/messages.json
when installing a simple addon?
10-29-2020 05:51 AM
I solved this using following method:
web/nuxeo.war/ui/i18n/messages.json
of the jar
bundledeployment-fragment.xml
in OSGI-INF
of the jar
:<?xml version="1.0"?>
<fragment version="1">
<require>org.nuxeo.web.ui</require>
<install>
<delete path="${bundle.fileName}.tmp"/>
<unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp" prefix="web">
<include>web/nuxeo.war/**</include>
</unzip>
<append from="${bundle.fileName}.tmp/nuxeo.war/ui/i18n/messages.json" to="nuxeo.war/ui/i18n/messages.json"/>
<delete path="${bundle.fileName}.tmp"/>
</install>
</fragment>
update
scripting command in install.xml
of the addon package:<update file="${package.root}/install/bundles" todir="${env.bundles}" />
When I have localized strings, I will add relevant messages-lang.json
to web/nuxeo.war/ui/i18n/
, and append more append
commands to the deployment-fragment.xml
.
10-28-2020 02:41 PM
The i18n in nuxeo-web-ui is implemented in [nuxeo-elements/ui/nuxeo-i18n-behavior.js](https
10-29-2020 04:56 AM
Seems deployment-fragment.xml
's [append](https
10-29-2020 05:51 AM
I solved this using following method:
web/nuxeo.war/ui/i18n/messages.json
of the jar
bundledeployment-fragment.xml
in OSGI-INF
of the jar
:<?xml version="1.0"?>
<fragment version="1">
<require>org.nuxeo.web.ui</require>
<install>
<delete path="${bundle.fileName}.tmp"/>
<unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp" prefix="web">
<include>web/nuxeo.war/**</include>
</unzip>
<append from="${bundle.fileName}.tmp/nuxeo.war/ui/i18n/messages.json" to="nuxeo.war/ui/i18n/messages.json"/>
<delete path="${bundle.fileName}.tmp"/>
</install>
</fragment>
update
scripting command in install.xml
of the addon package:<update file="${package.root}/install/bundles" todir="${env.bundles}" />
When I have localized strings, I will add relevant messages-lang.json
to web/nuxeo.war/ui/i18n/
, and append more append
commands to the deployment-fragment.xml
.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.