יחידה:PropertyLink: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
מאין תקציר עריכה |
||
| שורה 149: | שורה 149: | ||
end | end | ||
function formatOptionalQualifier(property, optionalQualifier) | |||
if optionalQualifier and property.qualifiers and property.qualifiers[optionalQualifier] then | |||
local optionalQualifierVal = mw.wikibase.formatValues(property.qualifiers[optionalQualifier]) | |||
local isQualLocalLabel = true | |||
if optionalQualifierVal and property.qualifiers[optionalQualifier][1] and property.qualifiers[optionalQualifier][1]['datatype']=='wikibase-item' then | |||
for i, optionalQValues in ipairs(property.qualifiers[optionalQualifier]) do | |||
local qualLabel, qualLang = mw.wikibase.getLabelWithLang( optionalQValues['datavalue']['value']['id'] ) | |||
isQualLocalLabel = isQualLocalLabel and (qualLang=='he') | |||
end | |||
end | |||
if optionalQualifierVal then | |||
if isQualLocalLabel then | |||
return ' (<span style="font-size:0.9em;" title="'.. mw.wikibase.label(optionalQualifier)..'">'..mw.wikibase.formatValues(property.qualifiers[optionalQualifier]) ..'</span>)' | |||
else | |||
return missingLabelCategory(optionalQualifier) | |||
end | |||
end | |||
end | |||
return '' | |||
end | |||
--[[ | --[[ | ||
| שורה 200: | שורה 220: | ||
if propValue['type'] == 'wikibase-entityid' then | if propValue['type'] == 'wikibase-entityid' then | ||
local formattedValue, valueMissingTranslation = formatEntity("Q" .. propValue.value['numeric-id'], genderAware) | local formattedValue, valueMissingTranslation = formatEntity("Q" .. propValue.value['numeric-id'], genderAware) | ||
if not valueMissingTranslation then | if not valueMissingTranslation then | ||
if formattedValue and optionalQualifier then | |||
formattedValue = formattedValue .. formatOptionalQualifier(property, optionalQualifier) | |||
end | |||
table.insert(resTable, formattedValue) | table.insert(resTable, formattedValue) | ||
else | else | ||
| שורה 232: | שורה 237: | ||
table.insert(resTable, propValue.value.text) | table.insert(resTable, propValue.value.text) | ||
elseif propValue['type'] == 'quantity' then | elseif propValue['type'] == 'quantity' then | ||
table.insert(resTable, | local formattedValue = formatQuantity(property) | ||
if formattedValue and optionalQualifier then | |||
formattedValue = formattedValue .. formatOptionalQualifier(property, optionalQualifier) | |||
end | |||
table.insert(resTable, formattedValue) | |||
elseif propValue['type'] == 'time' then | elseif propValue['type'] == 'time' then | ||
local timeValue = mw.wikibase.renderSnak( property.mainsnak ) | local timeValue = mw.wikibase.renderSnak( property.mainsnak ) | ||