ChemPare Documentation - v0.0.0
    Preparing search index...

    Function getUserCountry

    • Gets the user's country from the browser's i18n API. This just splits the locale by the "-" character and returns the second part. This is a simple way to get the country code from the locale.

      Returns string

      The user's country as a CountryCode. (defaults to "US")

      // If the locale is "en-US"
      getUserCountry() // Returns "US" (United States)

      // If the locale is "en-GB"
      getUserCountry() // Returns "GB" (United Kingdom)

      // If the locale is "en-CA"
      getUserCountry() // Returns "CA" (Canada)