We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38339
    • 41 Posts
    just exploring the version 2.2.0-pl2:
    under system settings/lexicon + language there's a new entry named 'locale'
    [#4610] Add locale system setting for setting locale in MODX
    what's the right syntax to fill in there? Didn't found this in the documentation.

    Can we now use this setting instead of a plugin like this
    <?php
    /* set locale to german */
    setlocale (LC_ALL, 'de_DE');
    


    thanks for infos
    Manfred
      Revolution 2.2.6
      • 34178
      • 212 Posts
      Hi Manfred,
      did you finally find out what´s locale about in the settings?

      Letti
        • 33976 ☆ A M B ☆
        • 571 Posts
        Hi,

        On my side, it behave nicely with
        fr_FR.UTF-8


        Hope that will help smiley
          • 38339
          • 41 Posts
          Hi Romain,

          thanks for info. Will try it this way.

          Anyway, an explanation from the developers or in the documentation would be nice/helpful.
          Seems, this locale setting refers to LC_ALL ?
          And we also don't need a plugin on OnInitCulture anymore (like mentioned above)?

          regards Manfred
            Revolution 2.2.6
            • 44659
            • 20 Posts
            I'm trying to set that locale for all my language contexts, but seems it's not working for ':date' filter (de_DE or de_DE.UTF-8) does not changing eg. March into März in de context.

            Am i doing it right?
              • 3749
              • 24,544 Posts
              IIRC, the :date output modifier calls PHP's date() function which doesn't respect the locale. Try using :strftime instead - it should.

              Be sure to check out the formatting tokens for strftime here: http://us2.php.net/strftime
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 44659
                • 20 Posts
                Quote from: BobRay at Jan 22, 2014, 03:05 AM
                IIRC, the :date output modifier calls PHP's date() function which doesn't respect the locale. Try using :strftime instead - it should.

                Be sure to check out the formatting tokens for strftime here: http://us2.php.net/strftime

                Thank You - it's really helpfull. In my case strftime works, but i need to install more locales to server smiley
                If someone will have the same problem, then should check is there given locale is installed on server.
                Simple check:
                var_dump(setlocale(LC_TIME, 'de_DE'));
                // OR:
                var_dump(setlocale(LC_TIME, 'deu'));
                // according to ISO639: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
                

                above code should dump: s
                tring(19) "German_Germany.1252"

                when language is installed, or
                bool(false)
                when it's not.