Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

$Created.Ago in german


Go to End


4 Posts   1290 Views

Avatar
Pipifix

Community Member, 56 Posts

3 February 2012 at 12:05am

Hello,

I simple want to change the output of $Created.Ago in german translation on a current project (SS2.46). Means the string ‘(1 day ago)‘ should be ‘(vor 1 Tag)‘. My config is set to:


i18n::set_default_locale("de_DE");
setlocale(LC_ALL, 'de_DE');
setlocale(LC_TIME,"de_DE.UTF-8");

Althought i searched the forum, i did'nt found a solution. Where to look for...?
Thanks for your help.

Pipifix

Avatar
Devlin

Community Member, 344 Posts

3 February 2012 at 2:34am

Edited: 03/02/2012 2:39am

i18n::set_default_lang("de_DE");
i18n::set_locale('de_DE');
setlocale(LC_TIME, array('de_DE.UTF-8','de_DE') );

Works for me.

Avatar
Pipifix

Community Member, 56 Posts

9 February 2012 at 8:46am

Hi Devlin,

Thanks for your reply. I've change my _config.php to your settings. but the string on the pagecomment is still the same ‘1 day ago‘. I use use the pagecomments only at the blogentry. Any other tips?

Pipifix

Avatar
Devlin

Community Member, 344 Posts

9 February 2012 at 10:57pm

Edited: 09/02/2012 10:58pm

Then I would suggest that you changed i18n:set_locale() somewhere in your code or you overloaded $lang['de_DE']['Date']['TIMEDIFFAGO'] or the language file is not loaded.
You can check your locale if you place "echo i18n::get_locale();" & "echo _t('Date.DAYS');" in e.g. your init method. It should return "de_DE" & "Tage".