vvo / tzdb

🕰 Simplified, grouped and always up to date list of time zones, with major cities
MIT License
784 stars 54 forks source link

provide locale to getTimeZones() #78

Open ofbeaton opened 4 years ago

ofbeaton commented 4 years ago

It would be nice to be able to provide the locale to getTimeZones() so that we can get the timezone strings in the language of the user. Right now it is hardcoded to English (and a specific one) which means this library cannot be used to populate tz pickers when displaying a UI in another language.

https://github.com/vvo/tzdb/blob/master/lib/getTimeZones.js

vvo commented 3 years ago

@ofbeaton Good idea on the paper, not sure how if it would work given the current code so your best bet is to try it by forking this repository and then let me know.

I am interested in this feature yes and hope you can find a way to implement it!

Let me know :)

ofbeaton commented 3 years ago

I mean a start might be to allow the user to pass in the locale in a backwards compatible way...

export default function getTimeZones(locale = "en-US") {

But obviously more work would need to be done... Sorry if this is too obvious.

vvo commented 3 years ago

@ofbeaton Yep that would work as a start, again I am up for the feature but I won't implement it myself as I do not need it at the moment. But you're welcome to try it and open a PR if you see it working well.

Thanks!

MohamedHegab commented 3 years ago

Any luck @ofbeaton as I need the same issue right now

sunny7899 commented 2 years ago

Any update on this bug? Are we getting the improvement in any release? I need this also.