Skip to content

There is no locale called en-EG but what i want is to have english running but the currency be EGP instead of ج.م. #226

Answered by kipcole9
pshoukry asked this question in Q&A
Discussion options

You must be logged in to vote

Peter, a language tag can convey quite a lot of information that isn't obvious at first. It is documented in the BCP47 'U' extension. Here's an example of using the en locale but with the Egyptian pound as the default currency and overriding the region to be EG.

# English but preferring Egyptian Pound, Egypt as the region and Egypt/Cairo as the timezone
iex> {:ok, locale} = Cldr.validate_locale("en-u-cu-egp-rg-egzzzz-tz-egcai")
{:ok, #Cldr.LanguageTag<en-u-cu-egp-rg-egzzzz-tz-egcai [validated]>}

iex> Cldr.Currency.currency_from_locale(locale)
:EGP

iex> Cldr.Locale.territory_from_locale(locale)
:EG

iex> Cldr.Locale.timezone_from_locale(locale)
"Africa/Cairo"

That said, I'm not sure wha…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pshoukry
Comment options

Answer selected by pshoukry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants