ws.ArchWiki.lang module

The ArchWiki.lang submodule contains multiple functions related to ArchWiki specific way of setting localized page titles, handling of categories for localized pages etc.

See the documentation on Help:i18n on ArchWiki for the specification.

ws.ArchWiki.lang.get_local_language()
ws.ArchWiki.lang.get_language_names()
ws.ArchWiki.lang.is_language_name(lang)
ws.ArchWiki.lang.get_english_language_names()
ws.ArchWiki.lang.is_english_language_name(lang)
ws.ArchWiki.lang.get_language_tags()
ws.ArchWiki.lang.is_language_tag(tag)
ws.ArchWiki.lang.is_rtl_tag(tag)
ws.ArchWiki.lang.is_rtl_language(lang)
ws.ArchWiki.lang.get_interlanguage_tags()
ws.ArchWiki.lang.is_interlanguage_tag(tag)
ws.ArchWiki.lang.get_external_tags()
ws.ArchWiki.lang.is_external_tag(tag)
ws.ArchWiki.lang.get_internal_tags()
ws.ArchWiki.lang.is_internal_tag(tag)
ws.ArchWiki.lang.langname_for_english(lang)
ws.ArchWiki.lang.langname_for_tag(tag)
ws.ArchWiki.lang.english_for_langname(lang)
ws.ArchWiki.lang.english_for_tag(tag)
ws.ArchWiki.lang.tag_for_langname(lang)
ws.ArchWiki.lang.tag_for_english(lang)
ws.ArchWiki.lang.detect_language(title, *, strip_all_subpage_parts=True)

Detect language of a given title. The matching is case-sensitive and spaces are treated the same way as underscores.

Parameters

title – page title to work with

Returns

a (pure, lang) tuple, where pure is the pure page title without the language suffix and lang is the detected language in long, localized form

ws.ArchWiki.lang.format_title(title, langname, *, augment_all_subpage_parts=True)

Formats a local title for given base title and language. It is basically an inverse operation for detect_language().

Parameters
  • title (str) – the base title

  • langname (str) – the language name of the title to be produced

Returns

a string representing the local title