Month names translation

Permalink 2 users found helpful
Hello, I'm wondering how can i change displaying month name in page list block, which is shown using this code:
$month = $cobj->getCollectionDatePublic('F');
and i put month name using :
<?php  echo $month; ?>


Where can i edit month names, so they can be displayed in my language [PL] ?

greetings

grosik
 
wagdi replied on at Permalink Reply
wagdi
Im not sure if this will help but... you can get the translated core from either of these -

http://concrete5.pl/

http://concrete5.org.pl/
grosik replied on at Permalink Reply
grosik
Actually i have tried both versions of translation that You have posted. None of these translates month names. Anyway thanks for your time :)

I think that month names are stored somewhere else. Could anybody tell me where ?
wagdi replied on at Permalink Best Answer Reply
wagdi
pvernaglia replied on at Permalink Reply
pvernaglia
Have you installed the language files for pl? If month names are not in them I think you could make a language file for the pagelist block then use echo t($month) in your template.
Jongosi replied on at Permalink Reply
Jongosi
Have you tried
<?php  echo t($month); ?>
grosik replied on at Permalink Reply
grosik
Thanks for your replies guys, using your information i've solved my problem :)

I've red 2 topic that Wagdi posted and i realized that there is no translation anywhere for months.

here is the solution which helped me:

1. create dummy php file (f.e months.php) and place it anywhere in root/concrete directory.
2. put code below into that that file
<?php
print t('Monday');
print t('Tuesday');
print t('Wednesday');
print t('Thursday');
print t('Friday');
print t('Saturday');
print t('Sunday');
print t('January');
print t('February');
print t('March');
print t('April');
print t('May');
print t('June');
print t('July');


3. using poedit open your .po file and "update from source"
properties for your .po file (edit it with poedit, if you cannot update your files)
- if you have located .po file in root/languages/pl_PL/LC_MESSAGES/ use "base path" as "../../../" and add paths "." <-- it will search in each .php file
-then go to tab "sources keyword" --> add "t" (i guess its concrete5 translate function)

4. After updating your translation file from source,it should have months and days available to translate. Translate it to your language and save file
-
5. set
define('LOCALE', 'pl_PL');
in ROOT/config/site.php and
setlocale(LC_TIME, 'pl_PL');
in your page list block.


6. at last use
<?php  echo t($month); ?>
to use your translated month name in page list block :) - thanks to Jongosi.


I mark Wagdi's post as helpful, but Jongosi, u have also helped. Thank you both guys :)
Jongosi replied on at Permalink Reply
Jongosi
Sweet, well done grosik.
PatrickHeck replied on at Permalink Reply
PatrickHeck
Hi grosik,

this behaviour is in the core (5.6) now. Just do this:

$dh = Loader:helper("date");
$month =  $dh->date('F',$cobj->getCollectionDatePublic("U"));
echo $month


API Docs are here:http://docs.mnkras.com/class_concrete5___helper___date.html#a5f7a74...

Best Patrick
grosik replied on at Permalink Reply
grosik
Hi Patrick, thanks for Your reply, that will be helpful on my new project, but the issue i met when i started this topic was related to older project on C5 v 5.5. I don't want to update that site ATM, because of much modifications i have done there (maybe when i have more time).

Anyway thanks for the info, now this topic have 2 solutions :)
sombetzki replied on at Permalink Reply
sombetzki
I still can't change the names of the months :S
I'm prob doing something wrong in the view.php file in my blocks\page_lists\ folder.

Some tips?

thanks