|
| 1 | +--- |
| 2 | +html_meta: |
| 3 | + "description": "How to create po files from source code." |
| 4 | + "property=og:description": "How to create po files from source code." |
| 5 | + "property=og:title": "Resync translations" |
| 6 | + "keywords": "Plone, Internationalization, i18n, language, translate, content, localization" |
| 7 | +--- |
| 8 | + |
| 9 | +(resync-translations-label)= |
| 10 | + |
| 11 | +## Resync translations |
| 12 | + |
| 13 | +Plone po files need to be updated each time a new string is added into Plone interface, or each time one of those strings is updated. |
| 14 | + |
| 15 | +Usually Translations team handles the update of those po files so you don't need to worry about it. Here we will explain the procedure to update such files. |
| 16 | + |
| 17 | +1. Clone the relevant branch of [buildout.coredev](https://github.com/plone/buildout.coredev) corresponding to the Plone version you want to update. |
| 18 | + |
| 19 | +2. Initialize the buildout. |
| 20 | + |
| 21 | +```bash |
| 22 | +./bootstraph.sh |
| 23 | +``` |
| 24 | + |
| 25 | +3. Run buildout using the `experimental/i18n.cfg` file: |
| 26 | + |
| 27 | +```bash |
| 28 | +./bin/buildout -c experimental/i18n.cfg |
| 29 | +``` |
| 30 | + |
| 31 | +4. Run the `i18n-update-all` script: |
| 32 | + |
| 33 | +```bash |
| 34 | +./bin/i18n-update-all |
| 35 | +``` |
| 36 | + |
| 37 | +The script will go through Plone source code and will update all `pot` and `po` files in the plone.app.locales package. |
| 38 | + |
| 39 | +5. Commit the changes and push back to GitHub: |
| 40 | + |
| 41 | +```bash |
| 42 | +cd src/plone.app.locales |
| 43 | +git add plone |
| 44 | +git commit -m "Update translation files" |
| 45 | +git push origin |
| 46 | +``` |
| 47 | + |
| 48 | +## Create a new plone.app.locales release |
| 49 | + |
| 50 | +Translators will take care of translating `po` files into their languages. When the release manager requests to create a new plone.app.locales release, the procedure is the following: |
| 51 | + |
| 52 | +1. Create a virtualenv with zest.releaser and zest.pocompile installed: |
| 53 | + |
| 54 | +```bash |
| 55 | +`which python3.8` -m venv . |
| 56 | +./bin/pip install zest.releaser zest.pocompile |
| 57 | +source bin/activate |
| 58 | +``` |
| 59 | + |
| 60 | +2. Go to plone.app.locales directory and pull the changes: |
| 61 | + |
| 62 | +```bash |
| 63 | +cd src/plone.app.locales |
| 64 | +git pull |
| 65 | +``` |
| 66 | + |
| 67 | +3. Verify there is a changelog entry for each change, add any missing entries if necessary. |
| 68 | + |
| 69 | + |
| 70 | +4. Verify there is no errors in the po files: |
| 71 | + |
| 72 | +```bash |
| 73 | + for po in `find . -name "*.po"` ; do msgfmt --no-hash -o `dirname $po`/`basename $po .po`.mo $po; done |
| 74 | +``` |
| 75 | + |
| 76 | +You can ignore the errors "'msgid' and 'msgstr' entries do not both end with '\n'". If there are other errors, please fix them. |
| 77 | + |
| 78 | +5. Release: |
| 79 | + |
| 80 | +```bash |
| 81 | +fullrelease |
| 82 | +``` |
| 83 | + |
| 84 | +6. Check that the release is published on pypi: https://pypi.org/project/plone.app.locales/ |
| 85 | + |
| 86 | +7. Inform the release manager about the new version |
0 commit comments