id_translation.Translator.go_offline#
- Translator.go_offline(translatable=None, names=None, *, ignore_names=None, override_function=None, max_fails=1.0, fmt=None, io_kwargs=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.
Subsequent calls to this method will return immediately.
- 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. SeeMapper.apply()for details.max_fails – The maximum fraction of IDs for which translation may fail. 1=disabled.
fmt – A
format stringsuch as ‘{id}:{name}’ use. Default isTranslator.fmt.io_kwargs – Used to initialize the IO implementation.
path – If given, serialize the
Translatorto disk after retrieving data.
- Returns:
Self, for chained assignment.
- Raises:
ForbiddenOperationError – If
Fetcher.fetch_all()is disabled andtranslatable=None.MappingError – If
map()fails (only when translatable is given).
Notes
The
Translatoris guaranteed to beserializable()once offline. Fetchers often aren’t as they require things like database connections to function.See also
The
restore()method.