id_translation.Translator.map#
- Translator.map(translatable, names=None, *, ignore_names=None, override_function=None)[source]#
Map names to translation sources.
- Parameters:
translatable – A data structure to map names for.
names – Explicit names to translate. Derive from translatable if
None.ignore_names – Names not to translate, or a predicate
(NameType) -> bool.override_function – A callable
(name, sources, ids) -> Source | None. SeeMapper.applyfor details.
- Returns:
A mapping of names to translation sources. Returns
Noneif mapping failed.- Raises:
MissingNamesError – If names are not given and cannot be derived from translatable.
MappingError – If any required (explicitly given) names fail to map to a source.
MappingError – If name-to-source mapping is ambiguous.
UserMappingError – If override_function returns a source which is not known, and
mapper.on_unknown_user_override != 'ignore'.
See also
🔑 This is a key event method. See Key Event Records for details.