Well, this is very funny :)

I have a datepicker localized in Italian. It works correctly, except that, apparently, the abbreviation for Wednesday was translated as it were a personal pronoun, since noi is the Italian translation for we.

screenshot from datepicker, illustrating the error in translation

The abbreviation for Wednesday is correctly set in core/assets/vendor/jquery.ui/ui/i18n/datepicker-it.js, but this file is not inserted in the HTML, so I suppose the translation is taken somewhere else.

In my libraries dependencies I have the following code.

  - core/jquery
  - core/jquery.once
  - core/jquery.ui.datepicker
  - core/drupal.locale.datepicker

Without the last line, the date picker is in English.

Am I doing something wrong?

  • I guess the problem is in core/modules/locale/locale.datepicker.js at line 20, where dayNamesMin[3] is set to Drupal.t('We'): it doesn't seem like a good idea, does it? Is it reasonable to report it as a bug in core? – Francesco Marchetti-Stasi Sep 17 '18 at 9:22

I think you should download Italian initialisation jQuery UI js file and attached to your concerned page in your module or theme.

  • But that is a jQuery UI file not adapted to the Drupal environment, isn't it? If I compare it to core/modules/locale/locale.datepicker.js, which is where Drupal.t('We') occurs, I can see that the code is not run in a behavior. I would anyway be surprised that such a basic configuration would require the download of a file from another project... even since the translation works, the problem is that translating "We" is not a good idea! – Francesco Marchetti-Stasi Sep 17 '18 at 9:17
  • Here is a code snnipet from date_popup_load to load english version of ui datepicker if (module_exists('jquery_ui')) { jquery_ui_add('ui.datepicker'); // Add i18n support global $language; if ($language->language != 'en') { drupal_add_js (JQUERY_UI_PATH.'/ui/i18n/ui.datepicker-'.($language->language).'.js'); } } try to implement the same in hook_library_info_build to load ui datepicker-it . – berramou Sep 17 '18 at 9:57
  • hook_library_info_build – berramou Sep 17 '18 at 10:02
  • But why should I reimplement something that is present and working? The only problem is that it does incorrectly translate the abbreviation for Wednesday. If this won't get corrected, I think I'll simply have to override core/modules/locale/locale.datepicker.js... – Francesco Marchetti-Stasi Sep 17 '18 at 10:14
  • 1
    @PonzioPilato, unfortunately I didn't solve it. I simply changed the translation of "We" to "Me", it works as long as I don't have a "We" in the interface... – Francesco Marchetti-Stasi Apr 4 '19 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.