-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Datepicker using Globalize 1.x #1341
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
<option value="en">English</option> | ||
<option value="es">Spanish (Español)</option> | ||
<option value="zh">Chinese Simplified (简体中国)</option> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted back some locales. It's important to have Chinese, Spanish and Arabic. Because, they are the three most spoken languages in the world after English.
Two questions:
- How to write Chinese Simplified in Chinese? I have translated that in Google Translate and got the above.
- Does anyone know how to convert UTF-8 into that numeric entities? Anyway, why using entities and not utf-8 as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never liked that we attempted to translate the language names. Anyone browsing our site has to have some level of English comprehension and I'm sure they can recognize their language written in English if they can read our docs and demo descriptions.
Need to fix:
OBS: the month name above is different, but the new one seems more popular. So, it seems fine to me. See https://translate.google.com/#en/ar/September |
cldr.main([ "dates/calendars/gregorian/days/format/short", weekdays[ day ] ]).length > 3 ? | ||
cldr.main([ "dates/calendars/gregorian/days/format/narrow", weekdays[ day ] ]) : | ||
cldr.main([ "dates/calendars/gregorian/days/format/short", weekdays[ day ] ]), | ||
fullname: cldr.main([ "dates/calendars/gregorian/days/format/wide", weekdays[ day ] ]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may favor using Globalize functions instead of accessing the data directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on if we plan to make Globalize optional for Calendar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems harder for Datepicker, because we use cldrjs anyway. But, yeap. It would be nice if we were able to make something here similar to Spinner.
About LTR vs. RTL, I'm looking at the master's implementation. It either inserts elements before or after depending on this value. It would be a much more elegant solution if we could use CSS instead to control this flow, adding a proper |
How is RTL handled in other widgets? |
@rxaviers Datepicker is the only widget with an RTL implementation, and you'll want to talk to @scottgonzalez about the how this should work. I don't remember the specifics, but I remember a conversation with him about problems with RTL in master. |
@tjvantoll @rxaviers There are some notes within the Datepicker wiki page (search for isRTL). |
RTL in master is just flat out wrong with changing DOM positions. Just let the browser do the right thing. |
Absolutely. That's the idea. For now, I'm only raising issues and fixing other things. |
- Fix "I never liked that we attempted to translate the language #1341 (comment)
}; | ||
}); | ||
|
||
return $.ui.calendarDate = _Date; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What name we should use to export _Date
? Should we place this object inside ui/calendar.js
, so we don't have to expose this class publicly? Note it's not used anywhere else besides calendar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of using this without including calendar, so I would prefer to have this as a standalone object.
Add calendar widget by copying and renaming datepicker widget files. Remove datepicker functionality, options and methods from Calendar. Remove calendar functionality, options and methods from Datepicker. Adjust tests due to split and changed specification. Remove duplicated demo files and fix some demos. Simplify calendar generation, use CSS instead of inline styles. Fix destroy method. Make use of uniqueId method. Fix focus highlighting when month is changed. Add version property. Add common unit tests. Fix input keyboard handling.
fa52580
to
4e65e51
Compare
- Fix "I never liked that we attempted to translate the language #1341 (comment)
Rebased on fnagel:calendar-value-pr2 |
🎉 🎉 |
This still has many commits from the other PR, does this need a rebase to get rid of them? |
As for RTL: Scott is putting together a meeting to discuss a UI-wide solution. @rxaviers should be there as well and provide some input from the CLDR perspective (what RTL data is provided by CLDR?). Since that might still take a while, I suggest ignoring RTL here and addressing that later. |
@jzaefferer Yes, this will need another rebase as we chaged a bunch of older commits in the merged branch. |
e21a56d
to
2ea46ae
Compare
- Make unit tests work
@rxaviers Some questions regarding this branch / the implementation of Globalize:
|
- Fix merge conflict in value method - Fix common unit tests - Fix calendar localization tests - Fix rebase regression: labels update on refresh - Add new pass through options - lint fixes
- Make all demos work - Fix calendar localization demo - Fix merge errors
My current working branch: https://github.com/fnagel/jquery-ui/tree/datepicker-globalize Not sure if I should force push this PR or open a new one with reference and copied description. Opinions? @rxaviers @scottgonzalez @jzaefferer |
A force push seems fine for this one. |
What do you mean? |
I need a little more details. Anyway a good getting started is Globalize examples. https://github.com/jquery/globalize/tree/master/examples |
About passing i18n options to datepicker (e.g., Datepicker shouldn't be tight coupled with Globalize. Instead, it should expect formatters and parsers (functions needed for formatting and parsering the calendar and input values) to be passed from user land. Datepicker could use Globalize to fill in the default ones (i.e., for Having Datepicker loosely coupled with Globalize the way I described may sound more work now. But, it will dramatically improve its maintenance over time + it will help developers to integrate datepicker into their own i18n workflow easily. |
Feel free to force push to it assuming no work here is lost. :) |
I don't recall coming to that conclusion. That's the approach we agreed on for spinner, but I have always expected datepicker to have a hard dependency on Globalize. |
Well remembered @scottgonzalez. Obviously, having datepicker to have a hard dependency on Globalize is up to you. I also remember that you wanted datepicker to be distributed working for |
@fnagel related code:
Did I answer your question? Please, just let me know on any problem. Also, follow a code that may help you to play with Globalize: https://gist.github.com/rxaviers/1da4a40b13d2a6b03316 |
- Fix wrong calculation of weekdays
Thank you for rewriting Datepicker with the widget factory and based on CLDR.
|
Afaik yes.
There is a new option buttons like in dialog -- you will need to set the text strings yourself. See https://github.com/jquery/jquery-ui/blob/datepicker/demos/calendar/buttonbar.html Make sure to take a look at the wiki page: http://wiki.jqueryui.com/w/page/12137778/Datepicker |
I can't answer for the widget. But, it will depend on Globalize, whose support for other calendars need globalizejs/globalize#320 to be implemented. Help appreciated.
It's is in CLDR (in dateFields.json). |
Thanks. I've been working on an alternative-calendar-system datepicker widget for the past few years ( https://github.com/dwachss/flexcal ) and I have a good handle on manipulating them. I'll see if I have time to work on Globalize. |
Thanks @dwachss. Looking forward to it. |
a8d5e80
to
28bc45c
Compare
- Fix "I never liked that we attempted to translate the language #1341 (comment)
Can this branch In the description, there are two remaining items. Are they been tracked somewhere else? |
I closed this by accident. It's not merged to datepicker branch yet. datepicker-globalize-1.x is still up to date with my latest changes! |
Gotcha. Thanks |
More info in the UI dev meeting later today. |
This PR has been merged to datepicker branch. Remaining issue is RTL LTR support. @scottgonzalez Datepicker branch is now up to date and waiting for your merging magic :-D |
I finished merging master into datepicker this morning. |
Looks good! Added a new PR based on this: #1590 |
💥 WIP...
The goal is to have Datepicker working with Globalize 1.x.
Depends on
fnagel:calendar-value-pr3
;Todo
external/date.js
intoui/
(see Datepicker and Calendar: WIP #1260 (comment));cldr.main("layout/orientation/characterOrder")
, values areleft-to-right
orright-to-left
);