יחידה:LocationAndCountry: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
מאין תקציר עריכה |
||
| שורה 139: | שורה 139: | ||
return nil | return nil | ||
end | end | ||
end | |||
local function missingLabelCategory(propertyName) | |||
return '[[קטגוריה:ויקינתונים:ערכים_חסרי_תווית_בעברית: ' .. (mw.wikibase.label( propertyName) or propertyName) .. ']][[קטגוריה:ויקינתונים:ערכים_חסרי_תווית_בעברית]]' | |||
end | end | ||
| שורה 158: | שורה 162: | ||
local valueList = {} | local valueList = {} | ||
local valueCount = 0 | local valueCount = 0 | ||
local missingLabel = false | |||
if claims and 0 < #claims then | if claims and 0 < #claims then | ||
for claimIdx, actualClaim in pairs(claims) do | for claimIdx, actualClaim in pairs(claims) do | ||
| שורה 213: | שורה 218: | ||
locationEntitiesIds = TableTools.removeDuplicates(locationEntitiesIds) | locationEntitiesIds = TableTools.removeDuplicates(locationEntitiesIds) | ||
local locationNamesList = {} | local locationNamesList = {} | ||
for _,eachLocationId in ipairs(locationEntitiesIds) do | for _,eachLocationId in ipairs(locationEntitiesIds) do | ||
local missingEntityLabel = false | |||
if not locationNames[eachLocationId] then | if not locationNames[eachLocationId] then | ||
locationNames[eachLocationId] = PropertyLink.formatEntity(eachLocationId) | locationNames[eachLocationId], missingEntityLabel = PropertyLink.formatEntity(eachLocationId) | ||
missingLabel = missingLabel or missingEntityLabel | |||
--[[ Disabled feature from ro wiki: show the offical name/short name in that timestamp | --[[ Disabled feature from ro wiki: show the offical name/short name in that timestamp | ||
local correspindingShortNameClaim = findClaimForTimestamp(eachLocationId, 'P1813', ts) | local correspindingShortNameClaim = findClaimForTimestamp(eachLocationId, 'P1813', ts) | ||
| שורה 222: | שורה 231: | ||
else | else | ||
local correspondingOfficialNameClaim = findClaimForTimestamp(eachLocationId, 'P1448', ts) | local correspondingOfficialNameClaim = findClaimForTimestamp(eachLocationId, 'P1448', ts) | ||
if correspondingOfficialNameClaim then | if correspondingOfficialNameClaim then | ||
locationNames[eachLocationId] = correspondingOfficialNameClaim.mainsnak.datavalue.value.text | locationNames[eachLocationId] = correspondingOfficialNameClaim.mainsnak.datavalue.value.text | ||
| שורה 230: | שורה 237: | ||
]] | ]] | ||
end | end | ||
table.insert(locationNamesList, locationNames[eachLocationId]) | |||
if not missingEntityLabel then | |||
table.insert(locationNamesList, locationNames[eachLocationId]) | |||
end | |||
end | end | ||
if 0 < #locationNamesList then | if 0 < #locationNamesList then | ||
| שורה 247: | שורה 257: | ||
if separator == nil then separator = '; ' end | if separator == nil then separator = '; ' end | ||
if maxvalues > #valueList then maxvalues = #valueList end | if maxvalues > #valueList then maxvalues = #valueList end | ||
return table.concat(valueList, separator, 1, maxvalues) | if missingLabel then | ||
return table.concat(valueList, separator, 1, maxvalues) .. missingLabelCategory(param) | |||
else | |||
return table.concat(valueList, separator, 1, maxvalues) | |||
end | |||
end | end | ||