I’d like to get current user’s country, so I can show my plugin with the appropriate system language, and I tried several approaches:
HTML Geolocation API
Figma plugin’s origin is set to *, so I can’t use navigator.geolocation.getCurrentPosition() inside Figma plugin.
Geolocation by IP address
This works, but the downside is that, this is an asynchronous method, which can cause a fraction of a change when the React rendering the page with given language context.
Using a country to determine user’s language is a bad idea in the first place (and I don’t think there is an api for that). Imagine you are traveling to another country or simply using a VPN — you won’t be able to read anything. A much better way is to use the user’s locale. I think it should be available.