We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18463
    • 121 Posts
    Martijn van Turnhout Reply #1, 13 years ago
    I want to publish a Dutch date on a page, based on the
    [[*publishedon]]
    field.

    This is what I use:

    [[*publishedon:strtotime:date=`%d-%b-%Y`]]
    


    In this case, all I see is "04-May-2011", while I would like to see "04-Mei-2011". How can I accomplish this? Is there a neat way to modify "set_locale" or lexicon settings?
      • 18463
      • 121 Posts
      Martijn van Turnhout Reply #2, 13 years ago
      Found a solution. I used a plugin with the following code:

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


      However, I’m not really satisified with this solution. This should be a part of the "Lexicon and Language area" in System Settings.

      -- edit --

      Or better yet: add an output filter to Revolution. Something like :locale=`nl_NL`. That would solve a lot of things.
        • 28173
        • 409 Posts
        This is a one year old topic.
        Is there any nicer solution today ?
          • 37042
          • 384 Posts
          Interested in this too. Ive a multilingual site and the dates on each news article are in the wrong format.
            ...
            • 36624
            • 535 Posts
            you can write a snippet :
            <?php
            
             //   Snippet : DATEFR 
             //   Usage: [[+tv.myDate:DATEFR]] 
             //
            
             setlocale(LC_ALL, 'fr_FR.UTF-8');
             $output = strftime('%e %B %Y',strtotime($input));
             return $output;
              CTRL+SHIFT+U - Clear Cache
              CTRL+SHIFT+H - Hiding Heft Panel
              CTRL+SHIFT+N - Fast Create Resource
              CTRL+ALT+P - Preview Recource (in edit resorce window)
              CTRL+ALT+S - Save
              • 9674
              • 170 Posts
              Hi,

              In version 2.2.6 and may be some older version (never checked), there is a locale option in core parameters / lexicon and language section of the system configuration.
              I have no idea of what should be put in but the comment says : define the locale of the system .... refer to php documentation, with no exemple.

              This could be the right way to do it ?

              Modx team, can you confirm ?


              Cheers

              Philippe
                • 40045
                • 534 Posts
                Not MODx team, but I can confirm it =)...just put nl_NL or de_DE or whatever inside that system setting and it works for me...
                  • 9674
                  • 170 Posts
                  Quote from: exside at Feb 27, 2013, 12:28 PM
                  Not MODx team, but I can confirm it =)...just put nl_NL or de_DE or whatever inside that system setting and it works for me...

                  Thanks for the tips on the right way for configuration !
                  It works with fr_FR BUT even if the month are now in french language, the accentuated letters like é in the modx messages are displayed as question marks as in
                  - 26 f�vr. 2013 
                  where the rest of the texts in the [[*content]] is displayed properly as here :
                  Être informé des nouveaux messages:


                  I am getting this out of an Articles implementation.

                  ;-) to Shaun

                  Philippe
                    • 40045
                    • 534 Posts
                    Definitely looks like a content encoding problem (ie. not UTF-8)... what do you mean by "MODx messages", where are they shown, frontend or backend?
                      • 9674
                      • 170 Posts
                      Sorry must explain better :

                      My content utf 8 is looking good.
                      The text messages from the lexicon are printing correctly the accentuated letters (either in the manager or in article snippet).
                      The messages sent back from articles snippets (coming certainly out of core modx parameters) like the dates are printing wrongly. In fact, the dates are using the strtotime filter.... that could be the problem source.






                      [ed. note: Fildefer57 last edited this post 11 years, 2 months ago.]