id_translation.Translator.go_offline#

Translator.go_offline(translatable=None, names=None, *, ignore_names=None, override_function=None, max_fails=1.0, fmt=None, path=None)[source]#

Retrieve and store translations in memory.

Warning

The translator will be disconnected. No new translations may be fetched after this method returns.

Parameters:
  • translatable – Data from which IDs to fetch will be extracted. Fetch all IDs if None.

  • 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. See Mapper.apply() for details.

  • max_fails – The maximum fraction of IDs for which translation may fail. 1=disabled.

  • fmt – A format string such as ‘{id}:{name}’ use. Default is Translator.fmt.

  • path – If given, serialize the Translator to disk after retrieving data.

Returns:

Self, for chained assignment.

Raises:

Notes

The Translator is guaranteed to be serializable() once offline. Fetchers often aren’t as they require things like database connections to function.

See also

The restore() method.