Skip to content


bin/i18n-build: package translation script #1

merged 39 commits into from

2 participants

4teamwork AG member

This adds a new recipe, building a bin/i18n-build script.
The script is used for rebuilding the primary pot-file and syncing all po-files.
Also translations into new languages can be created.

See the README changes for documentation of how it works.

/cc @deiferni

jone and others added some commits
@jone jone Rename bin/translations to bin/masstranslate. cbe5ee3
@jone jone Recipe: only install bin/masstranslate script.
This allows us to have multiple scripts but install only the necessary ones.
@jone jone Move masstranslate command and recipe to seperate masstranslate module. e5341b3
@jone jone Cleanup recupe test: remove unused buildout config. b5c10fb
@deiferni deiferni Extract messages from initial inflator content. 71c6cba
@deiferni deiferni Improve inflator translation extraction tests. 960ac62
@jone jone Add a ftw.recipe.translations:package recipe creating a bin/i18n-build f8ef283
@deiferni deiferni Use gplv2 as stated in readme. 6647a0b
@jone jone Fix masstranslate imports. 465371c
@deiferni deiferni Rename profiles dir to package dir. 138b363
@jone jone discovery: add a discover_package function. 9c76baf
@jone jone Mockup i18nbuild command. 5dc9225
@jone jone Move build / sync helpers to i18ntools module. f516dae
@jone jone i18nbuild: add buildout directory path as argument. f331719
@jone jone Masstranslater sync: add tests testing path comments. ee533bb
@jone jone Refactor pot files building into i18ntools module. e1024ae
@deiferni deiferni First implementation of i18n-build command. 9304d01
@jone jone Extend discovery to discover -content.pot files (ftw.inflator). 27ce11a
@jone jone Merge "-content.pot" files when rebuilding pot-files. df12a4f
@deiferni deiferni Use variable names consistently. 04d6e32
@jone jone i18nbuild: implement syncing and add tests. a780309
@jone jone i18nbuild command: fix buildout_dir argument name in recipe. ba628a1
@jone jone Use package_namespace from buildout for package directory discovery. 8ce3a0a
@jone jone i18nbuild: fix new languages argument access. 9c7d163
@jone jone Fix package root issues when rebuilding pot files. 0bb22fc
@jone jone Fix package root issues when rebuilding pot files. 7805355
@jone jone Fix default values in i18nbuild recipe. 9db0ce8
@jone jone Fix dotted package namespaces in package directory finder. cadac18
@jone jone i18nbuild: fix stdout problem. 2569e22
@jone jone i18nbuild: fix syncing .po-files. 102e3c6
@jone jone Add integration test. c07fbd6
@jone jone Cleanup: pep8. a354248
@jone jone Handle i18ndude system exits. 91556f4
@jone jone i18nbuild: fix path scope when building pot files. eb5519a
@jone jone Merge branch 'master' into package-translations 6e9b9fa
@jone jone i18n-build: print message when rebuilding. 4177e53
@jone jone i18n-build: fix bug which did only sync new languages. 91f26dd
@jone jone Document i18n-build recipe and script. 1f82bae
4teamwork AG member

@jone: i get the following error if i don't configure package-namespace. Maybe a side-effect when used along with collective.recipe.omelette?

Traceback (most recent call last):
  File "bin/i18n-build", line 40, in <module>
    sys.exit(ftw.recipe.translations.i18nbuild.command.main(i18n_domain="", package_dir="", buildout_dir="/Users/deif/Files/workspaces/cipra.web", package_name="cipra.web", package_namespace=""))
  File "/Users/deif/Files/workspaces/cipra.web/src/ftw.recipe.translations/ftw/recipe/translations/i18nbuild/", line 33, in main
    build_translations(package_dir, package_root, i18n_domain, new_languages)
  File "/Users/deif/Files/workspaces/cipra.web/src/ftw.recipe.translations/ftw/recipe/translations/i18nbuild/", line 40, in build_translations
    rebuild_package_potfiles(package_root, package_dir, i18n_domain)
  File "/Users/deif/Files/workspaces/cipra.web/src/ftw.recipe.translations/ftw/recipe/translations/", line 18, in rebuild_package_potfiles
    for group in discover_package(package_dir, None):
  File "/Users/deif/Files/workspaces/cipra.web/src/ftw.recipe.translations/ftw/recipe/translations/", line 29, in discover_package
ValueError: Unexpected locales directory parts/omelette/cipra/web/locales for file /Users/deif/Files/workspaces/cipra.web/parts/omelette/cipra/web/locales/de/LC_MESSAGES/cipra.web.po; expected locales directory to be cipra/web/locales
4teamwork AG member

@deiferni I've fixed this bug, the problem was an early loop exit when finding the package directory because os.path.exists('') is usually True :wink:

4teamwork AG member

:smile: :thumbsup: thx!

@deiferni deiferni merged commit 14c4b15 into master

1 check passed

Details default CI Status: 1 SUCCESS
@deiferni deiferni deleted the package-translations branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 6, 2014
  1. @jone
  2. @jone

    Recipe: only install bin/masstranslate script.

    jone committed
    This allows us to have multiple scripts but install only the necessary ones.
  3. @jone
  4. @jone
  5. @deiferni
  6. @deiferni
  7. @jone
  8. @deiferni
  9. @jone

    Fix masstranslate imports.

    jone committed
  10. @deiferni
  11. @jone
  12. @jone

    Mockup i18nbuild command.

    jone committed
  13. @jone
  14. @jone
  15. @jone
  16. @jone
  17. @deiferni
  18. @jone
  19. @jone
  20. @deiferni
  21. @jone
  22. @jone
  23. @jone
  24. @jone
  25. @jone
  26. @jone
  27. @jone
  28. @jone
  29. @jone

    i18nbuild: fix stdout problem.

    jone committed
  30. @jone

    i18nbuild: fix syncing .po-files.

    jone committed
  31. @jone

    Add integration test.

    jone committed
  32. @jone

    Cleanup: pep8.

    jone committed
  33. @jone

    Handle i18ndude system exits.

    jone committed
  34. @jone
Commits on Feb 26, 2014
  1. @jone
Commits on Mar 3, 2014
  1. @jone
  2. @jone
  3. @jone
Commits on Mar 5, 2014
  1. @jone
Something went wrong with that request. Please try again.