Products.cmfplone: Merge translations into plone.app.locales

Created on 15 Sep 2015  路  64Comments  路  Source: plone/Products.CMFPlone

We have some packages that started their lives as non-core addons, but didn't merge their translations into plone.app.locales when they were added to core.

See:

  • [X] plone/plone.app.discussion#66
  • [x] plone/plone.app.event#181
  • [x] plone/plone.app.dexterity#158
  • [x] plone/plone.app.multilingual#191
  • [x] plone/plone.app.versioningbehavior#19
  • [X] plone/plone.app.lockingbehavior#3
  • [x] plone/plone.schemaeditor#34
  • [ ] zopefoundation/plone.z3cform (still no ticket, pending an answer on plone/buildout.coredev#139)
  • [X] plone/plone.schema#2
  • [x] plone/plone.formwidget.recurrence#19
  • [x] plone/plone.formwidget.namedfile#19 (and the previous pr)
  • [x] plone/plone.formwidget.datetime#16
  • [x] plone/plone.formwidget.autocomplete#17
  • [x] plone/plone.formwidget.contenttree#22
  • [x] plone/plone.app.caching#20 (plone.app.caching.po files in plone/app/locales/locales-addons but need to be moved to plone domain)
  • [X] plone/plone.app.referenceablebehavior#7
  • [x] plone/plone.app.widgets#125 (python part, js already in widgets.pot generated from mockup)
  • [X] plone/plone.cachepurging#4
  • [x] plone/plone.caching#2
  • [x] plone/plone.dexterity#79
  • [X] plone/plone.directives.form#4
  • [x] plone/Products.CMFDiffTool#31

[edit by @jensens] added 2 packages
[edit by @gforcada] added a bunch more

HOW TO
[remixed by @gforcada from https://github.com/plone/plone.app.event/issues/181#issuecomment-96406149 thanks @vincentfretin]

  • get a working buildout.coredev checkout
  • checkout the target package (./bin/develop co $PACKAGE_NAME)
  • modify the target package to use the plone domain (see https://github.com/plone/plone.app.discussion/commit/0713bcd8bc14a9f8d7fd5bb7f80083871d465435 and https://github.com/plone/plone.app.discussion/commit/19fe2549163ebe7effb844b5d456680a51bca1f9)
  • modify experimental/i18n.cfg in buildout.coredev 5.1 to include the target package in plone domain. See https://github.com/plone/buildout.coredev/commit/802549d6da0609063cd3edaf6099ec356e5354ca
  • run bin/buildout -c experimental/i18n.cfg on buildout.coredev 5.1
  • use bin/i18n plone to regenerate plone.pot and resync plone files. (If there is any removed messages, be sure to look if this is normal, it may be an issue you have to fix before continuing your work)
  • use bin/i18ndude admix command to transfer translated messages from the target package to plone.po for each language. Something like this:
P_A_LOCALES="src/plone.app.locales/plone/app/locales/locales"
TARGET_PACKAGE="src/plone.app.discussion/plone/app/discussion/locales"
PO_FILE="plone.app.discusion.po"
locales=`cd ${TARGET_PACKAGE}; ls | /bin/grep -v .pot`

for locale in $locales;
do
    bin/i18ndude admix ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po ${TARGET_PACKAGE}/$locale/LC_MESSAGES/${PO_FILE} > ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po.tmp
    mv ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po.tmp ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po
done
  • commit, push (on branches) and create pull requests for both the target package and plone.app.locales
  • add an extra commit on the target package to remove the locales folder (don't forget to remove the i18n:registerTranslations directive in configure.zcml)
  • another pull request on buildout.coredev with the experimental/i18n.cfg update
  • they need to be merged all 3 together
  • remember to add changelog entries on the target package and plone.app.locales!
  • last thing: add the pull request on this comment and tick the checkbox!
enhancement low easy

Most helpful comment

All done?!! Cool thanks to everyone for working on this!

Shall the issue be closed then?

All 64 comments

There is also plone.app.multilingual

and maybe plone.app.multilingual and plone.app.versioningbehavior

I found plone.app.contenttypes and plone.app.lockingbehavior not translated.
I'm already translating it.
I will add in plone.app.locales.
The files "plone.app.contenttypes.pot" and "plone.app.lockingbehavior" has to be created inside locales-addons? Correct ?

plone.app.contenttypes are mainly in the plone i18n-domain. Is there an own plone.app.contenttypes i18n-domain defined somehwere? if yes: create a pot file for it.

plone.app.versioningbehavior is translated here:
https://github.com/plone/plone.app.versioningbehavior/tree/master/plone/app/versioningbehavior/locales
So files has just to be copied over to plone.app.locales and removed at the original place.

plone.app.contenttypes translations are in the plone domain in plone.app.locales.

Is it better to change "plone.app.contenttypes" domain at the file plone.app.contenttypes/plone/app/contenttypes/behaviors/configure.zcml to "plone"?

plone.app.lockingbehavior has one string Locking ind the domain plone.app.lockingbehavior - I propose to change the zcml and put it into the plone domain and translate it there.

+1 for using not that many i18n-domains.
if there are less than 5-10 messages i'd not use an own file.

+1

yes please change to i18n_domain="plone" in configure.zcml if it's still i18n_domain="plone.app.contenttypes"

Okay! I changed i18n_domain and should I change plone.app.lockingbehavior too ?

yes please.

On a fully checked out buildout.coredev (see branch all-sources) there were quite a few more packages that were defining their own translation domain.

I added all of them on the first message, edit and fix at will :-)

In product plone.app.referenceablebehavior I will to change the zcml and put it into the plone domain and translate it there. And I will delete locales folder and edit configure.zcml removing reference for folder.

And I will merge french translation.

Since 3.4.5 i18ndude supports chameleon, so there should be no need to "modify your local zope.tal".

This lines should also go:

Thanks @ale-rt I didn't see the new version, I updated the instructions in the i18n.cfg file.

@gforcada Thanks for beginning this work. I'm glad I'm not the only one anymore to know how to update Plone translations.
For the script in the first comment, I think it's not complete. This:

    bin/i18ndude admix ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po ${TARGET_PACKAGE}/$locale/LC_MESSAGES/${PO_FILE} > ${P_A_LOCALES}/$locale/LC_MESSAGES/${PO_FILE}.po

should be:

    bin/i18ndude admix ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po ${TARGET_PACKAGE}/$locale/LC_MESSAGES/${PO_FILE} > ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po.tmp
    mv ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po.tmp ${P_A_LOCALES}/$locale/LC_MESSAGES/plone.po

I edited the first comment with this solution.

@vincentfretin the mv is on the next bullet point :-) I just removed it because now is redundant

We should do a i18ndude find-untranslated on all packages too. I did it only for Products.CMFPlone at the ploneconf sprints and fixed several issues.

@vincentfretin that's something that's most probably suited for jenkins to do, running it once per week and sending an email to (who?) would be enough?

plone.app.caching translations are currently in plone.app.locales/plone/app/locales/locales-addons

I'm not sure about the plone.app.widgets package. Do we have messages there that is not in the "widgets" domain (pot file generated from the mockup repo)?

BTW, plone.app.lockingbehavior, plone.app.referenceablebehavior and some other packages are not part of Plone core, but are in the Ecosystem section (see versions.cfg). Do we really include them in plone.app.locales?

I'm in favor of including ecosytem packages in plone.app.locales to increase the visibility for translators. Generally it's 2 or 5 messages in each package. There was only the French translation in plone.app.referenceablebehavior for example. :)

hi @vincentfretin - when I run bin/i18n plone as described in the howto above, I have o lot of changes (87), that are not related what I was working on. I'm not sure how to go about this. Do you have any suggestions?

@staeff Yeah, there are lots of messages from permission zcml directive, we working on this https://github.com/collective/i18ndude/pull/31

Do this and you'll be set:

cd src/plone.app.locales
git checkout .
git pull
cd ../..
cd src/i18ndude
git checkout 85c6884ec93eb5fca3c421006a4e29565769d148

This will uses the commit before the latest commit of the i18ndude maurits-extract-zcml branch.
You should have 0 new message, 0 removed with this.

@staeff you should now remove src/i18ndude and rebuildout. (the branch was force pushed)

For those who are working on this. I don't follow continuously the activity here. Please merge your PRs yourself when you're done. If you are not sure, ping me or @gforcada and we will give you a go to merge. More importantly when you do the plone.app.locales PR, don't wait too long to merge it because it will expire quickly (no automatic merge) and you will have to redo your work.
Please update the todo list in the first comment as well. Thanks.

@vincentfretin there are a bunch of PR open regarding this move by different people. Self-merge is usally not what we want. I lost a bit track here. May I ask you to merge them if all is fine from your POV?

Sure It would help if the persons doing PR reference this issue.

full ack, this is overall always a good way to keep things together.

We now use i18ndude master, the zcml branch has been merged.

@vincentfretin - moved plone/plone.formwidget.recurrence translations to p.a.locales. This are the related pull requests:
https://github.com/plone/buildout.coredev/pull/166
https://github.com/plone/plone.formwidget.recurrence/pull/19
https://github.com/collective/plone.app.locales/pull/94

@vincentfretin - Use plone i18n domain for plone.formwidget.namedfile. This are the related pull requests:
https://github.com/plone/buildout.coredev/pull/168
https://github.com/plone/plone.formwidget.namedfile/pull/18
https://github.com/collective/plone.app.locales/pull/95

merged. @staeff can you edit the first comment of this issue to check the packages you did? Thanks.

@vincentfretin thanks for merging. Yes I'll update the first comment. Also: I forgot some changes and you already merged. Could you review https://github.com/plone/plone.formwidget.namedfile/pull/19 and merge if its ok. Thank you!

@vincentfretin - Use plone i18n domain for plone.formwidget.datetime. This are the related pull requests:
https://github.com/plone/buildout.coredev/pull/170
https://github.com/plone/plone.formwidget.datetime/pull/16
https://github.com/collective/plone.app.locales/pull/96

@vincentfretin - Use plone i18n domain for plone.formwidget.datetime. This are the related pull requests:
https://github.com/plone/plone.formwidget.autocomplete/pull/17
Since there were no translation file in this products, its only this single pr.

@vincentfretin - Use plone i18n domain for plone.caching. This are the related pull requests:
https://github.com/plone/plone.caching/pull/2
Since there were no translation file in the product, its only this single pr.

As @mauritsvanrees said in https://github.com/plone/plone.formwidget.autocomplete/pull/17 plone.formwidget.autocomplete master is used in Plone 4.3.x as well.
Instead of maintaining a branch of plone.formwidget.autocomplete just for the translations in Plone 4.3.x, I suggest to include them in plone.app.locales 4.3.x as well.
It should be the case for plone.formwidget.namedfile and plone.formwidget.datetime too.
Did I forget a package that use master for both Plone 4.3 and Plone 5?
Commits will follow.

@mauritsvanrees It should be good now.

@vincentfretin Very good. Thank you!

@vincentfretin I'm not clear about the background of this change, but your commit in plone.formwidget.datetime to depend on plone.app.locales >= 4.3.9 broke Plone 4.3 buildouts that include plone.app.contenttypes (1.1.x):

Version and requirements information containing plone.app.locales:
  [versions] constraint on plone.app.locales: 4.3.7
  Requirement of Products.CMFPlone: plone.app.locales
  Requirement of plone.formwidget.datetime[z3cform]: plone.app.locales>=4.3.9
  Requirement of plone.formwidget.datetime>=1.1: plone.app.locales>=4.3.9
  Requirement of plone.app.locales: setuptools
While:
  Installing instance.
Error: The requirement ('plone.app.locales>=4.3.9') is not allowed by your [versions] constraint (4.3.7)

For example, the plone.app.contenttypes 1.1.x buildout will fail like that.


http://dist.plone.org/release/4.3-latest/versions.cfg pins

plone.app.contenttypes = 1.1b5
plone.app.event = 1.1.5
plone.app.locales = 4.3.7

_(Let me know if you'd like me to open up a separate issue for this somewhere - I'll then move my comment accordingly)._

@lukasgraf The explicit dependency is intentional so you don't end up with the datetime widget only in English. I want the buildout to fail :) Several solutions here:

  • pin plone.formwidget.datetime to 1.2 (instead of 1.3 you get when you don't pin)
  • pin plone.app.locales to 4.3.9
  • wait Plone 4.3.8 to be released which include plone.app.locales 4.3.9

Moving plone.app.multilingual translations into plone.app.locales:

plone.app.multilingual master is used both for Plone 5.0.x and 5.1.x, so I included the translations in both 5.x and master branches of plone.app.locales.

https://github.com/plone/plone.app.multilingual/pull/306

https://github.com/collective/plone.app.locales/pull/200
https://github.com/collective/plone.app.locales/pull/201

https://github.com/plone/buildout.coredev/pull/429
https://github.com/plone/buildout.coredev/pull/430

LGTM @erral If nobody disagree, you can merge all those PR.

Sorry, it's not unrelated. I have a missing msgid to move

OK, p.a.multilingual tests are expected to fail until all pull requests are merged, because they depend on a translation coming from plone.app.locales. So I'm merging them.

@erral Thanks for your work. You should start merging all those PR before you have any conflicts.

Thanks for your guide too, it was very useful to get things done.

I also created a PR to include those files in 5.2 branch of coredev: https://github.com/plone/buildout.coredev/pull/440

Yes indeed, it should be in sync with 5.1 branch, thanks.

All done?!! Cool thanks to everyone for working on this!

Shall the issue be closed then?

On the list above there is stille an open thing: plone.z3cform, but it's still an open issue whether it should be moved to plone organisation or not.

Well, then we can close it and add on that ticket that as soon as we move it, if we ever do, translations should also get merged into plone.app.locales.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hvelarde picture hvelarde  路  4Comments

hvelarde picture hvelarde  路  3Comments

pbauer picture pbauer  路  6Comments

mauritsvanrees picture mauritsvanrees  路  4Comments

davisagli picture davisagli  路  4Comments