Skip to content

Commit

Permalink
Added language Label support in Wikidata QuickStatements (zotero#2943)
Browse files Browse the repository at this point in the history
  • Loading branch information
Futur3r authored Dec 9, 2022
1 parent a609b07 commit 463c281
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Wikidata QuickStatements.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"priority": 100,
"inRepository": true,
"translatorType": 2,
"lastUpdated": "2021-02-22 09:45:00"
"lastUpdated": "2022-12-08 23:00:00"
}


Expand Down Expand Up @@ -185,7 +185,6 @@ function zoteroItemToQuickStatements(item) {
if (typeMapping[itemType]) {
addStatement('P31', typeMapping[itemType]);
}
addStatement('Len', '"' + item.title + '"');

var description = itemType.replace(/([A-Z])/, function (match, firstLetter) {
return ' ' + firstLetter.toLowerCase();
Expand Down Expand Up @@ -260,11 +259,13 @@ function zoteroItemToQuickStatements(item) {

if (item.language && (item.language.toLowerCase() in languageMapping)) {
let lang = item.language.toLowerCase();
addStatement('L' + lang, '"' + item.title + '"');
addStatement('P1476', lang + ':"' + item.title + '"');
addStatement('P407', languageMapping[lang]);
}
else {
// otherwise use "und" for undetermined language
// otherwise use "und" for undetermined language and add the label in english by default
addStatement('Len', '"' + item.title + '"');
addStatement('P1476', 'und:"' + item.title + '"');
}

Expand Down

0 comments on commit 463c281

Please sign in to comment.