Plug in API Get Language - czcorpus/kontext GitHub Wiki

Plug-ins / [getlang]

interface: plugins.abstract.getlang.AbstractGetLang type: optional client-side: -

This optional plug-in allows you to implement your own way how to detect user's language settings. By default, KonText tries to detect the language from browser settings (Accept-Language) and offers also a UI element to switch languages manually. But you may require a different way how to to this (e.g. by detecting the language from IP address or from an API of some information system KonText will be part of).

# AbstractGetLang.fetch_current_language(source)

arguments:

  • source -- a Cookie.BaseCookie compatible object

# AbstractGetLang.get_fallback_language()

Optionally, a method to get a fallback language can be implemented. It is used in case your "other application" (or central authority via application_bar) sets some language your version of KonText does not support.