Jump to content

සැකිල්ල:module cat/documentation

Wiktionary වෙතින්
Documentation for සැකිල්ල:module cat. [edit]
This page contains usage information, categories, interwiki links and other content describing the template.

This template is used to add modules to the appropriate categories based on the module's name and/or parameters indicating the language(s) and type(s) of the module.

The module underlying this template can automatically categorize modules that are named in predictable ways: with language code, a hyphen, and a word explaining what the module is. For example, it recognizes the title uk-pronunciation and adds the categories Ukrainian modules and Pronunciation modules. The list of correspondences between the last part of the module name and the category are found in Module:module categorization, which generates the content for this template. The module also adds the appropriate sortkeys.

For the most part, it is not necessary to invoke this template explicitly as it will automatically be called from Module:documentation whenever the module's categories aren't explicitly specified on the module's documentation page. (Specifically, Module:documentation checks to see if there is an <includeonly>...</includeonly> section or an explicit invocation of {{module cat}}. If not, it automatically invokes Module:module categorization, which is the Lua code that implements {{module cat}}, to categorize the module appropriately.)

If the automatic algorithm doesn't work out of the box, you can call {{module cat}} with the appropriate parameters to get the right categorization. It can be included in an <includeonly>...</includeonly> section, but need not be. (You can also add the categories manually inside of an <includeonly>...</includeonly> section, but this is not recommended as it is tedious and error-prone.)

The template accepts the following parameters:

|1=
Comma-separated list of language, script and/or family codes that this module applies to. If omitted, it is inferred from the prefix of the module name. Use - for non-language-specific modules. To specify a family code, prefix it with fam:, which is equivalent to specifying all the languages in the family. (Specifying the family code without the prefixed fam: refers to the family's proto-language.) Note that multiple language and/or script codes are automatically inferred from the module name when possible. For example, given Module:uk-be-headword or any subpage such as a hypothetical Module:uk-be-headword/data/testcases, the language codes uk (Ukrainian) and be (Belarusian) will be inferred. Given Module:ks-Arab-to-Deva-translit, the language code ks and script codes Arab and Deva are all inferred. (to is a valid language code corresponding to Tongan, but as a special case it's ignored unless it occurs first.)
|2= or |type=
Comma-separated list of module types for this module. Module types should be capitalized, e.g. Inflection, Data or Pronunciation. A module type may be followed by a colon and a sortkey, which overrides the automatically-generated one. Underscores are replaced with spaces; for example, Module:Swadesh uses {{module cat|-|Swadesh:_}} to categorize into Category:Swadesh modules with a sort key consisting of a space character (so that the module appears at the beginning of the list of modules, before all language-specific moduels). If omitted, it is inferred from the suffix of the module name and/or any subpage component following a slash. See below.

This template is also used by {{translit module documentation}} to add categories for all languages that list the transliteration module in their data tables. For instance, Module:sa-translit has the language code for Sanskrit (sa) in its title, but it is currently used for languages besides Sanskrit.

If |2= or |type= (the module type) is omitted, the module type is inferred from the pagename. Specifically, the rightmost hyphen-delimited or space-delimited suffix in the root part of the module name is used to look up the appropriate module type. (The root part is obtained from the full module name by stripping the prefix Module: and any subpages following a slash. The suffix used to infer the module type is the text following the last hyphen or space. For example, given the module Module:uk-be-headword or any subpage such as a hypothetical Module:uk-be-headword/data/testcases, the keyword headword will be extracted and used to infer a module type Headword-line.) In addition, modules containing the string /data followed by a hyphen, slash or end of string will be considered Data-type modules as well as any other types inferrable from the portion before the slash. Similarly, modules containing the string /testcases followed by a hyphen, slash or end of string will be considered Testcase-type modules, or in some cases Pronunciation testcase-type or Transliteration testcase-type modules, in addition to any other types inferrable from the portion before the slash.

The following is the table used to map the keyword found in the rightmost portion of the root pagename (as described above) to module types:

Keyword Inferred module type
IPA Pronunciation
adecl Inflection
adj Inflection
adjective Inflection
adjectives Inflection
common Language-specific utility
conj Inflection
conjugation Inflection
decl Inflection
declension Inflection
entryname Entry name-generating
headword Headword-line
infl Inflection
inflection Inflection
nominal Inflection
nominals Inflection
noun Inflection
nouns Inflection
pron Pronunciation
pronoun Inflection
pronouns Inflection
pronun Pronunciation
pronunc Pronunciation
pronunciation Pronunciation
sortkey Sortkey-generating
translit Transliteration
utilities Language-specific utility
verb Inflection
verbs Inflection

Note that you can specify other types. In particular, see the list of subcategories of Category:Modules, which includes the name of the subcategory and the description. The module type is the same as the name of a module category minus the word modules at the end, including the initial capital letter. (No validation is done on the module type; for example, if you specify type Foobar, the module will be duly categorized in Category:Foobar modules. However, this is probably not helpful.)

Module types by patterns

[සංස්කරණය]

The module may also infer additional module types based on Lua patterns. In particular, there are two such patterns recognized currently:

  1. Page names containing /data (followed by a hyphen, slash or end of string) will infer the additional module type Data.
  2. Page names containing /testcases (followed by a hyphen, slash or end of string) will infer one or more additional module types based on the existing module types. Specifically, if Pronunciation is one of the existing module types, Pronunciation testcases is inferred; if Transliteration is one of the existing module types, Transliteration testcases is inferred; and if a module type other than Pronunciation and Transliteration is one of the existing module types, Testcases is inferred.

Both patterns can operate simultaneously for a module like Module:la-verb/testcases/data.

"https://si.wiktionary.org/w/index.php?title=සැකිල්ල:module_cat/documentation&oldid=196653" වෙතින් සම්ප්‍රවේශනය කෙරිණි