Jump to content

Problem with InputfieldDatetime in different languages

Recommended Posts


I am trying to set up a contact form using the API. Everything is working fine. I have just one problem with the InputfieldDatetime. I want to use a Datepicker in different languages. 

My languages are:

default - Deutsch 

english - Englisch

My Problem is: When switching between the contact form in both languages the Datepicker only shows english translations for days, etc.

Here's how I set it up via API:

$f = $modules->get('InputfieldDatetime');
$f->label = $field->form_label;
$f->required = $field->form_required;
$f->wrapClass = 'form-goup row';
$f->dateInputFormat = 'd.m.Y';
$f->datepicker = 1;
$f->timeInputSelect = 0;
$form->append($f); // append the field to the form

Notice: I found this thread here but the solution there does not work for me:

I included these files to make the Datepicker work in Frontend:


When I add the following translation file in my header it WORKS in german. But it does not translate back to english when switching languages...


So how does the language configuration for the Datepicker work? Is there an attribute for the API configuration? I found nothing in the documentation:



Share this post

Link to post
Share on other sites

I am setting up the datepicker via the processwire API. So i think it is a PW related question.

The InputfieldDatetime module is looking for different languages in Line 58. So I was wondering if those languages can be set up via a configuration variable.


Share this post

Link to post
Share on other sites

This sets the format for the input of dates/times (dateformat in the datepicker API), but it does not change the language of the datepicker UI, because this happens by including or not including those translation scripts you mentioned above. They basically set the datepicker to be in a certain language and don't just "make the translations available". Technically you can make jquery datepicker switch language at runtime, but I guess not including translations when not needed is the simpler solution.


As to why the core itself doesn't handle including the correct files: ProcessWire doesn't have means of identifying languages. You can name your languages however you want. So it cannot map languages created by the user to something like the path for the datepicker translation, because it doesn't know a certain language is supposed to be e.g. german in the first place.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...