Skip to content
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

Datepicker is in Cyrillic after upgrade #6

Open
m4nu75 opened this issue Oct 18, 2022 · 15 comments
Open

Datepicker is in Cyrillic after upgrade #6

m4nu75 opened this issue Oct 18, 2022 · 15 comments
Labels
help wanted Extra attention is needed

Comments

@m4nu75
Copy link

m4nu75 commented Oct 18, 2022

Hi all ! after the upgrade to 2022-07-31a "Igor", my datepicker pop up on bureaucracy is in cyrillic. I don't understand how to change it. After many trials i found out that if i disable the davcal plugin datepicker return in english (my local settings).
Is there a method to change the datepicker language ?
image

@Klap-in
Copy link
Member

Klap-in commented Oct 18, 2022

It includes its own jquery datepicker, while DokuWiki includes also a date picker.
So here maybe a conflict exist? https://github.com/dokufreaks/dokuwiki-plugin-davcal/tree/master/datetimepicker-2.4.5

@m4nu75
Copy link
Author

m4nu75 commented Oct 19, 2022

The problem is when i upgrade the plugin to the new version of davcal.
image

With the previous version of davcal in 2022-07-31a "Igor" datapicker on bureocracy form works correctly in english.

@Klap-in
Copy link
Member

Klap-in commented Oct 19, 2022

Hmm, quick look in the recent commits, show one with changes of the javascript. The javascript of the datetimepicker is not touch, but of the fullcalender is, and it includes updates of the languages of the fullcalender.
f119ccc
Might be the interference occurs somewhere there?

A limit set of languages is allowed here: https://github.com/dokufreaks/dokuwiki-plugin-davcal/blob/master/action/jsinfo.php
jsinfo array is forwarded to javascript.

@m4nu75
Copy link
Author

m4nu75 commented Oct 20, 2022

I tryed to replace the 3.10.5 with 3.7.0 in the files all.css , print.css and script.js and the datapicker of dokuwiki is in english. Looking in the f119ccc only the moment.js seems different ....

@m4nu75 m4nu75 changed the title Datepicker is in Cyrillic after "Igor" upgrade Datepicker is in Cyrillic after upgrade Oct 21, 2022
@m4nu75
Copy link
Author

m4nu75 commented Oct 25, 2022

I founded this ....

MomentJS and jQuery UI Datepicker

When you load a FullCalendar language file, it also loads the translations for MomentJS and jQuery UI Datepicker (if the library is already on the page). Just make sure to include the <script> tags for Moment and Datepicker before you include FullCalendar’s language file:

<script src='lib/moment.js'></script>
<script src='lib/jquery-ui.custom-datepicker.js'></script>
<script src='fullcalendar/fullcalendar.js'></script>
<script src='fullcalendar/lang-all.js'></script>

I think that this is the problem the header of the script.js , indeed if i change in :

/* DOKUWIKI:include_once fullcalendar-3.10.5/moment.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/fullcalendar.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/de.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/en.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/fr.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/nl.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/ru.js */
/* DOKUWIKI:include_once datetimepicker-2.4.5/jquery.datetimepicker.js */
/* DOKUWIKI:include_once jstz.js */

The calendar works correctly in english ...
This is only a workaround.

If i put the row with fullcalendar.js before moment.js , the datepicker works in english but the davcal synchronization (client mode) doesn't work ...

@stullekovski
Copy link

Hi all ! after the upgrade to 2022-07-31a "Igor", my datepicker pop up on bureaucracy is in cyrillic. I don't understand how to change it. After many trials i found out that if i disable the davcal plugin datepicker return in english (my local settings). Is there a method to change the datepicker language ? image

Hi there,
got exact the same issue after installing the Bureaucracy Plugin.
The davcal datepicker is fine, but the Bureaucracy is in cyrillic.

Any ideas how to fix it and still have syncing working?

Thanks a lot!

@Klap-in
Copy link
Member

Klap-in commented Nov 17, 2022

I have not enough time to look into this, my guess is that it could also possibly interfere with the datepicker included in DokuWiki (but that is pure guessing).

Who has javascript experience and could investigate this? That would be helpful!

@Klap-in Klap-in added the help wanted Extra attention is needed label Nov 17, 2022
@m4nu75
Copy link
Author

m4nu75 commented Nov 18, 2022

Any ideas how to fix it and still have syncing working?

I've used this workaround to fix it : changed the header in the file dokuwiki/lib/plugins/davcal/script.js

/* DOKUWIKI:include_once fullcalendar-3.10.5/moment.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/fullcalendar.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/de.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/en.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/fr.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/nl.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/ru.js */
/* DOKUWIKI:include_once datetimepicker-2.4.5/jquery.datetimepicker.js */
/* DOKUWIKI:include_once jstz.js */

with this lines

