ק
rv
ק (מיון לפי מבחין מפרמטר) |
ק (rv) צייכן: צוריקגעשטעלט |
||
| שורה 12: | שורה 12: | ||
value, error = wikidataModule.getValueOfClaim(claim, AS_OF_PROPERTY, nil) | value, error = wikidataModule.getValueOfClaim(claim, AS_OF_PROPERTY, nil) | ||
if value then | if value then | ||
return ' ( | return ' (אין '..value ..')' | ||
end | end | ||
return '' | return '' | ||
| שורה 33: | שורה 33: | ||
if unitSymbol then | if unitSymbol then | ||
local writingSystemElementId = 'Q33513' -- hebrew writing system | local writingSystemElementId = 'Q33513' -- hebrew writing system | ||
local langElementId = ' | local langElementId = 'Q8641' -- yiddish | ||
local labelFilter = 'P5061[language:'..langCode..'], P5061[P282:' .. writingSystemElementId .. ', P407:' .. langElementId .. ']' | local labelFilter = 'P5061[language:'..langCode..'], P5061[P282:' .. writingSystemElementId .. ', P407:' .. langElementId .. ']' | ||
local WDS = require( 'Module:WikidataSelectors' ) | local WDS = require( 'Module:WikidataSelectors' ) | ||
| שורה 66: | שורה 66: | ||
local function missingLabelCategory(propertyName) | local function missingLabelCategory(propertyName) | ||
return '[[ | return '[[קאטעגאריע:וויקידאטן עטיקעט פעלט אין יידיש: ' .. (mw.wikibase.label( propertyName) or propertyName) .. ']][[קאטעגאריע:וויקידאטן עטיקעט פעלט אין יידיש]]' | ||
end | end | ||
| שורה 104: | שורה 104: | ||
local formattedValue | local formattedValue | ||
local missingTranslation = false | local missingTranslation = false | ||
if genderAwareEntity then | if genderAwareEntity then | ||
local gender = mw.wikibase.getBestStatements(genderAwareEntity, 'P21') -- P21 - gender | local gender = mw.wikibase.getBestStatements(genderAwareEntity, 'P21') -- P21 - gender | ||
| שורה 112: | שורה 111: | ||
gender[1].mainsnak.datavalue and | gender[1].mainsnak.datavalue and | ||
gender[1].mainsnak.datavalue.value and | gender[1].mainsnak.datavalue.value and | ||
(gender[1].mainsnak.datavalue.value["numeric-id"] == 6581072 | (gender[1].mainsnak.datavalue.value["numeric-id"] == 6581072 or gender[1].mainsnak.datavalue.value["numeric-id"] == 1052281) | ||
if isFemale then | if isFemale then | ||
| שורה 129: | שורה 126: | ||
end | end | ||
local isLocalLabel = langLabel==' | local isLocalLabel = langLabel=='yi' | ||
-- fallback if there is target but no label, use target as label | -- fallback if there is target but no label, use target as label | ||
if linkTarget and not isLocalLabel then | if linkTarget and not isLocalLabel then | ||
| שורה 135: | שורה 132: | ||
isLocalLabel = true | isLocalLabel = true | ||
end | end | ||
if localLabel and isLocalLabel then | if localLabel and isLocalLabel then | ||
if linkTarget and localLabel and linkTarget == localLabel then | if linkTarget and localLabel and linkTarget == localLabel then | ||
| שורה 148: | שורה 146: | ||
missingTranslation = true | missingTranslation = true | ||
-- in that case we would unfourtanly can show only the entity id which is meaningless for users | -- in that case we would unfourtanly can show only the entity id which is meaningless for users | ||
formattedValue = mw.ustring.format( "[[:d:%s|%s]]", entityId, entityId ) | |||
end | end | ||
return formattedValue, missingTranslation | return formattedValue, missingTranslation | ||
end | end | ||
| שורה 165: | שורה 158: | ||
local warnings = '' | local warnings = '' | ||
for _, optionalQualifier in pairs( qualifiers ) do | for _, optionalQualifier in pairs( qualifiers ) do | ||
if optionalQualifier 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=='yi') | |||
end | end | ||
if | end | ||
local formattedValue = '<span title="'.. mw.wikibase.label( | if optionalQualifierVal then | ||
if isQualLocalLabel then | |||
local formattedValue = '<span title="'.. mw.wikibase.label(optionalQualifier)..'" class="propertylink-wikidata-qualifier">'..mw.wikibase.formatValues(property.qualifiers[optionalQualifier]) ..'</span>' | |||
table.insert(formmatedQualifiers, formattedValue) | table.insert(formmatedQualifiers, formattedValue) | ||
else | |||
warnings = missingLabelCategory(optionalQualifier) | |||
end | end | ||
end | end | ||
end | end | ||
| שורה 233: | שורה 223: | ||
function property( frame ) | function property( frame ) | ||
return getProperty(string.upper(frame.args[1]), (frame.args[2] and string.len(frame.args[2])>0) or false, true, frame.args['entity']) | |||
return getProperty(string.upper(frame.args[1]), (frame.args[2] and string.len(frame.args[2])>0) or false, true, frame.args['entity | |||
end | end | ||
| שורה 293: | שורה 279: | ||
options['img-width'] = options['img-width'] or '250px' | options['img-width'] = options['img-width'] or '250px' | ||
options['source'] = options['source'] or false | options['source'] = options['source'] or false | ||
local propertyVals = mw.wikibase.getBestStatements(entityId, propertyName) | local propertyVals = mw.wikibase.getBestStatements(entityId, propertyName) | ||
if (not propertyVals) or (#propertyVals==0) then return end --no such property for this item | if (not propertyVals) or (#propertyVals==0) then return end --no such property for this item | ||
local resTable = {} | local resTable = {} | ||
local missingTranslation | local missingTranslation = false | ||
for i, property in ipairs(propertyVals) do | for i, property in ipairs(propertyVals) do | ||
local propValue = property.mainsnak and property.mainsnak.datavalue | local propValue = property.mainsnak and property.mainsnak.datavalue | ||
| שורה 370: | שורה 297: | ||
local isImage = (property.mainsnak.datatype == 'commonsMedia') | local isImage = (property.mainsnak.datatype == 'commonsMedia') | ||
if propValue['type'] == 'wikibase-entityid' then | if propValue['type'] == 'wikibase-entityid' then | ||
local formattedValue, valueMissingTranslation | local formattedValue, valueMissingTranslation = formatEntity("Q" .. propValue.value['numeric-id'], options['entity-gender-aware'] and entityId) | ||
if not valueMissingTranslation | if not valueMissingTranslation then | ||
if formattedValue then | if formattedValue then | ||
formattedValue = formattedValue .. formatOptionalQualifiers(property, options['qualifiers'], options['qualifiers-sep']) | formattedValue = formattedValue .. formatOptionalQualifiers(property, options['qualifiers'], options['qualifiers-sep']) | ||
end | end | ||
table.insert(resTable, formattedValue) | table.insert(resTable, formattedValue) | ||
else | else | ||
missingTranslation = | missingTranslation = true | ||
end | end | ||
elseif propValue['type'] == 'string' then | elseif propValue['type'] == 'string' then | ||
| שורה 396: | שורה 319: | ||
-- for monolingualtext print the language as title | -- for monolingualtext print the language as title | ||
local formattedValue = mw.ustring.format('<span lang="%s" title="%s">%s</span>', propValue.value.language, | local formattedValue = mw.ustring.format('<span lang="%s" title="%s">%s</span>', propValue.value.language, | ||
mw.language.fetchLanguageName( propValue.value.language , ' | mw.language.fetchLanguageName( propValue.value.language , 'yi'), propValue.value.text) | ||
table.insert(resTable, formattedValue) | table.insert(resTable, formattedValue) | ||
elseif propValue['type'] == 'quantity' then | elseif propValue['type'] == 'quantity' then | ||
| שורה 409: | שורה 332: | ||
elseif propValue['type'] == 'time' then | elseif propValue['type'] == 'time' then | ||
local timeValue = Date.newFromWikidataValue( property.mainsnak.datavalue.value ):toHebrewString() | local timeValue = Date.newFromWikidataValue( property.mainsnak.datavalue.value ):toHebrewString() | ||
--local timeValue = mw.wikibase.renderSnak( property.mainsnak ) | --local timeValue = mw.wikibase.renderSnak( property.mainsnak ) | ||
timeValue = mw.ustring.gsub(timeValue, '^(%d+ %a+) (%d+)$', '[[%1]] [[%2]]') | timeValue = mw.ustring.gsub(timeValue, '^(%d+ %a+) (%d+)$', '[[%1]] [[%2]]') | ||
| שורה 438: | שורה 348: | ||
end | end | ||
end | end | ||
if globe then | if globe then | ||
formattedValue = frame:expandTemplate{ title = 'Coord', args = { propValue.value.latitude, propValue.value.longitude, globe, display = options['coord-display'] or 'inline' } } | |||
formattedValue = frame:expandTemplate{ title = 'Coord', args = { | |||
else | else | ||
formattedValue = frame:expandTemplate{ title = 'Coord', args = { propValue.value.latitude, propValue.value.longitude, display = options['coord-display'] or 'inline' } } | formattedValue = frame:expandTemplate{ title = 'Coord', args = { propValue.value.latitude, propValue.value.longitude, display = options['coord-display'] or 'inline' } } | ||
| שורה 454: | שורה 363: | ||
end | end | ||
if missingTranslation | if missingTranslation then return missingLabelCategory( propertyName ) end | ||
-- bidi isolation - properly show mix or RTL and LTR statements | -- bidi isolation - properly show mix or RTL and LTR statements | ||
| שורה 472: | שורה 375: | ||
if needIsolation then resTable = isolateValues end | if needIsolation then resTable = isolateValues end | ||
end | end | ||
-- special case * - listify | -- special case * - listify | ||
if options['seperator'] == '*' and #resTable>1 then | if options['seperator'] == '*' and #resTable>1 then | ||
return '*' .. table.concat( resTable, '\n*' ) | |||
else | else | ||
return table.concat( resTable, options['seperator'] ) | |||
end | end | ||
end | end | ||
| שורה 496: | שורה 394: | ||
if propValue['type'] == 'wikibase-entityid' then | if propValue['type'] == 'wikibase-entityid' then | ||
local label, lang = mw.wikibase.label( propValue.value['id'] ) | local label, lang = mw.wikibase.label( "Q" ..propValue.value['numeric-id'] ) | ||
return label | return label | ||
elseif propValue['type'] == 'string' then | elseif propValue['type'] == 'string' then | ||
| שורה 508: | שורה 406: | ||
end | end | ||
function getImageLink( propName, width, align, description, border) | |||
local entityId = mw.wikibase.getEntityIdForCurrentPage() | |||
function getImageLink( propName, width, align, description, border | |||
if not entityId then return end --the entity doesnt exist or have no claims | if not entityId then return end --the entity doesnt exist or have no claims | ||
local property = mw.wikibase.getBestStatements(entityId, propName or 'P18') | local property = mw.wikibase.getBestStatements(entityId, propName or 'P18') | ||
| שורה 555: | שורה 435: | ||
return 1 | return 1 | ||
end | end | ||
return { | return { | ||
| שורה 590: | שורה 441: | ||
label = label, | label = label, | ||
['תווית'] = label, | ['תווית'] = label, | ||
formatEntity = formatEntity, | formatEntity = formatEntity, | ||
property = property, | property = property, | ||
propertyWithGender = propertyWithGender, | propertyWithGender = propertyWithGender, | ||
['מאפיין'] = property, | ['מאפיין'] = property, | ||
['אייגנשאפט'] = property, | |||
getProperty = getProperty, | getProperty = getProperty, | ||
getPropertyByOptions = getPropertyByOptions, | getPropertyByOptions = getPropertyByOptions, | ||
getPropertyQualifier = getPropertyQualifier, | getPropertyQualifier = getPropertyQualifier, | ||
getImageLink = getImageLink, | getImageLink = getImageLink, | ||
getLabel = getLabel, | getLabel = getLabel, | ||
hasEntry = hasEntry, | hasEntry = hasEntry, | ||
['יש פריט'] = hasEntry | ['יש פריט'] = hasEntry | ||
} | } | ||