-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
pat-datetime-picker relies on browser language configuration instead of Plone configuration #1328
Comments
The field formatter is set here https://github.com/plone/plone.app.z3cform/blob/master/plone/app/z3cform/widgets/datetime.py#L104 ... you should be able to adapt this with |
but here the field formatter isn't in action right? The above screenshots show the same page in the same language, in two different browsers rendered differently. I would render the datepicker JS anyway, without letting the browser render it by itself except there is a way we can tell the browser "render the datepicker using XX language" and pass the current content's language |
Meanwhile I also think it would be best to switch back again to JS date-time picker, because you have better customization/internationalization options there. This means The browser native implementation is different from Browser/OS/Language in many ways without a possibility to style or translate it. /cc @thet |
Thanks @petschki I have been checking answers in Mozilla's Bugzilla and StackOverflow and all of them say there is no way to tell the browser how to render the calendar, according to the standards browsers should follow user preferences, which they take from the browser preferences. |
Just looked a bit more into
project_start = plone.schema.Date(
title=_("Project start"),
required=False,
)
plone.autoform.directives.widget(
"project_start",
plone.app.z3cform.widgets.datetime.DateFieldWidget,
pattern_options={
"behavior": "styled",
"output-format": "DD.MM.YYYY", # forced german format
}
)
|
Thanks. This will be Ok for custom fields, but what about existing datetime pickers in events, effective/expiration dates, etc? |
It should be possible to fix this pattern within the scope of a sprint. The date picker would be the same as the Regarding the language: We should add a language option which falls back to the |
@erral we were discussing this issue yesterday and came to the conclusion that we want to stay with the native date picker. Moving to a JS picker would destroy the user experience on mobile devices where the native date pickers are way better than anything else and are an expected part of the user experience. Not having a Basque translation in Chrome is more of a browser problem. Also the rest of the browser UI is in another language than Basque, so there must be some way for the user to understand the browser UI translations. However, there is another plan which might be a fit for you:
@erral Would you be able to contribute here? I'm currently on other topics. |
I would definitely look at this. Thanks for sharing. Anyway I think that sticking with the native datepicker is a wrong choice, looking from a point of view of a multilingual content editor. I edit content in a site in 3 languages, and in all cases the datepicker will be shown in my browser language (which I think is wrong) instead of in the content language. Adding Basque support for Chrome is another story, I think is more of content-editing stuff. Anyway, I will look at your suggestion and go through it. |
@erral If you need any help, let me know! |
We have found a polyfill that includes locales support for the https://github.com/KreutzerCode/configurable-date-input-polyfill/ |
You could give this polyfill a try in an addon which overrides the default |
I don't know if I should open this here or in Patternslib...
The pat-datetime-picker pattern used in Plone 6 relies on browser interface language to render itself, producing different output in at least Firefox and Chrome.
This is Firefox configured to have the interface in basque:
This is Chrome configured to have the interface in english (I can't set basque as interface language)
As you can see, not only the date picker shows in English, but the datetime format of the input box is also formatted in English.
It looks like the pat-datetime-picker degrades to HTML5 date picker which relies on the browser language.
I would say this is a bug. The date picker should be rendered not in the browser language but in the content language. I don't know if this can be set in the HTML5 standard date-picker (I don't see how here, so perhaps we should render the JS date-picker anyway?
cc: @libargutxi
The text was updated successfully, but these errors were encountered: