Reputation: 2667
I have a requirement wherein I have to make sure that installed package should only overwrite content of English translations (i.e. en.xml) not for other translations
I have got following filter
<workspaceFilter version="1.0">
<filter root="/apps/project">
<exclude pattern="/apps/project/i18n/(.*)?" />
<include pattern="/apps/project/i18n/*en(.?xml)" />
</filter>
</workspaceFilter>
But somehow I am not able to avoid en_gb
getting overwritten. I tried following filters:
/apps/uag-vrm-portal/i18n/*en(.?xml)
/apps/uag-vrm-portal/i18n/en(.xml*)
Upvotes: 0
Views: 3850
Reputation: 7090
Maybe I miss something, but why can't you set the filter to the en
node only and exclude the other english language nodes?
<workspaceFilter version="1.0">
<filter root="/apps/project/i18n/en">
<exclude pattern="/apps/project/i18n/en_.*"/>
</filter>
</workspaceFilter>
If you need all the other languages, except en_gb
you could exclude this explicitly.
Upvotes: 0
Reputation: 81
I think the problem here is the wide filter "/apps/project". What it is trying to do is, on installing the package, it is just adding a node named "apps" and then adding a node named "apps/project" and then it is replacing everything that is under "/apps/project". So, you need to make your filter more specific. For example, the following should work in your case -
<workspaceFilter version="1.0">
<filter root="/apps/project/i18n">
<exclude pattern="/apps/project/i18n(/.*)?"/>
<include pattern="/apps/project/i18n/en(/.*)?"/>
</filter>
</workspaceFilter>
Upvotes: 1
Reputation: 1077
I recommend avoiding a mix of include & exclude rules inside a single filter. You could break it up into multiple filters:
<workspaceFilter version="1.0">
<filter root="/apps/project/components" />
<filter root="/apps/project/core" />
<filter root="/apps/project/i18n/en/(.*)" />
</workspaceFilter>
or try to write with only exclude patterns:
<workspaceFilter version="1.0">
<filter root="/apps/project">
<exclude pattern="/apps/project/i18n/es(.*)?" />
<exclude pattern="/apps/project/i18n/en_gb(.*)?" />
</filter>
</workspaceFilter>
or write multiple include patterns (an exercise I leave to you).
But the combination of include
and exclude
patterns are fighting each other - with no way to determine which pattern takes precedence.
Upvotes: 1