convert¶
Code to convert between different storage formats for localizations.
acesskey¶
functions used to manipulate access keys in strings.
- class translate.convert.accesskey.UnitMixer(labelsuffixes, accesskeysuffixes)¶
Helper to mix separately defined labels and accesskeys into one unit.
- match_entities(index)¶
Populates mixedentities from the index.
- static mix_units(label_unit, accesskey_unit, target_unit)¶
Mix the given units into the given target_unit if possible.
Might return None if no match is possible.
- translate.convert.accesskey.combine(label: str, accesskey: str, accesskey_marker: str = '&') str | None¶
Combine a label and and accesskey to form a label+accesskey string.
We place an accesskey marker before the accesskey in the label and this creates a string with the two combined e.g. “File” + “F” = “&File”
The case of the accesskey is preferred unless no match is found, in which case the alternate case is used.
- Parameters:
label – a label
accesskey – The accesskey
- Returns:
label+accesskey string or None if uncombineable
- translate.convert.accesskey.extract(string: str, accesskey_marker: str = '&') tuple[str, str]¶
Extract the label and accesskey from a label+accesskey string.
The function will also try to ignore &entities; which would obviously not contain accesskeys. :param string: A string that might contain a label with accesskey marker :param accesskey_marker: The character that is used to prefix an access key
convert¶
csv2po¶
csv2tbx¶
dtd2po¶
factory¶
Factory methods to convert supported input files to supported translatable files.