Figma Support Forum

Does Figma provide api to get current user's geolocation information?

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:

  1. HTML Geolocation API
    Figma plugin’s origin is set to *, so I can’t use navigator.geolocation.getCurrentPosition() inside Figma plugin.

  2. 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.

So is there any solution for this ?

Thanks.

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.