views:

46

answers:

0

While trying to internationalize my pylons web and mobile application, 'myapp', Im finding that I would like to keep separate gettext pot files for separate domains. There will be common msgid values for both web and mobile users and there will also be unique msgid values that are only translated for web or mobile users. Im expecting localized msgstrs for mobile users will be different (more terse) than the localized msgstrs for normal web users.

The environment is like:

  • the same myapp/controllers will be used for both mobile and web requests.
  • mobile users will have their pages rendered from myapp/templates/mobile
  • normal web users will have their pages rendered from myapp/templates/web

What happens by default:

  • I end up with myapp/i18n/myapp.pot and myapp/i18n/*/LC_MESSAGES/myapp.[pm]o files that contain msgid values from controllers and both sets of templates.

What Im looking for:

  • to set the gettext domain for the user's session when I decide which templates will render their responses.
  • myapp's msgids from controllers and web template extract into myapp/i18n/web.pot
  • myapp's msgids from controllers and mobile templates extract into myapp/i18n/mobile.pot
  • babel's init_catalog, update_catalog, and compile_catalog runs deal with these separate domains and create separate po and mo localization files.

Where Im lost:

  • configuring myapp's setup.cfg and setup.py to deal with separate gettext domains so that I can direct extracted msgid values into a particular pot file based on the path of the python and template files.