ဝီႇၶီႇဝွႆးဢဵတ်ႇꩡ်
shnwikivoyage
https://shn.wikivoyage.org/wiki/%E1%81%BC%E1%82%83%E1%82%88%E1%82%81%E1%80%B0%E1%80%9D%E1%80%BA%E1%82%81%E1%82%85%E1%81%B5%E1%80%BA%E1%82%88
MediaWiki 1.47.0-wmf.1
first-letter
သိုဝ်ႇၶၢဝ်ႇ
ၶိုၵ်ႉတွၼ်း
ဢုပ်ႇၵုမ်
ၽူႈၸႂ်ႉတိုဝ်း
ဢုပ်ႇၵုမ် ၽူႈၸႂ်ႉတိုဝ်း
ဝီႇၶီႇဝွႆးဢဵတ်ႇꩡ်
ဢုပ်ႇၵုမ် ဝီႇၶီႇဝွႆးဢဵတ်ႇꩡ်
ၾၢႆႇ
ဢုပ်ႇၵုမ် ၾၢႆႇ
မီႇတီႇယႃႇဝီႇၶီႇ
ဢုပ်ႇၵုမ် မီႇတီႇယႃႇဝီႇၶီႇ
ထႅမ်းပလဵတ်ႉ
ဢုပ်ႇၵုမ် ထႅမ်းပလဵတ်ႉ
လွင်ႈၸွႆႈထႅမ်
ဢုပ်ႇၵုမ် လွင်ႈၸွႆႈထႅမ်
ပိူင်ထၢၼ်ႈ
ဢုပ်ႇၵုမ် ပိူင်ထၢၼ်ႈ
TimedText
TimedText talk
မေႃႇၵျူး
ဢုပ်ႇၵုမ် မေႃႇၵျူး
Event
Event talk
ထႅမ်းပလဵတ်ႉ:Quickbar
10
669
8477
1583
2026-05-10T07:33:20Z
Saimawnkham
7
Replaced content with "{{#invoke:Quickbar|quickbar}}<noinclude> {{documentation}} </noinclude>"
8477
wikitext
text/x-wiki
{{#invoke:Quickbar|quickbar}}<noinclude>
{{documentation}}
</noinclude>
depoj35b5mrl0a42qbomuwn3l6agoib
မေႃႇၵျူး:Quickbar
828
1034
8478
2442
2026-05-10T07:34:18Z
Saimawnkham
7
ဢၢပ်ႉတဵတ်ႉၶေႃႈမုၼ်း
8478
Scribunto
text/plain
local function starts_with(str, start)
return str:sub(1, #start) == start
end
local function renderRow(heading, value)
return '|-\n| class="info" | \'\'\'' .. heading .. '\'\'\'\n| style="padding-right:5px;" | ' .. value .. '\n'
end
local function renderLinkedClaim(id)
local linkTarget = mw.wikibase.sitelink(id)
local linkName = mw.wikibase.label(id)
if linkTarget == nil then
return linkName
else
return '[[' .. linkTarget .. '|' .. linkName .. ']]'
end
end
local function rSimple(item, property)
return item:formatPropertyValues( property ).value
end
local lang = mw.language.getContentLanguage()
local thousands = {'', 'thousand', 'million', 'billion'}
local function sigfigs(num)
local digits = math.floor(math.log10(num) / 3)
if digits <= 0 then
return lang:formatNum(num)
end
num = math.floor(num / math.pow(10, 3 * digits -1)) / 10
local result = lang:formatNum(num)
result = result .. ' ' .. thousands[digits+1]
-- if num ~= 1 then
-- result = result .. 's'
-- end
return result
end
local function rPopulation(item, property, frame)
local s = item:getBestStatements( property )[1]
local result = sigfigs( tonumber(s.mainsnak.datavalue.value.amount) )
if s.qualifiers ~= nil and s.qualifiers['P585'] ~= nil and #s.qualifiers['P585'] > 0 then
result = result .. ' (' .. string.match(s.qualifiers['P585'][1].datavalue.value.time, '0*([1-9][0-9]+)\-', 1) .. ')'
end
return result
end
local function rElectricity(item, property)
local claims = item:getBestStatements( property )
local voltage = {}
for _,s in pairs(claims) do
local v = mw.wikibase.renderSnak( s.mainsnak )
if s.qualifiers ~= nil and s.qualifiers['P2144'] ~= nil and #s.qualifiers['P2144'] > 0 then
v = v .. ' / ' .. mw.wikibase.renderSnak(s.qualifiers['P2144'][1])
end
table.insert(voltage, v)
end
local result = table.concat(voltage, ' and ')
if #item:getBestStatements('P2853') > 0 then
result = result .. ' (' .. item:formatPropertyValues( 'P2853' ).value .. ')'
end
return result
end
local function claimOrLabel(id, property)
local item = mw.wikibase.getEntity( id )
if #item:getBestStatements( property ) > 0 and item:getBestStatements( property )[1].mainsnak.datavalue ~= nil then
return mw.wikibase.renderSnak( item:getBestStatements( property )[1].mainsnak )
end
return item:getLabel()
end
local function rCurrency(item, property)
local claims = item:getBestStatements(property)
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
local currency = mw.wikibase.getEntity( id )
local subresult = currency:getLabel()
local symbol = claimOrLabel( id, 'P498' )
if symbol ~= currency:getLabel() then
subresult = subresult .. ' (' .. symbol .. ')'
end
-- if #currency:getBestStatements('P2284') > 0 then
-- for _, price in pairs(currency:getBestStatements('P2284')) do
-- if tonumber(price.mainsnak.datavalue.value.amount) ~= 0 then
-- subresult = subresult .. '<br/>1 '..symbol..' = '.. string.format('%.4f', price.mainsnak.datavalue.value.amount ) .. ' ' .. claimOrLabel(string.match(price.mainsnak.datavalue.value.unit , 'Q%d+$'), 'P498')
-- end
-- end
-- end
table.insert(result, subresult)
end
return table.concat(result, '<br/>')
end
local function rEmergency(item, property)
local claims = item:getBestStatements( property )
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
local res = claimOrLabel(id, 'P1329')
if claim.qualifiers ~= nil and claim.qualifiers['P366'] ~= nil and #claim.qualifiers['P366'] > 0 then
local usage = {}
for _, qual in pairs(claim.qualifiers['P366']) do
table.insert( usage, mw.wikibase.renderSnak(qual) )
end
res = res .. ' (' .. table.concat(usage, ', ') .. ')'
end
table.insert(result, res)
end
return table.concat(result, ', ')
end
local function rTimezones(item, property)
local claims = item:getBestStatements( property )
if #claims > 3 then
local minEntity = nil
local maxEntity = nil
local minOffset = 20
local maxOffset = -20
local unknownTZs = {}
for _, claim in pairs(claims) do
local e = mw.wikibase.getEntity('Q' .. claim.mainsnak.datavalue.value['numeric-id'] )
if #e:getBestStatements( 'P2907' ) == 1 then
local val = tonumber( e:getBestStatements( 'P2907' )[1].mainsnak.datavalue.value.amount )
if val < minOffset then
minOffset = val
minEntity = e
end
if val > maxOffset then
maxOffset = val
maxEntity = e
end
else
table.insert(unknownTZs, e:getLabel())
end
end
if minEntity ~= nil and maxEntity ~= nil and minOffset ~= maxOffset then
local r = minEntity:getLabel() .. ' to ' .. maxEntity:getLabel()
if #unknownTZs > 0 then
r = r .. ' and ' .. table.concat(unknownTZs, ', ')
end
return r
end
end
return rSimple(item, property)
end
local function rSingleLinked(item, property)
if item:getBestStatements( property )[1].mainsnak.datavalue ~= nil then
return renderLinkedClaim('Q'..item:getBestStatements( property )[1].mainsnak.datavalue.value['numeric-id'])
else
return nil
end
end
local function rLinked(item, property)
local claims = item.claims[property]
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
table.insert(result, renderLinkedClaim(id))
end
return table.concat(result, ', ')
end
local conf = {
{'capital', 'Capital', 36, rSingleLinked},
{'currency', 'Currency', 38, rCurrency},
{'population', 'Population', 1082, rPopulation},
{'electricity', '[[Electrical systems|Electricity]]', 2884, rElectricity},
{'callingcode', '[[List of country calling codes|Country code]]', 474, rSimple},
{'timezone', '[[Time zones|Time zone]]', 421, rTimezones},
{'emergencies', 'Emergencies', 2852, rEmergency},
{'driving side', 'Driving side', 1622, rSimple}
}
local p = {}
function p.quickbar( frame )
local parentArgs = frame:getParent().args
local elements = {}
local item = mw.wikibase.getEntity( )
local useWikidata = (item ~= nil and item.claims ~= nil)
local missingInfo = false
local locationMap = parentArgs['location']
if (locationMap and starts_with(locationMap, '#Q')) then
item = mw.wikibase.getEntity(locationMap:gsub("#", ""))
locationMap = nil
end
if (locationMap ~= nil and locationMap ~= '') or (useWikidata and item.claims['P242'] ~= nil and item.claims['P242'][1] ~= nil) then
if useWikidata and (locationMap == nil or locationMap == '') then
locationMap = mw.wikibase.renderSnak( item:getBestStatements('P242')[1].mainsnak )
end
table.insert(elements, '| colspan="2" style="text-align:center; padding:0" | [[File:' .. locationMap .. '|250px]]\n' )
else
missingInfo = true
end
item = mw.wikibase.getEntity( )
for _, params in pairs( conf ) do
if params[3] ~= 0 then
local val = parentArgs[params[1]]
if (val and starts_with(val, '#Q')) then
item = mw.wikibase.getEntity(val:gsub("#", ""))
val = nil
end
if val == '' or val == nil then
if useWikidata and #item:getBestStatements('P' .. params[3]) > 0 then
val = params[4]( item, 'P' .. params[3], frame)
if val ~= nil then
table.insert( elements, renderRow(params[2], val) )
else
missingInfo = true
end
else
missingInfo = true
end
else
table.insert(elements, renderRow(params[2], val) )
end
end
item = mw.wikibase.getEntity( )
end
local editRow = ''
if item ~= nil then
editRow = '|-\n| colspan="2" class="info footer" |[[:d:'.. item.id .. '|edit on Wikidata]]\n'
end
if #elements > 0 then
if missingInfo == true and mw.title.getCurrentTitle().namespace == 0 then
table.insert(elements, '[[Category:Quickbar with missing information]]\n')
end
return frame:extensionTag {name = 'templatestyles', args = {src = 'Quickbar/styles.css'}} .. '<div id="quickbar" class="wv-quickbar floatright">\n{| cellpadding="0" cellspacing="0"\n|-\n' ..
table.concat(elements) ..
'\n'.. editRow.. '|}</div>'
else
if mw.title.getCurrentTitle().namespace == 0 then
return '[[Category:Quickbar with missing information]]\n'
end
return ''
end
end
return p
ch1xr2ctdrpkoo4xnwe3crkgufmpbvt
8479
8478
2026-05-10T07:41:36Z
Saimawnkham
7
8479
Scribunto
text/plain
local function starts_with(str, start)
return str:sub(1, #start) == start
end
local function renderRow(heading, value)
return '|-\n| class="info" | \'\'\'' .. heading .. '\'\'\'\n| style="padding-right:5px;" | ' .. value .. '\n'
end
local function renderLinkedClaim(id)
local linkTarget = mw.wikibase.sitelink(id)
local linkName = mw.wikibase.label(id)
if linkTarget == nil then
return linkName
else
return '[[' .. linkTarget .. '|' .. linkName .. ']]'
end
end
local function rSimple(item, property)
return item:formatPropertyValues( property ).value
end
local lang = mw.language.getContentLanguage()
local thousands = {'', 'thousand', 'million', 'billion'}
local function sigfigs(num)
local digits = math.floor(math.log10(num) / 3)
if digits <= 0 then
return lang:formatNum(num)
end
num = math.floor(num / math.pow(10, 3 * digits -1)) / 10
local result = lang:formatNum(num)
result = result .. ' ' .. thousands[digits+1]
-- if num ~= 1 then
-- result = result .. 's'
-- end
return result
end
local function rPopulation(item, property, frame)
local s = item:getBestStatements( property )[1]
local result = sigfigs( tonumber(s.mainsnak.datavalue.value.amount) )
if s.qualifiers ~= nil and s.qualifiers['P585'] ~= nil and #s.qualifiers['P585'] > 0 then
result = result .. ' (' .. string.match(s.qualifiers['P585'][1].datavalue.value.time, '0*([1-9][0-9]+)\-', 1) .. ')'
end
return result
end
local function rElectricity(item, property)
local claims = item:getBestStatements( property )
local voltage = {}
for _,s in pairs(claims) do
local v = mw.wikibase.renderSnak( s.mainsnak )
if s.qualifiers ~= nil and s.qualifiers['P2144'] ~= nil and #s.qualifiers['P2144'] > 0 then
v = v .. ' / ' .. mw.wikibase.renderSnak(s.qualifiers['P2144'][1])
end
table.insert(voltage, v)
end
local result = table.concat(voltage, ' and ')
if #item:getBestStatements('P2853') > 0 then
result = result .. ' (' .. item:formatPropertyValues( 'P2853' ).value .. ')'
end
return result
end
local function claimOrLabel(id, property)
local item = mw.wikibase.getEntity( id )
if #item:getBestStatements( property ) > 0 and item:getBestStatements( property )[1].mainsnak.datavalue ~= nil then
return mw.wikibase.renderSnak( item:getBestStatements( property )[1].mainsnak )
end
return item:getLabel()
end
local function rCurrency(item, property)
local claims = item:getBestStatements(property)
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
local currency = mw.wikibase.getEntity( id )
local subresult = currency:getLabel()
local symbol = claimOrLabel( id, 'P498' )
if symbol ~= currency:getLabel() then
subresult = subresult .. ' (' .. symbol .. ')'
end
-- if #currency:getBestStatements('P2284') > 0 then
-- for _, price in pairs(currency:getBestStatements('P2284')) do
-- if tonumber(price.mainsnak.datavalue.value.amount) ~= 0 then
-- subresult = subresult .. '<br/>1 '..symbol..' = '.. string.format('%.4f', price.mainsnak.datavalue.value.amount ) .. ' ' .. claimOrLabel(string.match(price.mainsnak.datavalue.value.unit , 'Q%d+$'), 'P498')
-- end
-- end
-- end
table.insert(result, subresult)
end
return table.concat(result, '<br/>')
end
local function rEmergency(item, property)
local claims = item:getBestStatements( property )
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
local res = claimOrLabel(id, 'P1329')
if claim.qualifiers ~= nil and claim.qualifiers['P366'] ~= nil and #claim.qualifiers['P366'] > 0 then
local usage = {}
for _, qual in pairs(claim.qualifiers['P366']) do
table.insert( usage, mw.wikibase.renderSnak(qual) )
end
res = res .. ' (' .. table.concat(usage, ', ') .. ')'
end
table.insert(result, res)
end
return table.concat(result, ', ')
end
local function rTimezones(item, property)
local claims = item:getBestStatements( property )
if #claims > 3 then
local minEntity = nil
local maxEntity = nil
local minOffset = 20
local maxOffset = -20
local unknownTZs = {}
for _, claim in pairs(claims) do
local e = mw.wikibase.getEntity('Q' .. claim.mainsnak.datavalue.value['numeric-id'] )
if #e:getBestStatements( 'P2907' ) == 1 then
local val = tonumber( e:getBestStatements( 'P2907' )[1].mainsnak.datavalue.value.amount )
if val < minOffset then
minOffset = val
minEntity = e
end
if val > maxOffset then
maxOffset = val
maxEntity = e
end
else
table.insert(unknownTZs, e:getLabel())
end
end
if minEntity ~= nil and maxEntity ~= nil and minOffset ~= maxOffset then
local r = minEntity:getLabel() .. ' to ' .. maxEntity:getLabel()
if #unknownTZs > 0 then
r = r .. ' and ' .. table.concat(unknownTZs, ', ')
end
return r
end
end
return rSimple(item, property)
end
local function rSingleLinked(item, property)
if item:getBestStatements( property )[1].mainsnak.datavalue ~= nil then
return renderLinkedClaim('Q'..item:getBestStatements( property )[1].mainsnak.datavalue.value['numeric-id'])
else
return nil
end
end
local function rLinked(item, property)
local claims = item.claims[property]
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
table.insert(result, renderLinkedClaim(id))
end
return table.concat(result, ', ')
end
local conf = {
{'capital', 'ဝဵင်းငဝ်ႈၸိုင်ႈ', 36, rSingleLinked},
{'currency', 'ငိုၼ်းတွင်း', 38, rCurrency},
{'population', 'ႁူဝ်ၼပ်ႉၵူၼ်း', 1082, rPopulation},
{'electricity', '[[:en:Electrical systems|ၾႆးၾႃႉ]]', 2884, rElectricity},
{'callingcode', '[[:en:List of country calling codes|လၵ်းမၢႆမိူင်း]]', 474, rSimple},
{'timezone', '[[:en:Time zones|ၸူၼ်ႇၶၢဝ်းယၢမ်း]]', 421, rTimezones},
{'emergencies', 'လွင်ႈၶိုၵ်ႉၶၢၵ်ႉ]', 2852, rEmergency},
{'driving side', 'ၽၢႆႇႁေႃႈလူတ်ႉ', 1622, rSimple}
}
local p = {}
function p.quickbar( frame )
local parentArgs = frame:getParent().args
local elements = {}
local item = mw.wikibase.getEntity( )
local useWikidata = (item ~= nil and item.claims ~= nil)
local missingInfo = false
local locationMap = parentArgs['location']
if (locationMap and starts_with(locationMap, '#Q')) then
item = mw.wikibase.getEntity(locationMap:gsub("#", ""))
locationMap = nil
end
if (locationMap ~= nil and locationMap ~= '') or (useWikidata and item.claims['P242'] ~= nil and item.claims['P242'][1] ~= nil) then
if useWikidata and (locationMap == nil or locationMap == '') then
locationMap = mw.wikibase.renderSnak( item:getBestStatements('P242')[1].mainsnak )
end
table.insert(elements, '| colspan="2" style="text-align:center; padding:0" | [[File:' .. locationMap .. '|250px]]\n' )
else
missingInfo = true
end
item = mw.wikibase.getEntity( )
for _, params in pairs( conf ) do
if params[3] ~= 0 then
local val = parentArgs[params[1]]
if (val and starts_with(val, '#Q')) then
item = mw.wikibase.getEntity(val:gsub("#", ""))
val = nil
end
if val == '' or val == nil then
if useWikidata and #item:getBestStatements('P' .. params[3]) > 0 then
val = params[4]( item, 'P' .. params[3], frame)
if val ~= nil then
table.insert( elements, renderRow(params[2], val) )
else
missingInfo = true
end
else
missingInfo = true
end
else
table.insert(elements, renderRow(params[2], val) )
end
end
item = mw.wikibase.getEntity( )
end
local editRow = ''
if item ~= nil then
editRow = '|-\n| colspan="2" class="info footer" |[[:d:'.. item.id .. '|edit on Wikidata]]\n'
end
if #elements > 0 then
if missingInfo == true and mw.title.getCurrentTitle().namespace == 0 then
table.insert(elements, '[[Category:Quickbar with missing information]]\n')
end
return frame:extensionTag {name = 'templatestyles', args = {src = 'Quickbar/styles.css'}} .. '<div id="quickbar" class="wv-quickbar floatright">\n{| cellpadding="0" cellspacing="0"\n|-\n' ..
table.concat(elements) ..
'\n'.. editRow.. '|}</div>'
else
if mw.title.getCurrentTitle().namespace == 0 then
return '[[Category:Quickbar with missing information]]\n'
end
return ''
end
end
return p
d2nw1xjmdqnntgv78tzgi7p3sfilvnw
8480
8479
2026-05-10T07:42:58Z
Saimawnkham
7
ဢၢပ်ႉတဵတ်ႉၶေႃႈမုၼ်း
8480
Scribunto
text/plain
local function starts_with(str, start)
return str:sub(1, #start) == start
end
local function renderRow(heading, value)
return '|-\n| class="info" | \'\'\'' .. heading .. '\'\'\'\n| style="padding-right:5px;" | ' .. value .. '\n'
end
local function renderLinkedClaim(id)
local linkTarget = mw.wikibase.sitelink(id)
local linkName = mw.wikibase.label(id)
if linkTarget == nil then
return linkName
else
return '[[' .. linkTarget .. '|' .. linkName .. ']]'
end
end
local function rSimple(item, property)
return item:formatPropertyValues( property ).value
end
local lang = mw.language.getContentLanguage()
local thousands = {'', 'thousand', 'million', 'billion'}
local function sigfigs(num)
local digits = math.floor(math.log10(num) / 3)
if digits <= 0 then
return lang:formatNum(num)
end
num = math.floor(num / math.pow(10, 3 * digits -1)) / 10
local result = lang:formatNum(num)
result = result .. ' ' .. thousands[digits+1]
-- if num ~= 1 then
-- result = result .. 's'
-- end
return result
end
local function rPopulation(item, property, frame)
local s = item:getBestStatements( property )[1]
local result = sigfigs( tonumber(s.mainsnak.datavalue.value.amount) )
if s.qualifiers ~= nil and s.qualifiers['P585'] ~= nil and #s.qualifiers['P585'] > 0 then
result = result .. ' (' .. string.match(s.qualifiers['P585'][1].datavalue.value.time, '0*([1-9][0-9]+)\-', 1) .. ')'
end
return result
end
local function rElectricity(item, property)
local claims = item:getBestStatements( property )
local voltage = {}
for _,s in pairs(claims) do
local v = mw.wikibase.renderSnak( s.mainsnak )
if s.qualifiers ~= nil and s.qualifiers['P2144'] ~= nil and #s.qualifiers['P2144'] > 0 then
v = v .. ' / ' .. mw.wikibase.renderSnak(s.qualifiers['P2144'][1])
end
table.insert(voltage, v)
end
local result = table.concat(voltage, ' and ')
if #item:getBestStatements('P2853') > 0 then
result = result .. ' (' .. item:formatPropertyValues( 'P2853' ).value .. ')'
end
return result
end
local function claimOrLabel(id, property)
local item = mw.wikibase.getEntity( id )
if #item:getBestStatements( property ) > 0 and item:getBestStatements( property )[1].mainsnak.datavalue ~= nil then
return mw.wikibase.renderSnak( item:getBestStatements( property )[1].mainsnak )
end
return item:getLabel()
end
local function rCurrency(item, property)
local claims = item:getBestStatements(property)
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
local currency = mw.wikibase.getEntity( id )
local subresult = currency:getLabel()
local symbol = claimOrLabel( id, 'P498' )
if symbol ~= currency:getLabel() then
subresult = subresult .. ' (' .. symbol .. ')'
end
-- if #currency:getBestStatements('P2284') > 0 then
-- for _, price in pairs(currency:getBestStatements('P2284')) do
-- if tonumber(price.mainsnak.datavalue.value.amount) ~= 0 then
-- subresult = subresult .. '<br/>1 '..symbol..' = '.. string.format('%.4f', price.mainsnak.datavalue.value.amount ) .. ' ' .. claimOrLabel(string.match(price.mainsnak.datavalue.value.unit , 'Q%d+$'), 'P498')
-- end
-- end
-- end
table.insert(result, subresult)
end
return table.concat(result, '<br/>')
end
local function rEmergency(item, property)
local claims = item:getBestStatements( property )
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
local res = claimOrLabel(id, 'P1329')
if claim.qualifiers ~= nil and claim.qualifiers['P366'] ~= nil and #claim.qualifiers['P366'] > 0 then
local usage = {}
for _, qual in pairs(claim.qualifiers['P366']) do
table.insert( usage, mw.wikibase.renderSnak(qual) )
end
res = res .. ' (' .. table.concat(usage, ', ') .. ')'
end
table.insert(result, res)
end
return table.concat(result, ', ')
end
local function rTimezones(item, property)
local claims = item:getBestStatements( property )
if #claims > 3 then
local minEntity = nil
local maxEntity = nil
local minOffset = 20
local maxOffset = -20
local unknownTZs = {}
for _, claim in pairs(claims) do
local e = mw.wikibase.getEntity('Q' .. claim.mainsnak.datavalue.value['numeric-id'] )
if #e:getBestStatements( 'P2907' ) == 1 then
local val = tonumber( e:getBestStatements( 'P2907' )[1].mainsnak.datavalue.value.amount )
if val < minOffset then
minOffset = val
minEntity = e
end
if val > maxOffset then
maxOffset = val
maxEntity = e
end
else
table.insert(unknownTZs, e:getLabel())
end
end
if minEntity ~= nil and maxEntity ~= nil and minOffset ~= maxOffset then
local r = minEntity:getLabel() .. ' to ' .. maxEntity:getLabel()
if #unknownTZs > 0 then
r = r .. ' and ' .. table.concat(unknownTZs, ', ')
end
return r
end
end
return rSimple(item, property)
end
local function rSingleLinked(item, property)
if item:getBestStatements( property )[1].mainsnak.datavalue ~= nil then
return renderLinkedClaim('Q'..item:getBestStatements( property )[1].mainsnak.datavalue.value['numeric-id'])
else
return nil
end
end
local function rLinked(item, property)
local claims = item.claims[property]
local result = {}
for _, claim in pairs(claims) do
local id = 'Q' .. claim.mainsnak.datavalue.value['numeric-id']
table.insert(result, renderLinkedClaim(id))
end
return table.concat(result, ', ')
end
local conf = {
{'capital', 'ဝဵင်းငဝ်ႈၸိုင်ႈ', 36, rSingleLinked},
{'currency', 'ငိုၼ်းတွင်း', 38, rCurrency},
{'population', 'ႁူဝ်ၼပ်ႉၵူၼ်း', 1082, rPopulation},
{'electricity', '[[:en:Electrical systems|ၾႆးၾႃႉ]]', 2884, rElectricity},
{'callingcode', '[[:en:List of country calling codes|လၵ်းမၢႆမိူင်း]]', 474, rSimple},
{'timezone', '[[:en:Time zones|ၸူၼ်ႇၶၢဝ်းယၢမ်း]]', 421, rTimezones},
{'emergencies', 'လွင်ႈၶိုၵ်ႉၶၢၵ်ႉ', 2852, rEmergency},
{'driving side', 'ၽၢႆႇႁေႃႈလူတ်ႉ', 1622, rSimple}
}
local p = {}
function p.quickbar( frame )
local parentArgs = frame:getParent().args
local elements = {}
local item = mw.wikibase.getEntity( )
local useWikidata = (item ~= nil and item.claims ~= nil)
local missingInfo = false
local locationMap = parentArgs['location']
if (locationMap and starts_with(locationMap, '#Q')) then
item = mw.wikibase.getEntity(locationMap:gsub("#", ""))
locationMap = nil
end
if (locationMap ~= nil and locationMap ~= '') or (useWikidata and item.claims['P242'] ~= nil and item.claims['P242'][1] ~= nil) then
if useWikidata and (locationMap == nil or locationMap == '') then
locationMap = mw.wikibase.renderSnak( item:getBestStatements('P242')[1].mainsnak )
end
table.insert(elements, '| colspan="2" style="text-align:center; padding:0" | [[File:' .. locationMap .. '|250px]]\n' )
else
missingInfo = true
end
item = mw.wikibase.getEntity( )
for _, params in pairs( conf ) do
if params[3] ~= 0 then
local val = parentArgs[params[1]]
if (val and starts_with(val, '#Q')) then
item = mw.wikibase.getEntity(val:gsub("#", ""))
val = nil
end
if val == '' or val == nil then
if useWikidata and #item:getBestStatements('P' .. params[3]) > 0 then
val = params[4]( item, 'P' .. params[3], frame)
if val ~= nil then
table.insert( elements, renderRow(params[2], val) )
else
missingInfo = true
end
else
missingInfo = true
end
else
table.insert(elements, renderRow(params[2], val) )
end
end
item = mw.wikibase.getEntity( )
end
local editRow = ''
if item ~= nil then
editRow = '|-\n| colspan="2" class="info footer" |[[:d:'.. item.id .. '|မႄးထတ်းတီႈ ဝီႇၶီႇတေႇတႃႇ]]\n'
end
if #elements > 0 then
if missingInfo == true and mw.title.getCurrentTitle().namespace == 0 then
table.insert(elements, '[[Category:Quickbar with missing information]]\n')
end
return frame:extensionTag {name = 'templatestyles', args = {src = 'Quickbar/styles.css'}} .. '<div id="quickbar" class="wv-quickbar floatright">\n{| cellpadding="0" cellspacing="0"\n|-\n' ..
table.concat(elements) ..
'\n'.. editRow.. '|}</div>'
else
if mw.title.getCurrentTitle().namespace == 0 then
return '[[Category:Quickbar with missing information]]\n'
end
return ''
end
end
return p
r9tj22yz91gqu9z5qfb80hyiyz3wdxt