We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39678
    • 68 Posts
    hellow,

    i have read several posts of setting the language of a date, but nothing works

    how can i set the language of a TV with input type 'date'

    thanks
    tom
    • You're looking for the PHP "locale" setting. http://www.php.net/manual/en/locale.setdefault.php
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 39678
        • 68 Posts
        i put the following under the body-tag

        <?php
        setlocale(LC_ALL, 'nl_NL');
        ?>


        but it didn't work

        isn't this something that i can change in the core settings of modx (evolution 1.0.10) [ed. note: tomvanminnebruggen last edited this post 10 years, 9 months ago.]
        • No, you can't have PHP code in templates, chunks or content.

          You could make a snippet with that same code, and put the snippet in your template. You could also add the setlocale line to your config.inc.php file (manager/includes/config.inc.php) - this file is not overwritten during upgrades, so the line would be save across upgrades.

          I don't recall if Evo has a locale setting; Revo does.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
          • Quote from: tomvanminnebruggen at Jun 29, 2013, 09:22 PM
            how can i set the language of a TV with input type 'date'

            Should work with PHx and the following modifier (the widget of the template variable has to be set to unixtime):

            <?php
            /*
             * description: returns german date
             * usage: [+unixtime:date_ger=`format`+]
             */
            $format = (isset($options)) ? $options : '%A, %e. %B %Y';
            setlocale (LC_TIME, 'de_DE.UTF-8');
            $date_ger = strftime ($format, 0 + $output);
            return $date_ger;
            ?>
              • 39678
              • 68 Posts
              okay, i have tried differtent things. This is what i got

              i have a snippet (set_local_date) which containt:

              <?php
              setlocale(LC_ALL, 'nl_NL');
              ?>


              than i put this snippetcal right under the body-tag:

              [!set_local_date!]


              but no results. it still have the english-notation
              also place the php-code in the config.inc.php was not the solution

              but then i take this code for the snippet:

              <?php
              setlocale(LC_ALL, 'nl_NL.UTF-8');
              ?>


              and it works now

              thanks for your help everybody
                • 39678
                • 68 Posts
                hello,

                My TV calls 'date'.

                My solution works, but only on the pages where i call the TV by [+date+] in a chunk,
                and not when i call the TV by [*date*] in a site-template.

                I have set up the snippet set_local_date on each site-template.

                Isn't this strange?