/* DOKUWIKI:include_once fullcalendar-3.10.5/moment.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/fullcalendar.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/de.js */
/* DOKUWIKI:include_once fullcalendar-3.10.5/locale/en.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/fr.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/nl.js */
/* DOKUWIKI:include_once fullcalendar-3.7.0/locale/ru.js */
/* DOKUWIKI:include_once datetimepicker-2.4.5/jquery.datetimepicker.js */
/* DOKUWIKI:include_once jstz.js */

@stullekovski
Copy link

Hi, I've seen and tried it. After the embedded calendar disappears. No workaround for me. Sadly.
Our "workaroud" is now to type the date as a "text" inside the textbox of bureaucracy.

@Chris75forumname
Copy link

Chris75forumname commented Jan 27, 2023

I had the same issue. And it comes as no suprise, all this plugin and jQuery mess, specially with datepicker, just cannot be relied on. This mess is not the fault of any one individual plugin! It's a general issue with the plugin environment. As we see in this thread it effects many plugins and pops up here and there. Plus, at least in the case of datepicker, also browsers will interfer. And I cannot present my users with 10 different datepickers!

I fixed this whole mess by explicitely declaring the datepicker object and with it all the options of datepicker in all effected plugins in the respective JS files of those plugins (copy&paste). Finally, I managed to establish my custom styled datepicker accross all plugins (bureaucracy, struct, booking) for a consistent user experience. This was alot of work. (Too much to post it here, but that's the idea.) I am aware it is kind of a workaround. But I feel save now!

Take home messages:

  1. If you want something in code in a certain way, you have to explicitely declare it.
  2. System integration is a separate milestone.
  3. The more complex the system gets and the more dependencies you add, the less resilient (and predictable) this system becomes.

(PS: Initially, I had tried out davcal and ended up using yearbox and minical. And I didn't notice, at the time, where this bug came from. It was just very persistent. I should have deactivated plugins, to tackle this. But, I didn't. That's why I had to take the hard way to solve this problem for me.)

@Klap-in
Copy link
Member

Klap-in commented Jan 27, 2023

Valid point.

Please note that this plugin is in need of a maintainer. This repository is recently created to enable others to submit easier improvements for this plugin. Because it needs significant improvement, it is marked as discontinued.

Maybe a wider use of the input with type date or datetime in DokuWiki and it’s plugins could improve the scattered set of datetime fields?
E.g. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date

@Chris75forumname
Copy link

Chris75forumname commented Jan 27, 2023

Well, this will also look different in different browsers. The jQuery datepicker, if declared explicitely, looks identical in all browsers.

DokuWiki is very much in need of a set of working calendars for different applications. I programmed one booking calendar for the booking plugin, one full year wallpaper calendar from yearbox, one monthly leave calendar with navigation and input form from yearbox, and I enhanced minical for room reservation. So this was alot of work, to make DokuWiki usable as an intranet. All of this was only halfbaked available.

@Klap-in
Copy link
Member

Klap-in commented Jan 28, 2023

How did you declare the jQuery date picker? Or could you propose it with a pull request?

@Chris75forumname
Copy link

Chris75forumname commented Feb 2, 2023

As an example, in most major plugins, datepicker is declared very bare, like so:
https://codesearch.dokuwiki.org/xref/plugin/bureaucracy/script/datepicker.js

This leaves too much room for unwanted cross-talk. What I did was specify all properties that I need, like so in EVERY plugin:

 jQuery("input[name='date']").datepicker({
     dateFormat:'dd.mm.yy',                                        // 01.01.2001
     changeYear: false,
     monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
     monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'],
     dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
     dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
     dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
     showOn: 'button',
     buttonImageOnly: false,
     beforeShow: function(input, inst) {                           // https://stackoverflow.com/questions/662220/
        var calendar = inst.dpDiv;
        setTimeout(function () {
           calendar.position({
              my: 'left bottom',
              at: 'left top',
              collision: 'none',
              of: input
           });
           jQuery("#ui-datepicker-div").css('transform', 'translate( -40px, -6px )');
        }, 0);
     },
  }).next('button');

So, however this could be implemented in the code, I don't know, but leaving it to quincidence is just not a solution, as we saw earlier.

@Chris75forumname
Copy link

Chris75forumname commented Jun 5, 2023

#6 (comment) by m4nu75

I dug a bit deeper into this, and I found that davcal loads some locale for datepicker as stated above in the following file:

https://codesearch.dokuwiki.org/xref/plugin/davcal/script.js

The last loaded locale is kept, which is ru. If you change that to ja and reset your browser cache in your browser's settings, you get japanese per default.

However, you can move your langage to the end of the list or just delete all other locale language calls, except the one for your language, which you keep. And your language will now be used for davcal and bureaucracy alike.

So to make the point clear: this is actually, where the language setting is overwritten, causing this bug in bureaucracy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants