-
Notifications
You must be signed in to change notification settings - Fork 22
Confirm approach for localisation and currency detection #1
Comments
I believe so. Check out the current implementation here, which is called by location-parser.js @TheoChevalier do you have anything useful to add here? (One gotcha: if you see a reference to
We currently rely on locale (as a pairing of language and region), and then read what currency we should use based on that, from locale-data.js. This approach seems to work well, so I can't imagine we'd want to change it.
Right now we can pass in query strings if we want to show specific amounts, but by default we pull from currencies.js for everything. (This file may be auto generated based on exchange rates; I can dig into that if you'd like). That being said, @WillatMozFdn may have specifics on the ideal spot for controlling these amounts (query params, campaign basis, etc.). My instinct is as long as we have as much flexibility as we do with query params, the approach isn't too important (though I know there's a certain amount of usefulness in being able to simply write a URL and know it will do the intended thing because of the query params). |
I just had a follow-up conversation with @WillatMozFdn regarding item three. The query string functionality, as it stands today, is necessary to replicate. (There's some additional params that would be nice, but I believe are outside the scope of this work, and the internal team can add things like that in the future). Two other that we identified would be useful, but not necessary:
|
I can confirm what Alan said, we are reading the user browser language prefs. To recap, we should be able to:
Yeah, works pretty much the way we want. There are just a few cases where there’s no default currency set (arabic for instance, but it’s not one of our major fundraising locales) or where we need to support multiple currencies for the same locale (e.g. French, where EUR is the default due to France/Belgium/Luxembourg being the main market, but we would ideally set CHF as default for French-speaking users in Switzerland, and CAD for French-speaking users in Québec) For those cases, we’re working around when we can by sending those people custom links with this query param
That file is maintained manually (mostly by me) and there are a few things to note:
|
Proposed logical flow that captures the various requirements discussed above: Language code
The user's language code once determined is used to determine translation and currency as defined below. Translation
Ability for user to change language is nice to have, but not required for this scope of work. CurrencyA language-code to currency mapping will be maintained somewhere (either in the database or in code - approach to be determined). The structure will be the same as this.
@alanmoo please let me know if there is anything that this logical flow doesn't capture. |
Language code and translation look good to me. Currency:
But I'd like @TheoChevalier to review and give this a final sign-off, as he's the expert. |
The last two comments look good to me, folks! |
Closing this tracking ticket as all the functionality has now been implemented. We'll pick up any edge cases/issues as new tickets. |
A few queries about localisation and currency defaults:
Is browser language preference used to determine the default language presented to the user?
How should the default currency be determined? Is this currently determined from location (e.g., using IP geolocation)?
How should we determine suggested donation amounts in each currency? Will these vary on a per-campaign basis?
The text was updated successfully, but these errors were encountered: