Jump to content

Date in another language


clever-host

Recommended Posts

hello

what can I do for translate this functions?

 

{$smarty.now|date_format:"%A, %d %B %Y, %H:%M"}

 

I put this functions to clientarea template, and it's ok, but appear in english language and I want romanian language.

 

in this moments appear this:

 

Friday, 20 February 2015, 13:49

 

But I want to appear in romanian language. Example: Vineri, 20 Februarie 2015, 13:49

Thanks.

Link to comment
Share on other sites

  • 10 months later...

you can't really do this in Smarty, ideally you'd need to modify PHP using setlocale.

 

http://php.net/manual/en/function.setlocale.php

 

I suppose if theory if you *had* to do this is Smarty, you could use replace to convert the English names to Romanian (or any other language) - but you'd need 17 replaces for each language (7 day names, 12 months)...

 

to change the days of the week to Romanian, you could use the code below... if you wanted to change the months, you'd need to extend this with 12 more replaces... :roll:

 

{$smarty.now|date_format:"%A, %d %B %Y, %H:%M"|replace:'Monday':'luni'|replace:'Tuesday':'marţi'|replace:'Wednesday':'miercuri'|replace:'Thursday':'joi'|replace:'Friday':'vineri'|replace:'Saturday':'sîmbătă'|replace:'Sunday':'duminică'}

there would be another way to do it which would be better, but you'd still end up using 17 replaces!

 

if you have the choice, using setlocale would be a far simpler and more thorough solution.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated