implement datepicker localisation in jquery_ui 2.x, compare with jquery_ui_datepicker 1.x that has localisation

Created on 3 February 2023, almost 2 years ago
Updated 7 May 2024, 6 months ago

Problem/Motivation

Summary

This functionality used to exist in jquery_ui 1.x via jquery_ui_datepicker 1.x.

This issue was raised in order to bring back this functionality into jquery_ui 2.x.

The jquery_ui_datepicker module used to have translations via the drupal ui, please see merge request 10 that restores this functionality.

Current status

  1. Merge request 10 restores the expected functionality.
  2. Merge request 10 restores the expected functionality.
  3. Merge request 10 restores the expected functionality.

Thank you to bnjmnm for restoring this functionality.

@Gรกbor Hojtsy ,

This is the shortenned summary of the situation.

Here is what we expect:

Here is what jquery_ui module gives us instead:

So in addition to having no translation at all is that the default jquery_ui solution (even if it was implemented) normally relies on the browser language rather than the Drupal interface language. jquery_ui_datepicker 1.x solves all of this. See the source code for jquery_ui_datepicker how it uses Drupals t functions for the labels.

So I've downgraded to jquery_ui_datepicker 1.x latest and jquery_ui_effects 1.x latest and am using patches to upgrade the library to 1.13.2
This resolves the issue for D9, but it will likely become a problem in D10 if we're forced to use the new approach.

Motivation

We need the date picker to work in our language but jquery_ui module does not include the assets/vendor/jquery.ui/ui/i18n folder
tested this approach, the hook being used runs only once per cache rebuild. I'm not sure where to intercept the library on page load and load the expected i18n js file. I was only able to hack in my chosen language over top of all others.

Steps to reproduce

Proposed

a dirty solution is to add the jquery ui i18n folder but would prefer drupal t strings, with that said, i18n folder
Tested this approach and it doesn't work as expected, can only override english with one other language and then english is lost

reproduce:

install jquery_ui, visit the date picker using a drupal interface language OTHER than english
the months and days show up in ENGLISH only. So far patching has only permitted substituting english with one language and then stuck with that one language choice.

Proposed resolution

Remaining tasks

write a patch and review

User interface changes

expected labels for months and days should show up

API changes

N/A

Data model changes

N/A

๐Ÿ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024