Bungie-net / api

Resources for the Bungie.net API
Other
1.22k stars 92 forks source link

Api response in french #1139

Open Arkayus opened 4 years ago

Arkayus commented 4 years ago

Is it possible to get vendor inventory in french for exemple ?

joshhunt commented 4 years ago

When you request the manifest (Destiny2.GetDestinyManifest), it will contain the URLs for the definitions in a variety of languages, including French. This will give you, for example, item and vendor names in French.

The live API (that is, API calls that tell you what the vendors are selling right now, like Destiny2.GetVendors) does not contain any localised information - it is independent of any language. It will return hashes, which are IDs you use to look up their entries in the definitions.

vthornheart-bng commented 4 years ago

Aye, for better or worse what @joshhunt describes is the pattern we ended up with. An expensive upfront cost of grabbing localized content and static data in exchange for much smaller live data responses that we don't have to cache per language. Give that a shot and let me know how that goes for you Arkayus!

Wobow commented 4 years ago

Loading the all manifest is not the only option you have though. Depending on your implementation and use case, it's good to know you can always add ?lc={locale code} to any endpoint.

In the Destiny2.GetDestinyEntityDefinition endpoint for example: if you request https://www.bungie.net/Platform/Destiny2/Manifest/{entityType}/{hashIdentifier}?lc=fr you will have the results in french. For most endpoints you will have hashes to look up. So you can either load the definitions on the fly with this, or load all the manifest and then look into it. Your choice.

I'm not saying it's the best solution, but it's a thing to keep in mind so you have all the tools at your disposal to take the best decision for you project !