Support » Fixing WordPress » date_i18n not capitalizing first letter of the month

  • So i have one website which i used Serbian localization of wordpress alongside with Latin characters and i am trying to output Month on one page but in output the first letter of the month is not uppercase.

    <?php echo date_i18n( 'F', strtotime( $datenow ) ); ?>

    When i use just date() this output month in english eg: August but localized it should output Avgust instead it output’s avgust

    Is there a fix for this or i am missing something here ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I had the same problem with brazilian portuguese. That’s because the correct syntax for days of the week and months in english is first letter uppercased while in portuguese (probably serbian too) is lowercased so that’s how those words where translated. I user PHP functions ucfirst or ucwords to fix this.

    <?php echo ucfirst(date_i18n( 'F', strtotime( $datenow ) )); ?>

    I fixed this by wrapping output in specific class like <span class=”mesec”>output</span> and added text-transform:capitalize property to css.

    • This reply was modified 5 months, 2 weeks ago by  Aleksandar.
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.