bin/i18n-build: package translation script #1

Merged
merged 39 commits into from Mar 5, 2014

Conversation

Projects
None yet
2 participants
@jone
Member

jone commented Mar 3, 2014

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 Feb 6, 2014

Recipe: only install bin/masstranslate script.
This allows us to have multiple scripts but install only the necessary ones.
@deiferni

This comment has been minimized.

Show comment
Hide comment
@deiferni

deiferni Mar 5, 2014

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/command.py", 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/command.py", 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/i18ntools.py", 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/discovery.py", line 29, in discover_package
    group['locales']))
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
Member

deiferni commented Mar 5, 2014

@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/command.py", 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/command.py", 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/i18ntools.py", 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/discovery.py", line 29, in discover_package
    group['locales']))
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
@jone

This comment has been minimized.

Show comment
Hide comment
@jone

jone Mar 5, 2014

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 😉

Member

jone commented Mar 5, 2014

@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 😉

@deiferni

This comment has been minimized.

Show comment
Hide comment
@deiferni

deiferni Mar 5, 2014

Member

😄 👍 thx!

Member

deiferni commented Mar 5, 2014

😄 👍 thx!

deiferni added a commit that referenced this pull request Mar 5, 2014

Merge pull request #1 from 4teamwork/package-translations
bin/i18n-build: package translation script

@deiferni deiferni merged commit 14c4b15 into master Mar 5, 2014

1 check passed

default CI Status: 1 SUCCESS
Details

@deiferni deiferni deleted the package-translations branch Mar 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment