adamint / spotify-web-api-kotlin

Spotify Web API wrapper for Kotlin, Java, JS, and Native - Targets JVM, Android, JS (browser), Native (Desktop), and Apple tvOS/iOS. Includes a Spotify Web Playback SDK wrapper for Kotlin/JS, and a spotify-auth wrapper for Kotlin/Android.
https://adamint.github.io/spotify-web-api-kotlin-docs/
MIT License
194 stars 21 forks source link

Feat: Add locale parameter to search api #336

Closed ItWasEnder closed 5 months ago

ItWasEnder commented 5 months ago

This adds support to return items in their native translation (for supported fields only)

Example:

Without locale param URL: https://api.spotify.com/v1/search?q="ブレス・ユア・ブレス WADATAKEAKI"&type=track&limit=1

{
  "external_urls": {
    "spotify": "https://open.spotify.com/artist/6qayQS8CjcEBPMLdWAZEMK"
  },
  "href": "https://api.spotify.com/v1/artists/6qayQS8CjcEBPMLdWAZEMK",
  "id": "6qayQS8CjcEBPMLdWAZEMK",
  "name": "和田たけあき",
  "type": "artist",
  "uri": "spotify:artist:6qayQS8CjcEBPMLdWAZEMK"
}

With &locale=EN URL: https://api.spotify.com/v1/search?q="ブレス・ユア・ブレス WADATAKEAKI"&type=track&limit=1&locale=EN

{
  "external_urls": {
    "spotify": "https://open.spotify.com/artist/6qayQS8CjcEBPMLdWAZEMK"
  },
  "href": "https://api.spotify.com/v1/artists/6qayQS8CjcEBPMLdWAZEMK",
  "id": "6qayQS8CjcEBPMLdWAZEMK",
  "name": "WADATAKEAKI",
  "type": "artist",
  "uri": "spotify:artist:6qayQS8CjcEBPMLdWAZEMK"
}