Page 1 of 1

Change language items in template

Posted: Fri Aug 01, 2008 7:13 pm
by cgrauer
Hi again,

I want to change the title of a sidebar element (calendar) for a specific language (de) in my template ("amselhof"). I created the file "templates/amselhof/lang_de.inc.php" and "templates/amselhof/UTF-8/lang_de.inc.php" containing the line
@define('CALENDAR', 'Veranstaltungen');

I thought this would make s9y showing "Veranstaltungen" instead of "Kalender" on the sidebar element, but it does not. What's wrong with what I'm doing??

Posted: Fri Aug 01, 2008 8:21 pm
by abdussamad
You can make the change in the file lang/UTF-8/serendipity_lang_de.inc.php and it will show correctly on all your templates.

Posted: Fri Aug 01, 2008 8:56 pm
by cgrauer
abdussamad wrote:You can make the change in the file lang/UTF-8/serendipity_lang_de.inc.php and it will show correctly on all your templates.
Ok. But what about updates? What about reusing the template? I don't like to change the core of s9y. Should I?

Posted: Fri Aug 01, 2008 9:05 pm
by abdussamad
Ok i just figured out that if you want to change the title of the calendar plugin for just one template you can do so with this code in the sidebar.tpl file:

Code: Select all

{if $lang=="de" and $item.title=="Kalender"}
Verwhatever
{else}
{$item.title}
{/if}

Place the above code where the plugin title is displayed. Usually this is after <div class="serendipitySideBarTitle"> .

Posted: Sat Aug 02, 2008 9:26 am
by garvinhicking
Hi!

There is one little problem with language files in your template directory: It cannot "overwrite" the languages defined in your main language file.

To do so, a special variable has been introduced (this slows down the language loading process a bit): You can set $serendipity['useTemplateLanguage'] = true inside the serendipity_config_local.inc.php file and then you are able to overwrite s9y language constants in the language file of your template.

HTH,
Garvin