We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Unless I missed something, right now there is no way to automatically have dates displayed in the selected language in MODx (shouldn’t it be the case ?).

    I’ve started looking for a way to have dates to be displayed in French, using setlocale. I just created a mini-snippet that I inserted at the top of my templates :
    setlocale (LC_TIME, "fr_FR");


    It did not change anything, the page is still displaying the date in english. The dates I want displayed in french are from a TV (Input Type is set as Date, Widget is set as Date Formatter). I don’t think it’s the problem since the DateTime snippet does not take this into account either...

    I probably miss something obvious huh, this not being my area...

      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 32241
      • 1,495 Posts
      Sorry, I wish I could help, but as far as I know there is no support in localization yet. Hope I’m wrong. I want to know about this too.

      What ability that MODx has in terms of localization and internationalization? I mean based on the core system, without having to use snippet, plugin, or module.
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
      • No direct localization support currently. That is one of many major key changes that will take place in a future rev.

          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 6726
          • 7,075 Posts
          Nice to know, but in the meantime do we have to hack our snippets directly like Theo did with Documentmapper ?

          I am not sure I am able to do that, since he uses custom API functions that he wrote himself...

          Any thought on why the way I use setlocale is failing ?
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
          • Not sure David, but most likely the snippets you are using to output dates were not written with this in mind. Can you provide some specific snippet sources or other sources of the foul dates?
            • Also, I am working on some interesting changes to our core that, if adopted, will address this very issue automatically. More details very soon...
              • I just happen to be looking at the code for UserComments, and there is an optional argument, dateformat, for it:

                $dateformat = isset($dateformat) ? $dateformat : '%e%b%Y %I:%M%p';


                If a snippet were being converted to full multi-language, this could be broken out as a variable defined in an external $lang.php file along with all the rest of the text output of the snippet.
                  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
                • That’s a really intersting observation Susan... same is now in the to be released version of NewsListing.
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 21301
                    • 93 Posts
                    Quote from: OpenGeek at Dec 07, 2005, 09:24 AM

                    Also, I am working on some interesting changes to our core that, if adopted, will address this very issue automatically. More details very soon...
                    Can’t wait to see that!

                    @David, do you use [tt]strftime[/tt] to print the time? That works together with [tt]setlocale[/tt] just fine for me. No clue for why that shouldn’t work.

                    BTW The latest version of the DocMapper snippet has all the API functionality moved to the snippet. So no need for a custom API anymore.
                      • 6726
                      • 7,075 Posts
                      Quote from: theo
                      @David, do you use [tt]strftime[/tt] to print the time? That works together with [tt]setlocale[/tt] just fine for me. No clue for why that shouldn’t work.

                      No I did not use [tt]strftime[/tt] to print the time, my problem was displaying a date stored in a template variable. It’s "called" by the NewsListing snippet, the chunk used as tpl uses a placeholder for TVs that I need displayed.

                      I thought inserting a small snippet with setlocale on top of my pages would have them display correctly. It does not... Probably something obvious to php savvy people but not me !
                        .: COO - Commerce Guys - Community Driven Innovation :.


                        MODx est l'outil id