dev

This is the documentation page for Module:Docbunto/testcases/Factory

I18n-factory is a minimal Lua port of I18n-js. This module is used to demonstrate factory pattern support in Docbunto. For this reason, the code is limited to the library's Message and I18n objects.

Do not use this in your wiki! It exists purely for tests.

Documentation

Package items

i18nf.loadMessages (member)
Loads messages from JSON files in MediaWiki namespace. The messages are wrapped in a custom interface:
  • This function parses and caches messages in the module as a Lua data table.
  • These can be accessed using the msg method of the returned object.
i18nf._getMsg (member)
Fetch a message from the cache of parsed i18n data.

Message

Message object, providing getter methods for messages.

Message:parse (member)
Parse wikitext links in the message and return the result.
Message:markdown (member)
Parse markdown links in the message and return the result.
Message:escape (member)
Escape the message wikitext and return the result.
Message:plain (member)
Return the message with no processing.

I18n

I18n object, providing message getter and language setters.

I18n:msg (member • factory • constructor)
Factory returning Message instance.
I18n:useLang (member)
I18n language setter to specificed language.
I18n:inLang (member)
Temporary datastore language setter to a specificed language. Only affects the next I18n:msg call.
I18n:useContentLang (member)
I18n language setter to wgContentLanguage.
I18n:inContentLang (member)
Temporary language setter to wgContentLanguage. Only affects the next I18n:msg call.
I18n:useUserLang (member)
I18n language setter to wgUserLanguage.
Note: Scribunto only registers wgUserLanguage when an invocation is at the top of the call stack.
I18n:inUserLang (member)
Temporary language setter to wgUserLanguage. The message language reverts to the default language in the next I18n:msg call.

See also