achievements-app / psn-api

A JavaScript library that lets you get trophy, user, and game data from the PlayStation Network.
https://psn-api.achievements.app
MIT License
263 stars 31 forks source link

HeaderOverride for lang #157

Closed c-peiron closed 6 months ago

c-peiron commented 6 months ago

I have seen in the documentation that it is possible to overwrite the header to send the language ISO, how can I do it?

wescopeland commented 6 months ago

@c-peiron For the sake of someone who stumbles upon this issue, did you manage to resolve this?

c-peiron commented 6 months ago

Sorry, I completely forgot to leave the solution here. For those who want to get the descriptions and titles of the translated trophies, you must also send the following:

const { trophies: titleTrophies } = await getTitleTrophies(
    authorization,
    gameId,
    "all",
    {
      npServiceName: trophyTitlePlatform !== "PS5" ? "trophy" : undefined,
      headerOverrides: {"Accept-Language":  'Es-es'}
    }
  );