SSbits - Home page
Site by Carbon Crayon
Submit a Post >

Snippets - Little bits of code to make you happy

Using Dates in Foreign Languages

With all the translatable, i18n and other translation related stuff in silverstripe, I think more than one is wondering how to achieve something simple as using dates in a foreign language... Actually, it's ultra easy if you add this 2 lines in your silverstripe powered website.

Here is my Spanish example:

_config.php

setlocale(LC_ALL, 'es_ES');   
Then in your template
$Date.FormatI18N(%A %e de %B de %Y)

 

 

 

 

This will render

miércoles 21 de octubre de 2009

Aram Balakjian avatar

Aram Balakjian

Aram is a web developer running London based agency Aab Web. He has a strong passion for developing attractive, usable sites around the SilverStripe CMS.

  • Nobrainer Web
    13/02/2013 10:39am (2 years ago)

    Hi Aram, i just needed some info regarding dates matching the current language, and i came across this post.

    I was actually looking for the system to display a different date format depending on the current language of the site.

    I found the following post very helpfull and thought i would share it here: http://www.silverstripe.org/blog-module-forum/show/6069?start=8#post301102

    Thomas

Post a comment ...

You cannot post comments until you have logged in. Login Here.

Advertisement

Site of the Month

Find SSbits on

Top Contributers

Rank Avatar Name
1 article image Aram Balakjian
2 article image Daniel Hensby
3 article image Marcus Dalgren
4 article image Hamish Campbell
5 article image Ty Barho
6 article image Martijn van Nieuwenhoven
7 article image Darren-Lee
8 article image Roman Schmid
9 article image Matt Clegg
10 article image dalesaurus

View full leaderboard


Advertisement