Skip to content

Conversation

nikrovir
Copy link

Currently, the result of obtaining a location only works with one language, despite the fact that it is possible to specify several languages in the configuration file. My changes allow to add several localizations for MaxMind (unfortunately I can’t implement it for other services, because I don’t have the keys) to the returned result, when specifying several languages: 'locales' => ['en', 'ru', 'pl']. The returned result will be:

[
  "ip" => "37.212.55.000"
  "iso_code" => "BY"
  "country" => "Belarus"
  "city" => "Vertelishki"
  "state" => "HR"
  "state_name" => "Grodnenskaya"
  "postal_code" => "231751"
  "lat" => 53.7041
  "lon" => 24.0152
  "timezone" => "Europe/Minsk"
  "continent" => "EU"
  "localizations" => [
    "en" => [
      "country" => "Belarus"
      "state_name" => "Grodnenskaya"
      "city" => "Vertelishki"
    ]
    "ru" => [
      "country" => "Беларусь"
      "state_name" => "Гродненская Область"
      "city" => "Вертелишки"
    ]
    "pl" => [
      "country" => null
      "state_name" => null
      "city" => null
    ]
  ]
  "currency" => "BYN"
  "default" => false
]

@alies-dev
Copy link
Contributor

alies-dev commented Jan 10, 2025

hey @nikrovir

Feel free to contribute to a fork that my company actively supports: https://github.com/InteractionDesignFoundation/laravel-geoip (adding some tests is very welcome)

PS: it's nice to see Vertelishki at the example, I was bicycling there a few years ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants