Modul:Message box/doc: Perbedaan antara revisi

Dari Wiki Javasatu
Loncat ke navigasi Loncat ke pencarian
(←Membuat halaman berisi '{{high-use|129224}} {{module rating|p}} {{Lua|Module:Message box/configuration|Module:No globals|Module:Yesno|Module:Arguments|Module:Category handler}} Modul-meta ini digunakan oleh templat ''message box'' seperti, {{tl|mbox}}, {{tl|ambox}}, {{tl|cmbox}}, {{tl|fmbox}}, {{tl|imbox}}, {{tl|ombox}}, dan {{tl|tmbox}}. Harus dijalankan melalui modul Lua, tidak boleh digunakan langsung pada halaman wiki. Jika Anda ingin menggunakan fungsi modul ini dari halaman wiki,...')
 
Tidak ada ringkasan suntingan
 
Baris 1: Baris 1:
{{high-use|129224}}
<noinclude><!--
-->{{#ifeq:{{SUBPAGENAME}}|doc||{{Documentation subpage}}}}<!--
--><languages /><!--
--></noinclude>{{#switch:<translate></translate>
| =
<includeonly>{{Languages|Module:Message box/doc}}</includeonly>
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
<!-- {{Shared Template Warning|Module:Message box}} -->
{{Used in system}}
{{module rating|r}}
{{module rating|p}}
{{module rating|p}}
{{Lua|Module:Message box/configuration|Module:No globals|Module:Yesno|Module:Arguments|Module:Category handler}}
{{Lua|Module:Message box/configuration|Module:Arguments|Module:Yesno}}
{{Uses TemplateStyles
| Module:Message box/ambox.css
| Module:Message box/cmbox.css
| Module:Message box/fmbox.css
| Module:Message box/imbox.css
| Module:Message box/ombox.css
| Module:Message box/tmbox.css
}}


Modul-meta ini digunakan oleh templat ''message box'' seperti, {{tl|mbox}}, {{tl|ambox}}, {{tl|cmbox}}, {{tl|fmbox}}, {{tl|imbox}}, {{tl|ombox}}, dan {{tl|tmbox}}. Harus dijalankan melalui modul Lua, tidak boleh digunakan langsung pada halaman wiki. Jika Anda ingin menggunakan fungsi modul ini dari halaman wiki, gunakan templat ''message box'' sebagai gantinya.
<translate><!--T:1--> This is a meta-module that implements the message box templates <tvar name=1>{{separated entries|{{tlx|mbox}}|{{tlx|ambox}}|{{tlx|cmbox}}|{{tlx|fmbox}}|{{tlx|imbox}}|{{tlx|ombox}}|{{tlx|tmbox}}|separator=<nowiki/>{{int|lang={{TRANSLATIONLANGUAGE}}|comma-separator}}<nowiki/>|conjunction=<nowiki/>{{int|lang={{TRANSLATIONLANGUAGE}}|and}}{{int|lang={{TRANSLATIONLANGUAGE}}|word-separator}}<nowiki/>}}</tvar>.</translate>
== Penggunaan ==
<translate><!--T:2--> It is intended to be used from Lua modules, and should not be used directly from wiki pages.</translate>
<translate><!--T:3--> If you want to use this module's functionality from a wiki page, please use the individual message box templates instead.</translate>


Untuk bisa menggunakan modul ini dari Lua yang lain, anda perlu memuat seperti ini:
<translate>
== Usage == <!--T:4-->
 
<!--T:5-->
To use this module from another Lua module, first you need to load it.
</translate>


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local messageBox = require('Modul:Message box')
local messageBox = require('Module:Message box')
</syntaxhighlight>
</syntaxhighlight>


Untuk membuat ''message box'', gunakan fungsi <code>main</code>. Diperlukan dua parameter: ''string'' dan tabel yang berisi parameter ''message box''.
<translate><!--T:6--> To create a message box, use the <tvar name=1><code>main</code></tvar> function.</translate>
<translate><!--T:7--> It takes two parameters:</translate>
 
{{Unordered list
|1=
<translate><!--T:8--> the first is the box type (as a string).</translate>
|2=
<translate><!--T:9--> the second is a table containing the message box parameters.</translate>
}}


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local box = messageBox.main( boxType, {
local box = messageBox.main( boxType, {
    param1 = param1,
param1 = param1,
    param2 = param2,
param2 = param2,
    -- Parameter lainnya...
-- <translate nowrap><!--T:10--> More parameters...</translate>
})
})
</syntaxhighlight>
</syntaxhighlight>


Ada 7 jenis box yang tersedia:
<translate>
<!--T:11-->
There are seven available box types:
</translate>


{| class="wikitable"
{{(!}} class="wikitable"
! Jenis box !! Templat !! Kegunaan
! <translate><!--T:12--> Box type</translate>
|-
! <translate><!--T:13--> Template</translate>
| <code>mbox</code> || {{tl|mbox}} || Untuk pembuatan ''message box'' yang akan digunakan dalam beberapa ruang nama
! <translate><!--T:14--> Purpose</translate>
|-
{{!}}-
| <code>ambox</code> || {{tl|ambox}} || Untuk pembuatan ''message box'' pada artikel
{{!}} <code>mbox</code>
|-
{{!}} {{tlx|mbox}}
| <code>cmbox</code> || {{tl|cmbox}} || Untuk pembuatan ''message box'' pada kategori
{{!}} <translate><!--T:15--> For message boxes to be used in multiple namespaces</translate>
|-
{{!}}-
| <code>fmbox</code> || {{tl|fmbox}} || Untuk pembuatan ''message box'' antarmuka
{{!}} <code>ambox</code>
|-
{{!}} {{tlx|ambox}}
| <code>imbox</code> || {{tl|imbox}} || Untuk pembuatan ''message box'' pada ruang nama berkas
{{!}} <translate><!--T:16--> For article message boxes</translate>
|-
{{!}}-
| <code>tmbox</code> || {{tl|tmbox}} || Untuk pembuatan ''message box'' pada halaman pembicaraan
{{!}} <code>cmbox</code>
|-
{{!}} {{tlx|cmbox}}
| <code>ombox</code> || {{tl|ombox}} || Untuk pembuatan ''message box'' pada ruang nama lainnya
{{!}} <translate><!--T:17--> For category message boxes</translate>
|}
{{!}}-
{{!}} <code>fmbox</code>
{{!}} {{tlx|fmbox}}
{{!}} <translate><!--T:18--> For interface message boxes</translate>
{{!}}-
{{!}} <code>imbox</code>
{{!}} {{tlx|imbox}}
{{!}} <translate><!--T:19--> For file namespace message boxes</translate>
{{!}}-
{{!}} <code>tmbox</code>
{{!}} {{tlx|tmbox}}
{{!}} <translate><!--T:20--> For talk page message boxes</translate>
{{!}}-
{{!}} <code>ombox</code>
{{!}} {{tlx|ombox}}
{{!}} <translate><!--T:21--> For message boxes in other namespaces</translate>
{{!)}}


Lihat halaman templat masing-masing jenis ''message box'' untuk parameter yang tersedia.
<translate>
<!--T:22-->
See the template page of each box type for the available parameters.


== Gunakan #invoke ==
== Usage from <tvar name=1><code>#invoke</code></tvar> == <!--T:23-->
</translate>


Disertai fungsi <code>main</code>, modul ini memiliki fungsi terpisah untuk ''message box'' masing-masing. Dijalankan menggunakan kode <code><nowiki>{{#invoke:Message box|mbox|...}}</nowiki></code>, <code><nowiki>{{#invoke:Message box|ambox|...}}</nowiki></code>, dsb. Fungsi ini akan bekerja ketika dipanggil melalui modul lain, tetapi masing-masing menjalankan kode yang digunakan untuk memproses argumen menggunakan #invoke, dan tentu saja memanggil mereka akan kurang efisien daripada memanggil fungsi <code>main</code>.
<translate><!--T:24--> As well as the <tvar name=1><code>main</code></tvar> function, this module has separate functions for each box type.</translate>
<translate><!--T:25--> They are accessed using the code <tvar name=1>{{magic word|ext=Scribunto|nowrap=1|code=1|#invoke|[[Module:Message box|Message box]]<nowiki>|mbox|...</nowiki>}}</tvar>, <tvar name=2>{{tlc|#invoke:Message box|ambox|...}}</tvar>, etc.</translate>
<translate><!--T:26--> These will work when called from other modules, but they access code used to process arguments passed from <tvar name=1>{{tlc|#invoke:...}}</tvar>, and so calling them will be less efficient than calling <tvar name=2><code>main</code></tvar></translate>.


== Detail teknis ==
<translate>
== Technical details == <!--T:27-->


The module uses the same basic code for each of the templates listed above; the differences between each of them are configured using the data at [[Module:Message box/configuration]]. Here are the various configuration options and what they mean:
<!--T:28-->
The module uses the same basic code for each of the templates listed above; the differences between each of them are configured using the data at <tvar name=1>[[Module:Message box/configuration]]</tvar>.
</translate>


* <code>types</code> - a table containing data used by the type parameter of the message box. The table keys are the values that can be passed to the type parameter, and the table values are tables containing the class and the image used by that type.
<includeonly>{{Sandbox other||
* <code>default</code> - the type to use if no value was passed to the type parameter, or if an invalid value was specified.
<!-- Categories below this line; interwikis at Wikidata -->
* <code>showInvalidTypeError</code> - whether to show an error if the value passed to the type parameter was invalid.
[[Category:Modules{{#translation:}}]]
* <code>allowBlankParams</code> - usually blank values are stripped from parameters passed to the module. However, whitespace is preserved for the parameters included in the allowBlankParams table.
}}</includeonly><noinclude>
* <code>allowSmall</code> - whether a small version of the message box can be produced with "small=yes".
[[Category:Module documentation pages{{#translation:}}]]
* <code>smallParam</code> - a custom name for the small parameter. For example, if set to "left" you can produce a small message box using "small=left".
</noinclude>
* <code>smallClass</code> - the class to use for small message boxes.
| #default=
* <code>substCheck</code> - whether to perform a subst check or not.
  {{#invoke:Template translation|renderTranslatedTemplate|template=Module:Message box/doc|noshift=1|uselang={{int:lang}}}}
* <code>classes</code> - an array of classes to use with the message box.
}}
* <code>imageEmptyCell</code> - whether to use an empty {{tag|td}} cell if there is no image set. This is used to preserve spacing for message boxes with a width of less than 100% of the screen.
* <code>imageEmptyCellStyle</code> - whether empty image cells should be styled.
* <code>imageCheckBlank</code> - whether "image=blank" results in no image being displayed.
* <code>imageSmallSize</code> - usually, images used in small message boxes are set to 30x30px. This sets a custom size.
* <code>imageCellDiv</code> - whether to enclose the image in a div enforcing a maximum image size.
* <code>useCollapsibleTextFields</code> - whether to use text fields that can be collapsed, i.e. "issue", "fix", "talk", etc. Currently only used in ambox.
* <code>imageRightNone</code> - whether imageright=none results in no image being displayed on the right-hand side of the message box.
* <code>sectionDefault</code> - the default name for the "section" parameter. Depends on <code>useCollapsibleTextFields</code>.
* <code>allowMainspaceCategories</code> - allow categorisation in the main namespace.
* <code>templateCategory</code> - the name of a category to be placed on the template page.
* <code>templateCategoryRequireName</code> - whether the <code>name</code> parameter is required to display the template category.
* <code>templateErrorCategory</code> - the name of the error category to be used on the template page.
* <code>templateErrorParamsToCheck</code> - an array of parameter names to check. If any are absent, the <code>templateErrorCategory</code> is applied to the template page.

Revisi terkini sejak 22 September 2023 12.25

<languages />Galat skrip: tidak ada modul tersebut "Template translation".