A POFile is a representation of a PO file structure.
It can either be a real PO file on a repository, a dynamically-generated one, etc. It represents the translation of a component to a language. The model’s basic use is the calculation of translation statistics.
Define the testing suite for Django’s test runner.
Enables test execution with ./manage.py test <appname>.
Implement TransManager-type-agnostic browser functionality.
This mixin class provides methods common to all types of TransManager
A browser class for Managing POT files.
Parameter: full_name: Name used for identifying set of msgmerged files related to POT/PO
files found in path.
path: Diretiry base where the POT/PO files can be found. source_language: The code of the source language. Usually it’s English (en). file_filter: Regex for find the POT/PO under path.
Return the stats of a specificy file copying it to the static directory.
If try_to_merge is set to True, the stats are calculated after merging the PO file with the related POT.
Return the file contents of the requested file.
If is_msgmerged is set to True the merged file stored is opened. If decode is specified the contents are decoded with the decode encoding.
Return the full path of the filename.
If is_msgmerged is set to True the path of the merged file is returned.
Return a dictionary with the stats for a POT/PO file content.
Case the stats for the pofile can not be calculated, the dictionary will be returned with stats equals zero and with the error attribute set as True.
Find the related source file (POT) for a pofile when it has multiple source files.
This method gets a filename as parameter and tries to discover the related POT file using two methods:
Trying to find a POT file with the same base path that the pofile. Example: /foo/bar.pot and /foo/baz.po match on this method.
Trying to find a POT file with the same domain that the pofile in any directory.
Example: /foo/bar.pot and /foo/baz/bar.po match on this method. The domain in this case is ‘bar’.
If no POT is found the method returns None.
Return a list with the source files (pot) paths
Try to find it in the file_set passed to the PO file instace. If it still fails, try to find the POT file in the filesystem.
Get a dictionary with the translation stats of a pofile and returns the completion of it.
The stats parameter must receive a dictionary like the following: stats = {‘translated’: 50, ‘fuzzy’: 20, ‘untranslated’: 30}
Get a dictionary with the translation stats of a pofile and returns a string with the status in the following format: ‘10 messages complete with 1 fuzzy and 12 untranslated’
The stats parameter must receive a dictionary like the following: stats = {‘translated’: 50, ‘fuzzy’: 20, ‘untranslated’: 30}
Call run_msgfmt_check (runs a msgfmt -c on a file (file object)).
Raise a MsgfmtCheckError in case the stderror has errors or warnings or the command execution returns Error.
Merge two files and save the output at the static diretory.
In case of error, copy the file (pofile) to the destination without merging it.
Run a msgfmt -c on a file (file object).
Return the output of the execution of the command.
Hold the positions of a number of statistic bars.
Used to present bars for translation completion status.
Return a number to group completion stats based on their number.
Depending on the categories defined, different classes will be returned. For example, with the following constant, this will return ‘lt50’ for numbers less than 50 and gt50 for numbers between 50-100. In the case of multiple matches, the first match is returned.
Create a HTML bar to present the full statistics.
Accepts an optional parameter to specify the width of the total bar.
Create an HTML bar to present only the translated statistics.
Accepts an optional parameter to specify the width of the total bar.
Mar 02, 2010