-
Notifications
You must be signed in to change notification settings - Fork 1k
Make timezoneList translatable. #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Added english default translation * Added german translation * Usage: $('input.datetimepicker').datetimepicker({ showTimezone: true, timezoneList: [ {"value": "-1100", "label": "minusEleven"}, {"value": "-1000", "label": "minusTen"}, {"value": "-0900", "label": "minusNine"}, {"value": "-0800", "label": "minusEight"}, {"value": "-0700", "label": "minusSeven"}, {"value": "-0600", "label": "minusSix"}, {"value": "-0500", "label": "minusFive"}, {"value": "-0400", "label": "minusFour"}, {"value": "-0300", "label": "minusThree"}, {"value": "-0200", "label": "minusTwo"}, {"value": "-0100", "label": "minusOne"}, {"value": "+0000", "label": "plusMinusZero"}, {"value": "+0100", "label": "plusOne"}, {"value": "+0200", "label": "plusTwo"}, {"value": "+0300", "label": "plusThree"}, {"value": "+0400", "label": "plusFour"}, {"value": "+0500", "label": "plusFive"}, {"value": "+0600", "label": "plusSix"}, {"value": "+0700", "label": "plusSeven"}, {"value": "+0800", "label": "plusEight"}, {"value": "+0900", "label": "plusNine"}, {"value": "+1000", "label": "plusTen"}, {"value": "+1100", "label": "plusEleven"}, {"value": "+1200", "label": "plusTwelve"}, {"value": "+1300", "label": "plusThirteen"} ]
Hey apepper, I like where you're going with this, but I would suggest making a slight change. First I think we could leave the timezone list as is:
But instead of the extra key mapping we use the "-1100" as the key map to the regional timezone labels. This will be more compact and if the label doesn't exist just show the values. So our regional value will resemble:
|
sounds good. I'll try that and update this pullrequest once I'm done. |
Sorry, This currently already was implemented, the format was just a bit different and you can also include timezoneList in the regional file. The timezoneList can be either an array: [ '+0400', '+0500', ....] or an object:
However this does not allow for setting the timeformat option for displaying the label. The code in my example above would allow for displaying the timezone label pretty easily, just using timezoneLabels['+0000']. The current implementation would need to do a loop through all values to find the current one. Wouldn't be difficult, just inefficient.. |
See my new commit 5128f9b. |
I've been looking over the current implementation and am trying to decide if it needs changing. Currently (I had forgotten how it worked, it had been long ago when it was implemented) that you could already pass in labels, so I don't know that anything is gained by reworking it. Sorry if my previous comment was too late and you had already reworked it. The only other thing I can think of to tweak timezones is to allow adding a timeFormat option for the timezone labels. My stance on that at the moment is there have been no feature requests for this, and trying to parse an unknown string format may be highly unpredictable.. so for now I think we leave as is. Were you trying to solve a problem I am not catching on to? |
Ah, now I see. I didn't know, that you can also place the timezoneList with the different translations. I just tried it and it works like intended. Maybe the documentation could be extended to make it easier to find stuff like this. |
Added english default translation
Added german translation
Usage: