Editing
Module:Languages/config
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- Ported from https://wiki.openstreetmap.org/wiki/Module:Languages/config on Sep 2, 2025 local p = {} -- Map all known language codes to their autonyms per MediaWiki, then fix up a -- few codes and names that are incorrect in MediaWiki for historical reasons. local languageNamesByCode = mw.language.fetchLanguageNames() languageNamesByCode.gcf = "kréyòl gwadloupéyen" -- Guadeloupean Creole French languageNamesByCode["sr-cyrl"] = languageNamesByCode["sr-ec"] languageNamesByCode["sr-latn"] = languageNamesByCode["sr-el"] languageNamesByCode["cnr"] = "Crnogorski" -- Montenegrin language --- A table mapping language codes to their autonyms. Every language code in --- languageCodes must have a pair in this table, but this table has many pairs --- that go unused in languageCodes. p.languageNamesByCode = languageNamesByCode --- A table of ISO 639 language codes for the languages used on this wiki, --- sorted by autonym. A language code may be included only if there is at least --- one content page in the language that has the code in its title (either as a --- namespace or a pseudonamespace). Empty categories and redirects don’t count. p.languageCodes = { -- After modifying this table, rerun p.languageCodesSortedByName() in the -- debug console below and paste the re-sorted results here. This ensures -- that the codes are sorted by language name. "af", "ast", "az", "id", "ms", "bs", "br", "ca", "cs", "cnr", "da", "de", "et", "en", "es", "eo", "eu", "fr", "fy", "gd", "gl", "hr", "io", "ia", "is", "it", "ht", "gcf", "ku", "lv", "lb", "lt", "hu", "nl", "no", "nn", "oc", "pl", "pt", "ro", "sc", "sq", "sk", "sl", "sr-latn", "fi", "sv", "tl", "vi", "tr", "diq", "el", "be", "bg", "mk", "mn", "ru", "sr", "uk", "hy", "he", "ar", "skr", "fa", "pnb", "ps", "ne", "mr", "hi", "bn", "pa", "ta", "ml", "si", "th", "my", "ko", "ka", "tzm", "zh-hans", "zh-hant", "ja", "yue", } --- A table of language codes for languages that are only nominally used on this --- wiki. A language code is included in this table if there is at least one --- non-redirect page in the language, such as a category or template. If there --- is a content page in the language, place the code in languageCodes instead. --- Unlike the table above, this is sorted by code (and manually). p.minorLanguageCodes = { "ab", "am", "an", "as", "av", "ay", "ba", "bm", "bo", "co", "cy", "dv", "ext", "ga", "gsw", "gu", "ha", "ie", "ig", "jv", "kk", "km", "kn", "ky", "la", "ldn", "li", "lo", "mg", "min", "mt", "nan", "nds", "nds-nl", "om", "or", "sa", "sd", "so", "su", "sw", "te", "tg", "tk", "ug", "ur", "uz", "vec", "wa", "wo", "wuu", "xh", "yi", "yo", "za", "zh", "zu", } --- A table mapping deprecated language codes to their preferred replacements. --- Deprecated language codes should not be used on new pages, but a few content --- pages remain under these pseudonamespaces for now. p.deprecatedLanguageCodes = { ["pt-br"] = "pt", ["ro-md"] = "ro", ["zh-tw"] = "zh-hant", } --- A table mapping language codes to their content namespaces. For historical --- reasons, several early languages got dedicated content namespaces, but most --- languages rely on pseudonamespaces in the main content namespace. Apart from --- pseudonamespaces, the main content namespace is assumed to be in English. p.namespacesByLanguage = { ["de"] = "DE", ["en"] = "", ["es"] = "ES", ["fr"] = "FR", ["it"] = "IT", ["ja"] = "JA", ["nl"] = "NL", ["ru"] = "RU", } --- A table mapping certain language codes to the names of the categories --- tracking missing translations in those languages. This table only includes --- languages that have dedicated namespaces. p.unavailablePageCategoryNames = { ["de"] = "Pages unavailable in German", ["en"] = "Pages unavailable in English", ["es"] = "Pages unavailable in Spanish", ["fr"] = "Pages unavailable in French", ["it"] = "Pages unavailable in Italian", ["ja"] = "Pages unavailable in Japanese", ["nl"] = "Pages unavailable in Dutch", ["ru"] = "Pages unavailable in Russian", } if mw.title.getCurrentTitle().fullText == "Module:Languages/config" then --- Logs a table of language codes sorted by autonym. This function is only --- available in the debug console, because NFD normalization uses a lot of --- memory. p.languageCodesSortedByName = function () local siteLanguage = mw.getContentLanguage() local codes = {} local sortingKeys = {} for i, code in ipairs(p.languageCodes) do table.insert(codes, code) local foldedName = siteLanguage:caseFold(languageNamesByCode[code]) -- Fold diacritics by isolating and deleting combining characters. sortingKeys[code] = mw.ustring.gsub(mw.ustring.toNFD(foldedName), "[^%a%p%s]+", "") end table.sort(codes, function (a, b) return sortingKeys[a] < sortingKeys[b] end) mw.log((table.concat(codes, " "):gsub("(%S+)", "\"%1\","))) end end return p
Summary:
Please note that all contributions to Scout Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
Scout Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Languages/config/doc
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Tools
What links here
Related changes
Page information