Skip to content

Commit

Permalink
Add option to not set keyword synonyms
Browse files Browse the repository at this point in the history
  • Loading branch information
rcloran committed May 12, 2023
1 parent 7d146cc commit 7db6eb6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
24 changes: 24 additions & 0 deletions lr-inaturalist-publish.lrdevplugin/ExportServiceProvider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local exportServiceProvider = {
{ key = "login", default = "" },
{ key = "syncKeywords", default = true },
{ key = "syncKeywordsCommon", default = true },
{ key = "syncKeywordsSynonym", default = true },
{ key = "syncKeywordsIncludeOnExport", default = true },
{ key = "syncKeywordsRoot", default = -1 },
{ key = "syncOnPublish", default = true },
Expand Down Expand Up @@ -233,6 +234,29 @@ function exportServiceProvider.sectionsForTopOfDialog(f, propertyTable)
enabled = bind("syncKeywords"),
}),
}),
f:row({
spacing = f:control_spacing(),
f:static_text({
title = bind({
keys = { "syncKeywordsCommon" },
transform = function()
local r = "Set common name as a keyword synonym"
if propertyTable.syncKeywordsCommon then
r = "Set scientific name as a keyword synonym"
end
r = r .. '\nKeyword synonyms are always exported (see "Help...")'
return r
end,
}),
alignment = "right",
width = LrView.share("inaturalistSyncLabel"),
enabled = bind("syncKeywords"),
}),
f:checkbox({
value = bind("syncKeywordsSynonym"),
enabled = bind("syncKeywords"),
}),
}),
f:row({
spacing = f:control_spacing(),
f:static_text({
Expand Down
7 changes: 5 additions & 2 deletions lr-inaturalist-publish.lrdevplugin/SyncObservations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ local function createKeyword(kw, cache, settings)
withWriteAccessDo("Create keyword " .. kw[#kw][1], function()
for _, part in pairs(kw) do
if not cache[part[1]] then
local tmp =
catalog:createKeyword(part[1], { part[2] }, settings.syncKeywordsIncludeOnExport, parent, true)
local syn = nil
if settings.syncKeywordsSynonym then
syn = { part[2] }
end
local tmp = catalog:createKeyword(part[1], syn, settings.syncKeywordsIncludeOnExport, parent, true)
cache[part[1]] = { tmp }
end
cache = cache[part[1]]
Expand Down

0 comments on commit 7db6eb6

Please sign in to comment.