Module:Tr/loaddata/doc

From Infernum Mod Wiki
Jump to navigation Jump to search

This is the documentation page for Module: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 (Module:Tr/loaddata-en, Module: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 (Module:Tr/db-en, Module: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.