v2.4.0+
| Status: | effective |
| Progress: | 100% |
| Version: | 2.4.0+ |
Help:Datatype "Monolingual text"
From semantic-mediawiki.org
| Monolingual text | |
|---|---|
| Holds a text value that associates the annotation with a specific language code | |
| Further information | |
| Provided by: | Semantic MediaWiki |
| Since version: | 2.4.0 |
| Until version: | still in use |
| Datatype ID: | _mlt_rec
|
| In this wiki: | Monolingual text |
| Table of Contents | |
The datatype Monolingual text1 associates a text value with a specific language code. The annotation form is expected as foo@en with the first element being an arbitrary text while the second element divided by @ to contain a valid language code.
Notes[edit]
- An annotation with
[[Has monolingual text::some text@en]]is identical to[[Has monolingual text::some text@EN]]because language codes are transformed to a IETF language tag / BCP47 (by "Localizer::asBCP47FormattedLanguageCode"). - The Language code is internally managed by special property "Language code"Handles BCP47 conform language codes specifying the language of the annotated text
- Internally each value of this special property ("
MonolingualTextValue") is stored as separate entity using as special construct ("ContainerSemanticData") allowing forfoo@ento be different fromfoo@jaby its data structure (oppose to a string comparison which only would establish that two strings are different but without the semantic interpretation that for the cited example only the language code is different). - The printout can be defined with the option [Help:Ask_syntax/Language_filter|lang], e. g.
?Has monolingual text|+lang=defor a German language printout.
Examples[edit]
Display text in a defined language[edit]
- Annotation
[[Has monolingual text::foo@ja]]
or
{{#subobject:
|Has monolingual text=foo@en
}}
- Query
{{#ask:
[[Has monolingual text::?@ja]]
|?Has monolingual text|+index=1
|mainlabel=-
|headers=hide
}}
See <sandbox.semantic-mediawiki.org> for live examples.
Display text in context of the user language[edit]
- Annotation
{{#subobject:
|@category=Test one
|Has monolingual text=123@en
}}{{#subobject:
|@category=Test one
|Has monolingual text=一二三@ja
}}
- Query
{{#ask:
[[Category:Test one]]
[[Has monolingual text::?@{{USERLANGUAGECODE}}]]
|?Has monolingual text|+index=1
|mainlabel=-
|headers=hide
}}
See <sandbox.semantic-mediawiki.org> for live examples.
The
{{USERLANGUAGECODE}} variable used in this example is provided by extension "MyVariables" (MediaWiki.org).
Further examples[edit]
- API example
Some use of "" in your query was not closed by a matching "".
See also[edit]
- Info page on Multilingual Semantic MediaWiki
- Help page on localization and multilingual content
- Help page on content, page and user language
- Help page on special property "Has property description"Adds localizable context help to properties
- Help page on special property "Has preferred property label"Adds localizable labels to a property
- Help page on special property "Language code"Handles BCP47 conform language codes specifying the language of the annotated text
The combination "en":"Help:Type Monolingual text" already exists for page "Help:Type Monolingual text" therefore no additional interlanguage annotation was created.
References
- ^ Semantic MediaWiki: GitHub pull request gh:smw:1344