I18n library for message storage in Lua datastores. The module is designed to enable message separation from modules & templates. It has support for handlin
| This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected. |
| This module depends on the following other modules: |
| Description | Library for message storage in Lua datastores. |
|---|---|
| Author(s) |
|
| Status | Beta |
| Updated | May 5, 2025 (15 months ago) |
| Dependencies | |
| Using code by | Cqm |
I18n library for message storage in Lua datastores. The module is designed to enable message separation from modules & templates. It has support for handling language fallbacks. This module is a Lua port of wikia:dev:I18n-js and i18n modules that can be loaded by it are editable through wikia:dev:I18nEdit.
On Wikimedia projects, i18n messages are editable through Data:i18n/ subpages on Wikimedia Commons.
i18n.getMsg( frame ) (function)uselang parameter. Extra numbered parameters can be supplied for substitution into the datastore message.i18n.loadMessages( ... ) (function)... ROOTPAGENAME/path for target i18n submodules. (string)require('Module:I18n').loadMessages('1', '2')i18n.getLang() (function)uselang parameter.i18n.loadI18n( name, i18n_arg ) (function)i18n.loadI18nFrame( name, i18n_arg ) (function)i18n.main( frame ) (function)frame Frame invocation object. (table){{#invoke:i18n|main}}_i18n.isWikitext( msg ) (function)msg Message to check. (string)DataI18n datastore class. This is used to control language translation and access to individual messages. The datastore instance provides language and message getter-setter methods, which can be used to internationalize Lua modules. The language methods (any ending in Lang) are all chainable.
Data:msg( opts, ... ) (function)key. These messages may have $n parameters, which can be replaced by optional argument strings supplied by the msg call.'<key>'. (string)ds:msg{
key = 'message-name',
lang = '',
args = {...},
sources = {}
}
ds:msg('message-name', ...)Data:parameter( parameter, args ) (function)Data:fromSource( ... ) (function)i18n.loadMessages.... Source name(s) to use. (string)Data:getLang() (function)Data:useUserLang() (function)wgUserLanguage.wgUserLanguage when an invocation is at the top of the call stack.Data:useContentLang() (function)wgContentLanguage.Data:useLang( code ) (function)code Language code to use. (string)Data:inUserLang() (function)wgUserLanguage. The datastore language reverts to the default language in the next Data:msg call.Data:inContentLang() (function)wgContentLanguage. Only affects the next Data:msg call.Data:inLang( code ) (function)Data:msg call.code Language code to use. (string)Documentation above is auto generated
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.