mdpo.po module
PO files related stuff.
- mdpo.po.check_empty_msgstrs_in_filepaths(filenames)
Warns about all empty msgstr found in a set of PO files.
- mdpo.po.check_fuzzy_entries_in_filepaths(filenames)
Warns about all fuzzy entries found in a set of PO files.
- mdpo.po.check_obsolete_entries_in_filepaths(filenames)
Warns about all obsolete entries found in a set of PO files.
- mdpo.po.find_entry_in_entries(entry, entries, **kwargs)
Return an equal entry in a set of
polib.POEntry
entries.Finds the first
polib.POEntry
instance in the iterableentries
that is equal, according to its__cmp__
method, to thepolib.POEntry
instance passed asentry
argument.- Parameters:
entry (
polib.POEntry
) – Entry to search for.entries (list) – Entries to search against.
**kwargs – Keyword arguments passed to
polib.POEntry
__cmp__
method.
- Returns:
Entry passed in
entry
argument if an equal entry has been found inentries
iterable, otherwiseNone
.- Return type:
- mdpo.po.mark_not_found_entries_as_obsoletes(pofile, entries)
Mark entries in a PO file obsoletes if are not in a set of entries.
If an entry of the PO file is found in the set of entries, will be marked as no obsolete.
- Parameters:
pofile (
polib.POFile
) – PO file in which the missing entries will be marked as obsoletes.entries (list) – Entries to search against.
- mdpo.po.parse_empty_msgstr_from_content_lines(content_lines, location_prefix='line ')
Warns about all empty msgstr found in a set of PO files.
- mdpo.po.parse_fuzzy_from_content_lines(content_lines, location_prefix='line ')
Warns about all fuzzy entries found in a set of PO files.
- mdpo.po.parse_obsoletes_from_content_lines(content_lines, location_prefix='line ')
Warns about all obsolete entries found in a set of PO files.
- mdpo.po.paths_or_globs_to_unique_pofiles(pofiles_globs, ignore, po_encoding=None)
Convert any path, paths or glob to
polib.POFile
objects.
- mdpo.po.po_escaped_string(chars)
Prepend a
\
character to a string.This is used to escape values inside strings wrapped for the returned character.
- mdpo.po.pofiles_to_unique_translations_dicts(pofiles)
Extract unique translations from a set of PO files.
Given multiple pofiles, extracts translations (those messages with non empty msgstrs) into two dictionaries, a dictionary for translations with contexts and other without them.
- Parameters:
pofiles (list) – List of
polib.POFile
objects.- Returns:
dictionaries with translations.
- Return type:
- mdpo.po.remove_not_found_entries(pofile, entries)
Remove entries in a PO file if are not in a set of entries.
- Parameters:
pofile (
polib.POFile
) – PO file for which the missing entries will be removed.entries (list) – Entries to search against.