Editing lang for calendar plugin

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
3XTR3M3
Posts: 4
Joined: Mon Nov 07, 2011 9:32 am

Editing lang for calendar plugin

Post by 3XTR3M3 »

Hi, i need little help

My language is not supported by serendipity blog and i edit english manual, only thing that is problem is calendar on frontpage, i can't find where can i edit (translate) days of week , and month name

Thanks for help, serendipity blog is very cool :)
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Editing lang for calendar plugin

Post by Timbalu »

This is generated by PHP mktime etc functions in the core plugin
class serendipity_calendar_plugin ... in include/plugin_internal.inc.php.

You may have to set some DATE_LOCALES in your translated lang file, as here for example the german ones:

Code: Select all

@define('DATE_LOCALES', 'de_DE.ISO-8859-1, de_DE.ISO8859-1, german, de_DE, de_DE@euro, de');
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
3XTR3M3
Posts: 4
Joined: Mon Nov 07, 2011 9:32 am

Re: Editing lang for calendar plugin

Post by 3XTR3M3 »

I'm not sure we understand each other, :)
I think that is simple

Calendar is ok, date and time are perfectly correct , i only want to translate Days and Month name

for example: Monday to Ponedeljnik
October to Oktobar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Editing lang for calendar plugin

Post by Timbalu »

The calendars month name is build by

Code: Select all

<b><a style="white-space: nowrap" href="{$plugin_calendar_head.uri_month}">{$plugin_calendar_head.month_date|formatTime:"%B '%y":false}</a></b>
in plugin_calendar.tpl in your template, bulletproof and/or default template.

This executes some internal functions, also checking timezone offset and finalizing in PHPs strftime function building the month name via the %B format parameter string, which means: full month name, based on the locale set on your server.

So having the serversides locale set to russian, and also having a russian @define('DATE_LOCALES', 'ru_RU, ru_RU.CP1251, rus_RUS.1251, and so on') in your lang file, it should execute as it should.

But I remember a thread saying PHP is not returning correct values in russian and some other languages. Please also read http://board.s9y.org/viewtopic.php?f=11&t=17513&start=0 - maybe you can find an answer here too.

PS. A temporary workaround could be to code a replacement via replace or an own modifier. Something like this as an array {$plugin_calendar_head.month_date|formatTime:"%B '%y":false|replace:'October':'Oktobar'}

Use this script to check for available locales on your server

Code: Select all

<?php
system('locale -a'); // for all locales
//system('locale -a | grep ru'); // for russian locales
?>
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply