Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Multilingual/doc
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Functions for Lua modules (API) == All functions described above can be used by other modules: <syntaxhighlight lang="lua"> local lucky, Multilingual = pcall( require, "Module:Multilingual" ) if type( Multilingual ) == "table" then Multilingual = Multilingual.Multilingual() else -- failure; Multilingual is the error message return "<span class='error'>" .. Multilingual .. "</span>" end </syntaxhighlight> Subsequently there are available: ; Multilingual.fair( ask ) :* ''ask'' β string, or table according to getLang() ; Multilingual.findCode( ask ) ; Multilingual.format( apply, alien, alter, active, alert, frame, assembly, adjacent ) :* ''apply'' β string with language list or single item :* ''alien'' β language of the answer :** <code>nil false "*"</code> β native :** <code>"!"</code> β current project :** any valid code :* ''alter'' β capitalization :** <code>"c"</code> β capitalize :** <code>"d"</code> β downcase everything :** <code>"f"</code> β capitalize first item only, downcase anything else :* ''active'' β link items, if <code>true</code> :* ''alert'' β string with category title in case of error :* ''frame'' β if available :* ''assembly'' β string with split pattern, if list expected :* ''adjacent'' β string with list separator, else ''assembly'' :* ''ahead'' β string for optional prepending first element, if any ; Multilingual.getBase( ask ) ; Multilingual.getLang( ask ) : Split language code into components : Returns: ''table'' :: <code>.base</code> β Basic language (2β3 lowercase letters) :: <code>.region</code> β Country (2 uppercase letters) :: <code>.script</code> β Scripting (4 letters, capitalized) :: <code>.year</code> β year (4 digits) :: <code>.extension</code> β Extension (1 lowercase letter) :: <code>.other</code> β More :: <code>.legal</code> β ''true'' if valid :: <code>.n</code> β Number of components ; Multilingual.getName( ask, alien ) :* ''alien'' β language of the answer :** <code>nil false "*"</code> β native :** <code>"!"</code> β current project :** Any ISO code. ; Multilingual.isLang( ask ) ; Multilingual.isLangWiki( ask ) ; Multilingual.kannDeutsch( ask ) ; Multilingual.userLang( accept, frame ) :* ''accept'' β string with space separated list of available ISO 639 codes :* ''frame'' β if available ; Multilingual.failsafe( atleast ) :* atleast<br />''optional''<br />''nil'' or required version :* Returns: ''string'' or ''false'' If succeeding, the ''Multilingual.get*()'' return a string, the ''Multilingual.is*()'' <code>true</code>; on failure <code>false</code>.
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)