Skip to content

Commit

Permalink
Use preferred common name instead of English
Browse files Browse the repository at this point in the history
I initially chose English-centric because I was seeing inconsistent
results from the API. But now I'm not sure if that was because I was
testing with an unauthenticated request -- a quick test now shows that
changing my language on the site changes an authenticated request's
response language.

Let's give this a go.
  • Loading branch information
rcloran committed Apr 29, 2023
1 parent 1649f77 commit 7055f3f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lr-inaturalist-publish.lrdevplugin/SyncObservations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ local INaturalistMetadata = require("INaturalistMetadata")
local SyncObservations = {}

local function commonName(taxon)
-- TODO: Find proper translations for names. For now, be English-centric
-- because preferred_common_name seems to be inconsistent.
return taxon.english_common_name or taxon.preferred_common_name or taxon.name
-- preferred_common_name seems to have some caching issues. There are many
-- reports in the forums etc of users sporadically having names in Spanish,
-- or similar bugs, and I've seen API responses with it in unexpected
-- languages. BUT, I'm not sure if what I've seen was with authenticated
-- requests or not. Also, let's not build complicated workarounds here for
-- iNaturalist infrastructure issues.
return taxon.preferred_common_name or taxon.english_common_name or taxon.name
end

local function observationCommonName(obs)
Expand Down

0 comments on commit 7055f3f

Please sign in to comment.