Okay
  Public Ticket #3381821
DatePicker / Calendar translation (pt-BR)
Closed

Comments

  •  1
    Zeba Lyra started the conversation

    Hello / Здраво,

    My WP install is configured to use Brazilian Portuguese (pt-br) language.

    Brazilian Portuguese (pt-br) language is also selected in WPDT Settings.

    But the Datepicker in the tables is in English.

    As I could see by researching topics like this: https://tmsplugins.ticksy.com/ticket/2671239 ,
    I would like to know:


    a) if Date Picker still needs to be changed manually.

    b) And especially the step-by-step to change to Brazilian Portuguese (pt-br).
    (as the topic is from 2021. And current files have more lines too.)

    Thanks in advance!

  •  1,848
    Miloš replied

    Hi, Zeba / Здраво!smile.png

    I will have to check about this with our developers.

    I know that the language of the date picker is being determined by a 3rd Party HTML5 library.

    If a language you need is supported in this library, and if the current page has this language locale,

    then this language will be applied to the Date Picker.

    If that language is not supported by this library, then the calendar will be in English.

    -

    But i will still double-check with our developers, if that workaround from the said ticket can still work,

    and if there is any better way/workaround.

    As soon as they confirm, we will report back right away.

    Thank you for your patience.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    Zeba Lyra replied

    Very good Miloš,

    I'm looking forward it!

  •  1,848
    Miloš replied

    Hey, Zeba.

    No problem, i will follow up on it with our devs.

    Still no confirmation, but going to keep you posted.

    Thank you for your patience, as always.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    Zeba Lyra replied

    Thank you for keeping me informed, even though I haven't received a confirmation yet.

    I want to stress the importance of obtaining feedback from the developers.


    Opening a ticket is the last line I activate.

    My pattern is always to try to solve by myself.


    And not less important, I sincerely appreciate your continuous support and patience, as always too.

    Kind regards.

  •  1
    Zeba Lyra replied

    Just one observation:

    - There is no problem with being in Portuguese from Portugal (pt) too.

    Since Datepicker's / Datetimepicker's language becomes Portuguese.

    (instead of English)

  •  1,848
    Miloš replied

    Hi, Zeba.

    No problem, i am happy to help and advise as much as possible.

    -

    We got word from our developers.

    They confirm that the workaround from that ticket 2671239 is still the same.

    You can upvote this feature suggestion here

    https://features.wpdatatables.com/51 ,

    and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    -

    2. In regards to the steps for that workaround, as far as we can see the lines are more/less the same,

    if you search in each file for these lines/pieces of code that need to be changed, you should have no issues in finding them.

    I personally use either Visual Studio Code, or Sublime as code editors of choice,

    and with both we can find the lines with "CTRL+F" combination.


    The example for German:

    1. Open ../wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.funcs.js 

    and add this code under the comments "Apply datetimepicker" around line 147

    ( The "Apply datetimepicker" is giving only one result in the code)

    :

    moment.locale('de', {
            months : ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],
            monthsShort : ["jan", "feb", "mär", "apr", "mai", "jun", "jul", "aug", "sep", "okt", "nov", "dez"],
            weekdaysMin : ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
            week : {
            dow : 1  // Monday is the first day of the week
            } } ) ;

    9962364466.png

    Then, below that find this line of code around line 169:

    $(this).datetimepicker(
                {
                    format: wdtDateFormat + ' ' + wdtTimeFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false
                }
            )

    It is more less still on the same line,

    but to future proof it, it is best to search for this entire code with CTRL+F  : 

    $(this).datetimepicker(
                {
                    format: wdtDateFormat + ' ' + wdtTimeFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false
                }
            )
    


     there is only one result with this particular code, so there is no mistake :

    6685487614.png


    And modify it to look like this (add "locale: 'de' "):

    $(this).datetimepicker(
                {
                    format: wdtDateFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false,
                    locale: 'de'
                }
            )

    Do not forget to add a comma ( , ) after " useCurrent: false " (see code above). If you forget that, this will not work.

    Then, do the same for around line 183 (add "locale: 'de' "):


    $(this).datetimepicker(
                {
                    format: wdtDateFormat,
                    showClear: true,
                    keepOpen: true,
                    useCurrent: false,
                    locale: 'de'
                }
            )
                .off('dp.show')
                .on('dp.show', function () {
                    $(this).parent().find('div.bootstrap-datetimepicker-widget').addClass('wdt-datetimepicker-modal');
                    if (!_.contains(['MM/Y','MMM Y','Y'], wdtDateFormat)) {
                        wdtAddDatePlaceholders($(this));
                    }
                });
        });

    On my end, when i already added all the other lines, now it is around line 233.

    9921046558.png

    For the rest of the workaround, you should be able to use the same logic, in terms of "search and replace pieces of code", it works on our end,

    but let us know if you encounter any issues and we can check it out.


    2. Open ../wp-content/plugins/wpdatatables/source/class.wdttools.php and around line 1469 add the following line of code:


    wp_enqueue_script('wdt-moment-de', WDT_JS_PATH . 'moment/locale/de.js', array(), false, true);


    So it should look like this in the end:


    wp_enqueue_script('wdt-moment', WDT_JS_PATH . 'moment/moment.js', array(), WDT_CURRENT_VERSION, true);
    wp_enqueue_script('wdt-moment-de', WDT_JS_PATH . 'moment/locale/de.js', array(), false, true);
    wp_enqueue_script('wdt-bootstrap-datetimepicker', WDT_JS_PATH . 'bootstrap/bootstrap-datetimepicker/


    This also changes the datepicker starting day, so the week starts from Monday, not Sunday.


    3. Open this file: 

    wp-content/plugins/wpdatatables/assets/js/wpdatatables/wdt.frontend.min.js

    Since this is a minified file, you have to search for the following line of code:


    $(this).datetimepicker({format:wdtDateFormat,showClear:!0,keepOpen:!0,useCurrent:!1})


    and change it to look like this:

    $(this).datetimepicker({format:wdtDateFormat,showClear:!0,keepOpen:!0,useCurrent:!1,locale:'de'})


    The last step is to go to main settings of wpDataTables, under Custom JS and CSS  tab, and disable the "Use minified wpDataTables Javascript" check-box.

    -

    Of course, the example we have is for changing the language to German, for other languages you can modify it as needed.

    Let us know if that helps, and if you encounter any issues with the workaround.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    Zeba Lyra replied

    Nice! I managed to understand everything.

    Sometimes it takes a while, sometimes not.

    But the result is a pure work of art.

    Another full service of Miloš Jovanović.
    (and duo: Support Team + Dev Squad)

    Thanks.

    Best regards!

  •  1,848
    Miloš replied

    Hi, Zeba.

    I am happy to see that this helped.

    To be honest, it took me a few minutes as well to follow along and check all the lines,

    while i was testing this on my local Site, checking if anything got messed up, this workaround does have a few steps, indeed.smile.png

    I hope that everything works as it should on your end,

    we will certainly be here if any assistance is needed.

    You're very welcome for the support.

    Best wishes from our Team.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables