Translate Toolkit & Pootle

Tools to help you make your software local

User Tools

March 3 Merge

This is about SVN commit 10328

This is a massive patch which changes a great deal of Pootle's internals.

I apologize profusely, but this code deals with what used to be very tightly coupled components.

A lot isn't working at this point, but the basic unit editing functionality should work.

Big changes

Removed code


The old TranslationProject class has been merged with the TranslationProject Django model.

Files in a project used to maintained in the pofiles member. All files are now stored in a directory tree built from Directory and Store objects. See below.

The corresponding code in ./ has been moved to ./pootle_app/


Django models


This is now represented by only class (in previous commit, this was represented by two classes, each of which was called TranslationProject; the first was the in memory structure which was derived from the old code base and the second was the Django model).

This model is found in pootle_app/

Directory & Store

Pootle now models directories using the Directory model and filenames (and file metadata) using the Store model.

Pootle maintains a single large tree of Directory and Store objects, which corresponds to the URL layout of objects in Pootle. A Pootle URL has the form <language>/<project>/<relative_object_path> (for example en/pootle/foo.po or en/pootle/bar/baz.po, where 'en' is the langauge code and where 'pootle' is the project code). Thus, the tree looks something like:

  |- en
  |   |- pootle
  |   |   |- foo.po
  |   |   `- bar.po
  |   |
  |   `- terminology
  |       `- baz.po
  |- fr
  |   |- pootle
  |   |   |- foo.po
  |   |   `- bar.po
  |   |
  |   `- terminology
  |       `- baz.po
  `- zh
      |- pootle
      |   |- foo.po
      |   `- bar.po
      `- terminology
          `- baz.po

This tree does not match the layout of non-gnu nor gnu-style projects. The real pathname of a file (relative to the root of the Pootle project directory) is stored in Store.real_path.

The reason for this scheme is that Pootle can support any directory layout, without having to know anything about the layout - only the code which synchronizes the in-database Directory layout with the actual on-disc files needs know anything about the layout.


A set of rights is now modelled using the PermissionSet model. This model associates a PootleProfile and a Directory with lists of positive and negative Permission (this is a standard Django model) objects



In Pootle, views create very large nested structures of Python dictionaries which are used by the templates. The current changes generally stick to this mechanism. In the future, it might be good to create “widgets” (these can possibly derive from Django's widget classes, but it's not strictly necessary) which will be created in views and passed to templates. This would have the advantage of clearly indicating intent (since it's very difficult to know how data relates if you get so many nested dictionary).


The old code for was all located in ./ (now a lot of the old code is unused, and it should be removed).

The old code would just pass a filesystem path to TranslatePage. It was the job of TranslatePage to determine whether the user was busy enumerating translation files in a directory or whether the user was just viewing a single file.


Common code


Replaced the code which added data for the search forms to the template variables with Django forms.

These forms are located in ./pootle_app/views/common/


In a file index view (i.e. somewhere like /en/pootle or /fr/terminology/foo/bar), each displayed filename and directory, along with all the displayed operations (such as “Quick Translate” and “Download PO File”) is called an “item”.

This code used to be located in (much of the old code is likely still there).

The code that creates these data is located in ./pootle_app/views/common/

Navigation bar

The navigation bar appears at the top of file index views and translation views. It is used to display the current path, and data relating to the current directory/file.

This code used to be located in (much of the old code is likely still there).

The new code is in ./pootle_app/views/common/


Replaced the search code with Django forms

Other code


Model relationships