can Hugo support multilingual with multi currency and multi country without the need of duplication
use case:
Tour site with tours in multiple countries
2 Countries:
Spain
France
3 Currencies:
US dollar $
European euro €
British pound
3 Languages:
English
Spanish
French
From what I understand is to generate:
en
en-US
en-UK
fr
fr-FR
es
es-ES
I need to create 6 directories (even if there are basically just 3 languages). The only difference between en-US and en-UK will be the default currency.
can I go by using Hugo just create 3 directories and let the languages
en-US
en-UK
share the language directory en/
other then the currency each language will have separate .tld as follow:
git clone --single-branch -b hugo-forum-topic-36716 https://github.com/jmooring/hugo-testing hugo-forum-topic-36716
cd hugo-forum-topic-36716
hugo server
Notes:
Hugo localizes but does not convert currency amounts.
To take advantage of Hugo’s localization capabilities, the language tag must match one of the locale keys on this list . For example, use en_us instead of en-us. See this issue.
I’m not sure it’s a default case but putting the Currency format in the config for the language should work and then just call it with the language.currency or whatever label you apply whenever you use currency.
I didn’t knew this, so I simply used the Hugo {{ range .Translations }} and then was trying to add currency symbol and calculation in layouts for each currency.
Once again your response is at another level respect
Hugo localizes but does not convert currency amounts.
no worries, using this suggestion of @tracykev I simply add rates for each currency in config.yaml file using US$ as base rate value of 1 and provided the rate difference euro : 0.88 and did the calculation in the layouts it works fine
use en_us instead of en-us
thanks for correcting this I was reading an older blog without realising it might have changed in a Hugo version
thanks for sharing the local keys list its really impressive with months days of week etc. is this what Hugo use by default or can Hugo make benefit of this and automatically apply the months/days format from the file
In the example that I posted, the home page of each of the four language sites has an example of date and currency localization. Compare the home pages of the four sites to see how the same value is localized.
doesnt make much sense as its same language. Does Hugo have the possibility to keep language as 2 separate values “language” and “the tag after the language-” like en-GB
so I can have 2 selectors instead of a single language selector dropdown
First, as I noted previously, en_uk in an invalid locale. Use en_gb instead.
Second, I’m not sure why you need en, en_us, and en_gb. It seems like en_us and en_gb would be sufficient.
Third, by splitting language and locale into two controls, it seems like you are generating additional work for the visitor. I’d rather pick one and be done with it.
Finally, yes you can split the control. Just combine the values in the onChange event.