univention.translationhelper package

Submodules

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._clean_header(po_path)[source]
univention.translationhelper.message_catalogs.concatenate_po(src_po_path, dest_po_path)[source]
univention.translationhelper.message_catalogs.create_empty_po(binary_pkg_name, new_po_path)[source]
univention.translationhelper.message_catalogs.compile_mo(path_to_po, mo_output_path)[source]
univention.translationhelper.message_catalogs.merge_po(source_po_path, dest_po_path)[source]
univention.translationhelper.message_catalogs.join_existing(language, output_file, input_files, cwd='/var/lib/jenkins/workspace/Mitarbeiter/phahn/UCS-API-Doc')[source]
univention.translationhelper.message_catalogs.po_to_json(po_path, json_output_path)[source]
univention.translationhelper.message_catalogs._call_gettext(*args, **kwargs)[source]
univention.translationhelper.message_catalogs.univention_location_lines(pot_path, abs_path_source_pkg)[source]
univention.translationhelper.message_catalogs.make_parent_dir(file_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

process_po(pot_path)[source]
process_target(po_path, output_path)[source]
class univention.translationhelper.sourcefileprocessing.SourceFilesXgettext(src_pkg_path, binary_pkg_name, files)[source]

Bases: univention.translationhelper.sourcefileprocessing.SourceFileSet

_create_po_template(gettext_lang, pot_path)[source]
_compile(po_path, mo_output_path)[source]
class univention.translationhelper.sourcefileprocessing.SourceFilesShell(src_pkg_path, binary_pkg_name, files)[source]

Bases: univention.translationhelper.sourcefileprocessing.SourceFilesXgettext

_create_po_template(pot_path)[source]
class univention.translationhelper.sourcefileprocessing.SourceFilesPython(src_pkg_path, binary_pkg_name, files)[source]

Bases: univention.translationhelper.sourcefileprocessing.SourceFilesXgettext

_create_po_template(pot_path)[source]
class univention.translationhelper.sourcefileprocessing.SourceFilesJavaScript(src_pkg_path, binary_pkg_name, files)[source]

Bases: univention.translationhelper.sourcefileprocessing.SourceFilesXgettext

_create_po_template(pot_path)[source]
_compile(po_path, json_output_path)[source]

With UMC and univention-web based applications a custom, JSON-based message format is used.

class univention.translationhelper.sourcefileprocessing.SourceFilesHTML(src_pkg_path, binary_pkg_name, files)[source]

Bases: univention.translationhelper.sourcefileprocessing.SourceFileSet

_create_po_template(pot_path)[source]
_compile(po_path, json_output_path)[source]
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'>}
classmethod from_mimetype(src_pkg_path, binary_pkg_name, mimetype, files)[source]
univention.translationhelper.sourcefileprocessing.from_mimetype(src_pkg_path, binary_pkg_name, mimetype, files)[source]

univention.translationhelper.translationhelper module

exception univention.translationhelper.translationhelper.NoSpecialCaseDefintionsFound[source]

Bases: exceptions.Exception

class univention.translationhelper.translationhelper.UMCModuleTranslation(attrs, target_language)[source]

Bases: univention.dh_umc.UMC_Module

python_po_files
js_po_files
xml_po_files
python_mo_destinations()[source]
json_targets()[source]
xml_mo_destinations()[source]
static from_source_package(module_in_source_tree, target_language)[source]
static _read_module_attributes_from_source_package(module)[source]
static _get_core_module_from_source_package(module, target_language)[source]
static _get_module_from_source_package(module, target_language)[source]
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

_get_files_matching_patterns()[source]
get_source_file_sets()[source]
create_po_template(output_path='.')[source]
class univention.translationhelper.translationhelper.MIMEChecker[source]
suffixes = {'.js': 'application/javascript', '.html': 'text/html', '.sh': 'text/x-shellscript', '.py': 'text/x-python'}
get(file_path)[source]
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 SVN branch. Currently they lay 3 (UCS@school) or 4(UCS) directory levels deep in the SVN repository.

univention.translationhelper.translationhelper.find_base_translation_modules(startdir, source_dir, module_basefile_name)[source]
univention.translationhelper.translationhelper.make_parent_dir(path)[source]

If path is a directory path the directory and its parents will be created, if path is a file create its parents will be created.

univention.translationhelper.translationhelper.write_debian_rules(debian_dir_path)[source]
univention.translationhelper.translationhelper.create_new_package(new_package_dir, target_language, target_locale, language_name, startdir)[source]