Модуль:Tr/loaddata/doc

Материал из Infernum Mod Wiki
Перейти к навигации Перейти к поиску

Это страница документации Модуль:Tr/loaddata.

This module is used by Module:Tr to fetch the translation database for a language. To improve performance, the translation databases are not fetched every time Module:Tr is invoked, but are cached instead. This module returns that cache. It is called from the language-specific loaders (Модуль:Tr/loaddata-en, Модуль:Tr/loaddata-ru, etc., which in turn are called directly by Module:Tr) with the following function:

  • require('Module:Tr/loaddata').load('<language>')
Returns the cache of the translation database for the given language (Модуль:Tr/db-en, Модуль:Tr/db-ru, etc.). In addition to the three tables main, pagename, and reversed, the returned table has a lookup table onWikiLangList in which all on-wiki languages are true.

Caching the translation databases means that changes to them are not immediately reflected. The cache must be cleared ("purged") in order for the changes to take effect. When the cache is purged, this module will recreate it. The cache can be purged from another module with the following function. This function is only intended to be called by Module:Tr – to purge it manually, invoke that module.

  • require('Module:Tr/loaddata').purge('<language>')
Purges the cache of the translation database for the given language. The cache will be recreated with the most recent version of the translation database the next time the load function is called.