univention.translationhelper package¶
Submodules¶
univention.translationhelper.helper module¶
univention.translationhelper.message_catalogs module¶
This module collects utilities for installing and building message catalogs while applying Univention specific options.
Currently this is mostly a wrapper for gettext. In the future it might be useful to merge parts of dh_umc into it as the UMC uses a custom JSON based catalog format.
-
exception
univention.translationhelper.message_catalogs.
GettextError
[source]¶ Bases:
exceptions.Exception
-
univention.translationhelper.message_catalogs.
create_empty_po
(binary_pkg_name, new_po_path)[source]¶
univention.translationhelper.sourcefileprocessing module¶
Generate gettext Portable Objects and message catalogs (gettext MO and a Univention specific JSON-based format) from multiple source files by file type.
-
exception
univention.translationhelper.sourcefileprocessing.
UnsupportedSourceType
[source]¶ Bases:
exceptions.Exception
-
class
univention.translationhelper.sourcefileprocessing.
SourceFileSet
(src_pkg_path, binary_pkg_name, files)[source]¶ Bases:
object
-
class
univention.translationhelper.sourcefileprocessing.
SourceFilesXgettext
(src_pkg_path, binary_pkg_name, files)[source]¶ Bases:
univention.translationhelper.sourcefileprocessing.SourceFileSet
-
class
univention.translationhelper.sourcefileprocessing.
SourceFilesShell
(src_pkg_path, binary_pkg_name, files)[source]¶ Bases:
univention.translationhelper.sourcefileprocessing.SourceFilesXgettext
-
class
univention.translationhelper.sourcefileprocessing.
SourceFilesPython
(src_pkg_path, binary_pkg_name, files)[source]¶ Bases:
univention.translationhelper.sourcefileprocessing.SourceFilesXgettext
-
class
univention.translationhelper.sourcefileprocessing.
SourceFilesJavaScript
(src_pkg_path, binary_pkg_name, files)[source]¶ Bases:
univention.translationhelper.sourcefileprocessing.SourceFilesXgettext
-
class
univention.translationhelper.sourcefileprocessing.
SourceFilesHTML
(src_pkg_path, binary_pkg_name, files)[source]¶ Bases:
univention.translationhelper.sourcefileprocessing.SourceFileSet
-
class
univention.translationhelper.sourcefileprocessing.
SourceFileSetCreator
[source]¶ Bases:
object
-
process_by_type
= {'application/javascript': <class 'univention.translationhelper.sourcefileprocessing.SourceFilesJavaScript'>, 'text/html': <class 'univention.translationhelper.sourcefileprocessing.SourceFilesHTML'>, 'text/x-python': <class 'univention.translationhelper.sourcefileprocessing.SourceFilesPython'>, 'text/x-shellscript': <class 'univention.translationhelper.sourcefileprocessing.SourceFilesShell'>}¶
-
univention.translationhelper.translationhelper module¶
-
exception
univention.translationhelper.translationhelper.
NoSpecialCaseDefintionsFound
[source]¶ Bases:
exceptions.Exception
-
class
univention.translationhelper.translationhelper.
UMCModuleTranslation
(attrs, target_language)[source]¶ Bases:
univention.translationhelper.umc.UMC_Module
-
python_po_files
¶
-
js_po_files
¶
-
xml_po_files
¶
-
-
class
univention.translationhelper.translationhelper.
SpecialCase
(special_case_definition, source_dir, path_to_definition, target_language)[source]¶ Consumes special case definition and determines matching sets of source files.
Parameters: - special_case_definition – Mapping with special case definitions.
- source_dir – Base directory.
- path_to_definition – Path to definition file.
- target_language – 2-letter language code.
-
class
univention.translationhelper.translationhelper.
MIMEChecker
[source]¶ -
suffixes
= {'.js': 'application/javascript', '.html': 'text/html', '.sh': 'text/x-shellscript', '.py': 'text/x-python'}¶
-
-
univention.translationhelper.translationhelper.
update_package_translation_files
(module, output_dir)[source]¶
-
univention.translationhelper.translationhelper.
write_makefile
(all_modules, special_cases, new_package_dir, target_language)[source]¶
-
univention.translationhelper.translationhelper.
translate_special_case
(special_case, source_dir, output_dir)[source]¶
-
univention.translationhelper.translationhelper.
read_special_case_definition
(definition_path, source_tree_path, target_language)[source]¶
-
univention.translationhelper.translationhelper.
get_special_cases_from_srcpkg
(source_tree_path, target_language)[source]¶
-
univention.translationhelper.translationhelper.
get_special_cases_from_checkout
(source_tree_path, target_language)[source]¶ Process *.univention-l10n files in the whole branch. Currently they lay 3 (UCS@school) or 4(UCS) directory levels deep in the repository.
univention.translationhelper.umc module¶
Each module definition contains the following entries:
- Module: The internal name of the module
- Python: A directory containing the Python module. There must be a subdirectory named like the internal name of the module.
- Definition: The XML definition of the module
- Javascript: The directory of the javascript code. In this directory must be a a file called
<Module>.js
- Category: The XML definition of additional categories
- Icons: A directory containing the icons used by the module. The directory structure must follow the following pattern
<weight>x<height>/<icon>.(png|svg)
.
The entries Module and Definition are required.
Example:
Module: ucr
Python: umc/module
Definition: umc/ucr.xml
Javascript: umc/js
Category: umc/categories/ucr.xml
Icons: umc/icons
-
exception
univention.translationhelper.umc.
Error
[source]¶ Bases:
exceptions.SystemExit
-
class
univention.translationhelper.umc.
UMC_Module
(*args)[source]¶ Bases:
dict
-
css_files
¶ Iterate over all Javascript CSS files.
-
html_files
¶ Iterate over all JavaScript HTML files.
-
icons
¶ Return path to UMC icon directory.
-
js_files
¶ Iterate over all JavaScript UMC files.
-
js_module_file
¶ Return path to main JavaScript file.
-
js_path
¶ Return path to JavaScript UMC directory.
-
js_po_files
¶ Iterate over all JavaScript UMC message catalogs.
-
module_name
¶ Return the name of the UMC module.
-
package
¶ Return the name of the Debian binary package.
-
python_files
¶ Iterate over all Python UMC files.
-
python_path
¶ Return path to Python UMC directory.
-
python_po_files
¶ Iterate over all Python UMC message catalogs.
-
python_versions
¶
-
xml_categories
¶ Return the path to the XML file defining categories.
-
xml_definition
¶ Return the path to the XML UMC definition.
-
xml_po_files
¶ Iterate over all XML UMC message catalogs.
-
-
univention.translationhelper.umc.
create_json_file
(po_file)[source]¶ Compile textual message catalog (.po) to JSON message catalog.
Parameters: po_file – File name of the textual message catalog.
-
univention.translationhelper.umc.
create_mo_file
(po_file)[source]¶ Compile textual message catalog (.po) to binary message catalog (.mo).
Parameters: po_file – File name of the textual message catalog.
-
univention.translationhelper.umc.
create_po_file
(po_file, package, files, language='python')[source]¶ Create a PO file for a defined set of files.
Parameters: - po_file – File name of the textual message catalog.
- package – Name of the package.
- files – A single file name or a list of file names.
- language – Programming language name.