Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install translationrecorder

How to install translationrecorder

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install translationrecorder
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.0.2
1.0.3Never BuiltWhy not?
1.0.2 Available View build log
1.0 Available View build log
Windows (64-bit)
1.0.2
1.0.3Never BuiltWhy not?
1.0.2 Available View build log
1.0 Available View build log
Mac OS X (10.5+)
1.0.2
1.0.3Never BuiltWhy not?
1.0.2 Available View build log
1.0 Available View build log
Linux (32-bit)
1.0.3 Available View build log
1.0.2 Available View build log
1.0 Available View build log
Linux (64-bit)
1.0.3 Available View build log
1.0.2 Available View build log
1.0 Available View build log
 
Author
License
BSD-like (http://repoze.org/license.html)
Lastest release
version 1.0.3 on Nov 22nd, 2012

Overview

The recorder is attached to an existing translation function keeps track of the inputs and outputs.

The result is a locales directory structure:

<domain>.pot
<lang>/
<lang>/LC_MESSAGES
<lang>/LC_MESSAGES/<domain>.po
...

This structure is written on process exit.

Note that when the recorder is initialized, it imports any existing message catalog. That is, it's robust to process startup/shutdown and can operate continuously.

Usage

In Python-code, enable the translation recorder by wrapping an existing translation function.

The easiest way to wire this up is by patching the module that holds the function (if possible):

import zope.i18n
import translationrecorder

# Patch Zope's translation function
zope.i18n.translate = translationrecorder.Recorder(
    zope.i18n.translate, './locales'
    )

Framework Integration

There's integration included for the Pyramid and Zope/Plone frameworks.

Set the environment variable RECORD_TRANSLATIONS to an existing locales directory and run your server process:

$ mkdir ./locales
$ RECORD_TRANSLATIONS=./locales bin/paster serve ...

This requires that the translationrecorder module is imported. This is handled automatically on Plone. For other systems:

import translationrecorder

Technically, the package applies patches against the global translation functions of the applicable frameworks.

Author

Malthe Borch <mborch@gmail.com>

Changes

1.0.3 (2012-10-17)

  • Fixed an issue where a translation would always appear with a default text, even when not present in catalog.
  • Fixed an issue where a message with a mapping would not get properly decoded into a message id.

1.0.2 (2012-01-13)

  • Fixed issue where a quote appearing in a message id or translation would corrupt on save.

1.0.1 (2012-01-13)

  • Fixed issue where generated .po-files would result in a syntax error on compilation using pythongettext due to a missing initial dummy message translation.

  • Patch the translation domain instead of the (higher-level) global translation function.

    This fixes an issue where messages would not be recorded with the proper translation domain and the used target languages would not be correctly registered.

1.0 (2011-11-28)

  • Initial public release.

Subscribe to package updates

Last updated Nov 22nd, 2012

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.