Module:Localized name
Summary
This template is a standardized table for the languages that the série Splatoon supports, to translate article subjects and provide their respective meanings.
Usage
This template should precede the Trivia section of a page and be a subsection to Etymology when applicable.
The color of the template can be specified using
- color= X, where X is Splatoon for a Splatoon article, Splatoon 2 for a Splatoon 2 article, and Splatoon 3 for a Splatoon 3 article. Do not use this parameter for a table that is not specifically attributed to any game.
If needed, the table can be customized using
- title= X, where X is any title you want to add. This parameter is meant for pages with multiple uses of the template to be able to have more precise titles.
- column-1= X, where X is the heading for column 1. By default this is "Language".
- column-2= X, where X is the heading for column 2. By default this is "Name".
- column-3= X, where X is the heading for column 3. By default this is "Meaning".
The language's abbreviation and M (for Meaning) are parameters for this template. For Japanese, Korean, Chinese and Russian, an additional abbreviation + R (Romanized) can be used. Multiple names can also be specified by adding the number 1 to 9 after the language's abbreviation (e.g. Jap1
, Jap1R
, Jap1M
), in case there has been multiple different localization for the name in various context.
Chinese, French, Spanish, and Portuguese have additional localizations depending on the region. If the localization is the same, please use the parent group. Otherwise, the more specific parameters should be used.
Parameter | Additional options | Language | Culture code |
---|---|---|---|
Jap | JapM, JapR | Japanese | JPja |
Dut | DutM | Dutch | EUnl |
Fra or Fre | FraM | French | EUfr and USfr |
FraA or FreA | FraAM | NOA French | USfr |
FraE or FreE | FraEM | NOE French | EUfr |
Ger | GerM | German | EUde |
Ita | ItaM | Italian | EUit |
Por | PorM | Portuguese | EUpt(?) and USpt(?) |
PorA | PorAM | NOA Portuguese | USpt(?) |
PorE | PorEM | NOE Portuguese | EUpt(?) |
Rus | RusM, RusR | Russian | EUru |
Spa | SpaM | Spanish | EUes and USes |
SpaA | SpaAM | NOA Spanish | USes |
SpaE | SpaEM | NOE Spanish | EUes |
Chi | ChiM, ChiR | Chinese | CNzh and TWzh |
ChiS | ChiSM, ChiSR | Simplified Chinese | CNzh |
ChiT | ChiTM, ChiTR | Traditional Chinese | TWzh |
Kor | KorM, KorR | Korean | KRko |
Cze | CzeM | Czech | ? |
Dan | DanM | Danish | ? |
Fin | FinM | Finnish | ? |
Hun | HunM | Hungarian | ? |
Nor | NorM | Norwegian | ? |
Pol | PolM | Polish | ? |
Swe | SweM | Swedish | ? |
Internal | InternalM | Game IDs and supporting notes. This must be sourced per our leaks policy. |
-- |
Eng | EngM | Anglais | ? |
EngA | EngAM | Anglais NOA | ? |
EngE | EngME | Anglais NOE | ? |
Examples
A small table:
{{Localized name |title=Small table |color=Splatoon 2 |Jap=Example Japanese |JapM=Explanation for Japanese }}
A full template:
{{Localized name |title=Optional table title |color=Splatoon |Jap=日本語 |JapR=Nihongo |JapM=Japanese |Dut=nederlands |DutM=Dutch |Fre=français |FreM=French |Ger=Deutsch |GerM=German |Ita=italiano |ItaM=Italian |Por=portugues |PorM=Portuguese |Rus=русский |RusR=russkiy |RusM=Russian |Spa=español |SpaM=Spanish |Chi=中文 |ChiR=zhōngwén |ChiM=Chinese |Kor=한국어 |KorR=han gook uh |KorM=Korean language |Cze=český jazyk |CzeM=Czech language |Dan=dansk |DanM=Danish |Fin=Suomen kieli |FinM=Finnish language |Hun=magyar nyelv |HunM=Hungarian language |Nor=norsk |NorM=Norweigian |Pol=Język polski |PolM=Polish language |Swe=svenska |SweM=Swedish |Eng=Anglais |EngM=Anglais |Internal=Vss_Object_Language |InternalM=Additional notes for the game IDs }}
Multiple names:
{{Localized name |title=Multiple names test |Jap=数字 |JapR=sūji |JapM=numeral |Jap1=一 |Jap1R=ichi |Jap1M=one |Jap2=二 |Jap2R=ni |Jap2M=two |Jap3=三 |Jap3R=san |Jap3M=three |Jap4=四 |Jap4R=shi |Jap4M=four |Jap5=五 |Jap5R=go |Jap5M=five |Jap6=六 |Jap6R=roku |Jap6M=six |Jap7=七 |Jap7R=shichi |Jap7M=seven |Jap8=八 |Jap8R=hachi |Jap8M=eight |Jap9=九 |Jap9R=kyū |Jap9M=nine }}
Which looks like:
Langue | Nom | Signification |
---|---|---|
Japan Japonais | Example Japanese | Explanation for Japanese |
Langue | Nom | Signification |
---|---|---|
Japan Japonais | 日本語 Nihongo |
Japanese |
USAUK Anglais | Anglais | Anglais |
Germany Allemand | Deutsch | German |
SpainMexico Espagnol | español | Spanish |
Italy Italien | italiano | Italian |
Netherlands Néerlandais | nederlands | Dutch |
Portugal Portugais | portugues | Portuguese |
Russia Russe | русский russkiy |
Russian |
China Chinois | 中文 zhōngwén |
Chinese |
South Korea Coréen | 한국어 han gook uh |
Korean language |
Denmark Danois | dansk | Danish |
Finland Finlandais | Suomen kieli | Finnish language |
Hungary Hongrois | magyar nyelv | Hungarian language |
Norway Norvégien | norsk | Norweigian |
Poland Polonais | Język polski | Polish language |
Sweden Suédois | svenska | Swedish |
CzechRepublic Tchèque | český jazyk | Czech language |
Fichier:Translate logo.svg Identifiant interne | Vss_Object_Language | Additional notes for the game IDs |
Langue | Nom | Signification |
---|---|---|
Japan Japonais | 数字 sūji |
numeral |
一 ichi |
one | |
二 ni |
two | |
三 san |
three | |
四 shi |
four | |
五 go |
five | |
六 roku |
six | |
七 shichi |
seven | |
八 hachi |
eight | |
九 kyū |
nine |
local p = {}
local gameShortenedModule = require("Module:Game shortened")
local flagModule = require("Module:Flag")
local function getGameShortened(game, default)
return gameShortenedModule.getGame(game, default)
end
local function getFlag(country)
return flagModule.getFlag(country, "20x20")
end
-- Function to handle a single language entry in the table
-- t: the table to append
-- args: the frame args which includes the Meaning and Romanized values if applicable
-- languageTitle: the Title Case description of the language
-- wikiParameter: the base wiki parameter (without M and R) for the language we are handling
-- flagParameter: the two letter lower-case code for this language
-- htmlLanguageCode: the language code used in HTML for this language. Reference: [https://www.w3schools.com/tags/ref_language_codes.asp]
local function handleLanguage(t, args, languageTitle, wikiParameter, flagParameter, htmlLanguageCode)
local function getName(args, wikiParameter)
local name = args[wikiParameter] or "Unnamed language (" .. wikiParameter .. ")"
local romanized = ""
if args[wikiParameter .. "R"] and args[wikiParameter .. "R"] ~= "" then
romanized = "<br/>''" .. args[wikiParameter .. "R"] .. "''"
end
local meaning = ""
if args[wikiParameter .. "M"] and args[wikiParameter .. "M"] ~= "" then
meaning = args[wikiParameter .. "M"]
end
return {
name=name,
romanized=romanized,
meaning=meaning,
}
end
local names = {}
if args[wikiParameter] and args[wikiParameter] ~= '' then
table.insert(names, getName(args, wikiParameter))
end
for i=1,9 do
if args[wikiParameter .. i] and args[wikiParameter .. i] ~= '' then
table.insert(names, getName(args, wikiParameter .. i))
end
end
if table.getn(names) > 0 then
local flag = getFlag(flagParameter)
if not flag then
flag = "[[File:Flag.svg|link=]]"
end
local htmlLang = htmlLanguageCode or wikiParameter or ""
for i,v in ipairs(names) do
table.insert(t, "|-")
local row = ""
if i == 1 then
if table.getn(names) > 1 then
row = "|rowspan=" .. table.getn(names)
end
row = row .. "|" .. flag .. " " .. languageTitle .. "||"
end
row = row .. "|<span lang=\"" .. htmlLang .. "\">" .. v.name .. "</span>" .. v.romanized .. "|||" .. v.meaning
table.insert(t, row)
end
end
end
function p.main(frame)
local args = frame:getParent().args
return p.localizedName(args)
end
function p.localizedName(args)
local colorClass = "generic"
if args["color"] and args["color"] ~= '' then
colorClass = mw.ustring.lower(getGameShortened(args["color"], "generic")) or "generic"
end
local t = {}
mw.logObject(colorClass)
table.insert(t, '{| class="wikitable sitecolor-' .. colorClass .. '" style="min-width: 25%;')
if args["title"] then
table.insert(t, "|+" .. args.title)
end
table.insert(t, "!" .. (args["column-1"] or "Langue"))
table.insert(t, "!" .. (args["column-2"] or "Nom"))
table.insert(t, "!" .. (args["column-3"] or "Signification"))
-- Handle each language
handleLanguage(t, args, "Français (NOA)", "FreA", "ca", "fr-ca")
handleLanguage(t, args, "Japonais", "Jap", "jp", "ja")
handleLanguage(t, args, "Anglais", "Eng", "usgb", "usgb")
handleLanguage(t, args, "Anglais (NOA)", "EngA", "uk", "en-uk")
handleLanguage(t, args, "Anglais (NOE)", "EngE", "us", "en-us")
handleLanguage(t, args, "Allemand", "Ger", "de", "de")
handleLanguage(t, args, "Espagnol", "Spa", "esmx", "es")
handleLanguage(t, args, "Espagnol (NOA)", "SpaA", "mx", "es-mx")
handleLanguage(t, args, "Espagnol (NOE)", "SpaE", "es", "es-es")
handleLanguage(t, args, "Italien", "Ita", "it", "it")
handleLanguage(t, args, "Néerlandais", "Dut", "nl", "nl")
handleLanguage(t, args, "Portugais", "Por", "pt", "pt")
handleLanguage(t, args, "Portugais (NOA)", "PorA", "br", "pt-br")
handleLanguage(t, args, "Portugais (NOE)", "PorE", "pt", "pt-pt")
handleLanguage(t, args, "Russe", "Rus", "ru", "ru")
handleLanguage(t, args, "Chinois", "Chi", "cn", "zh")
handleLanguage(t, args, "Chinois (Simplifié)", "ChiS", "cn", "zh-Hans")
handleLanguage(t, args, "Chinois (Traditionnel)", "ChiT", "hk", "zh-Hant")
handleLanguage(t, args, "Coréen", "Kor", "kr", "ko")
handleLanguage(t, args, "Danois", "Dan", "dk", "da")
handleLanguage(t, args, "Finlandais", "Fin", "fi", "fi")
handleLanguage(t, args, "Hongrois", "Hun", "hu", "hu")
handleLanguage(t, args, "Norvégien", "Nor", "no", "no")
handleLanguage(t, args, "Polonais", "Pol", "pl", "pl")
handleLanguage(t, args, "Suédois", "Swe", "se", "sv")
handleLanguage(t, args, "Tchèque", "Cze", "cz", "cs")
-- Internal is a bit different because there's no code or flag
if args["Internal"] and args["Internal"] ~= '' then
table.insert(t, "|-")
table.insert(t, "|[[File:Translate logo.svg|border|20px|link=]] Identifiant interne|||<span lang=\"\">" .. args["Internal"] .. "</span>|||" .. (args["InternalM"] or ""))
end
return table.concat(t, "\n") .. "\n|}"
end
return p