Help:Type Monolingual text

From semantic-mediawiki.org
Jump to: navigation, search
Monolingual text
To associate a text value with a specific language code
Further Information
Provided by: Semantic MediaWiki
Added in version: 2.4.0
Removed in version: still in use
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

  • Internally each MonolingualTextValue is stored as separate entity using the ContainerSemanticData construct allowing for `foo@en` to be different from `foo@ja` by 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).
  • [[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 (Localizer::asBCP47FormattedLanguageCode).
  • The Language code is internally managed by Language code property

Examples

[[Has monolingual text::foo@ja]]

{{#subobject:
 |Has monolingual text=foo@en
}}
{{#ask:
 [[Has monolingual text::?@ja]]
 |?Has monolingual text|+index=1
 |mainlabel=-
 |headers=hide
}}

Display text in context of a language:

{{#subobject:
 |@category=Test one
 |Has monolingual text=123@en
}}{{#subobject:
 |@category=Test one
 |Has monolingual text=一二三@ja
}}
{{#ask:
 [[Category:Test one]]
 [[Has monolingual text::?@{{USERLANG}}]]
 |?Has monolingual text|+index=1
 |mainlabel=-
 |headers=hide
}}

See <sandbox.semantic-mediawiki.org> for live examples.

See also


This documentation page applies to all SMW versions from 2.4.0 to the most current version.
     

Help:Type Monolingual text en 2.4.0