Currently in lib, we are using the asset descriptions from Coingecko API and getting only the en description from it.
Similarly, our overriden descriptions are only in English.
We should make it so that descriptions are dynamic according to the user language.
Since we are calling asset-service's description, lib would be the best place to handle it and we could make this method accept a locale parameter to pick the right translation from Coingecko, or fallback to English if it isn't available for that language (empty string). See the Ethereum Coingecko API call.
For the overriden description, there are two ways to implement this:
Keep the naive descriptions.json implementation and index translations by locale: {[assetId: AssetId]: {[locale: string]: string} vs. {[assetId: AssetId]: string} currently
Make the overriden descriptions dynamic using a similar i18n logic as we have in web, and split them by language. This way, we could call polyglot.t() to get the description for the specific language, or fallback to English as we do in web currently
A web PR should also be made to bump the @shapeshiftoss/asset-service dependency and consume the updated description(assetId, locale) signature.
The Coingecko description matching the user locale is returned from asset-service's description, or English as a fallback if unavailable
Overriden descriptions are implemented with internationalization and the overriden description matching the user local is returned, or English as a fallback
@shapeshift/operations Reserved for @sebfk
Overview
Currently in lib, we are using the asset descriptions from Coingecko API and getting only the
en
description from it. Similarly, our overriden descriptions are only in English.We should make it so that descriptions are dynamic according to the user language.
Since we are calling
asset-service
'sdescription
, lib would be the best place to handle it and we could make this method accept alocale
parameter to pick the right translation from Coingecko, or fallback to English if it isn't available for that language (empty string). See the Ethereum Coingecko API call.For the overriden description, there are two ways to implement this:
descriptions.json
implementation and index translations by locale:{[assetId: AssetId]: {[locale: string]: string}
vs.{[assetId: AssetId]: string}
currentlypolyglot.t()
to get the description for the specific language, or fallback to English as we do in web currentlyA web PR should also be made to bump the
@shapeshiftoss/asset-service
dependency and consume the updateddescription(assetId, locale)
signature.References and additional details
asset-service's
description
descriptions.json
for the overriden descriptionsPolyglot.js
(node-polyglot in npm) web translations logicAcceptance Criteria
description
, or English as a fallback if unavailableNeed By Date
No response
Screenshots/Mockups
No response
Estimated effort
3 hours