projects

Feeds

Forms

class ProjectAccessControlForm(*args, **kwargs)

Form to handle the Access Control options of a project.

class RadioFieldRenderer(name, value, attrs, choices)

An object used by RadioSelect to enable customization of radio widgets.

get_class(v, v2)

Return the string ‘selected’ if both values are equal.

This is used to set a class attr on the selected radio button.

render()

Outputs a <ul> for this set of radio fields.

Models

class DefaultProjectManager

This is the defautl manager of the project model (asigned to objects field).

maintained_by(user)

Retrieve projects being maintained by the specific user.

translated_by(user)

Retrieve projects being translated by the specific user.

The method returns all the projects in which user has been granted permissions to submit translations.

watched_by(user)

Retrieve projects being watched by the specific user.

class Project(*args, **kwargs)

A project is a group of translatable resources.

>>> p, created = Project.objects.get_or_create(slug="foo", name="Foo Project")
>>> p = Project.objects.get(slug='foo')
>>> p
<Project: Foo Project>
>>> Project.objects.create(slug="foo", name="Foo Project")
Traceback (most recent call last):
    ...
IntegrityError: column slug is not unique
>>> if created: p.delete()
available_languages

Return the languages with at least one Translation of a SourceEntity for all Resources in the specific project instance.

classmethod get_watched(user)

Return list of ‘cls’ objects watched by ‘user’.

cls - is a class model, not an instance. user - is a user object.

is_watched(user, signal=None)

Return a boolean value if an object is watched by an user or not

It is possible also verify if it is watched by a user in a specific signal, passing the signal as a second parameter

num_translated(language)

Return the number of translated strings in all Resources of the project.

num_untranslated(language)

Return the number of untranslated strings in all Resources of the project.

save(*args, **kwargs)

Save the object in the database.

source_strings

Return the list of all the strings, belonging to the Source Language of the Project/Resource.

CAUTION! 1. This function returns Translation and not SourceEntity objects! 2. The strings may be in different source languages!!! 3. The source strings are not grouped based on the string value.

total_entities

Return the total number of source entities to be translated.

trans_percent(language)

Return the percent of untranslated strings in this Resource.

translated_strings(language)

Return the QuerySet of source entities, translated in this language.

This assumes that we DO NOT SAVE empty strings for untranslated entities!

untrans_percent(language)

Return the percent of untranslated strings in this Resource.

untranslated_strings(language)

Return the QuerySet of source entities which are not yet translated in the specific language.

This assumes that we DO NOT SAVE empty strings for untranslated entities!

wordcount

Return the number of words which need translation in this project.

The counting of the words uses the Translation objects of the source languages as set of objects. CAUTION: 1. The strings may be in different source languages!!! 2. The source strings are not grouped based on the string value.

class PublicProjectManager

Return a QuerySet of public projects.

Usage: Projects.public.all()

Views

I18n Library

get_trans_handler(i18n_type)

Return an appropriate TransHandler class.

TransHandler is chosen depending on the component translation type.

It will raise an exception if the Translation type is not specified.

Keyword arguments: i18n_type – The type of the TransHandler, used to decide the class to be returned.

>>> print get_trans_handler('POT')
projects.handlers.trans_handler.TransHandler

Types

POT

Intltool

Management commands