Change language items in template

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
cgrauer
Regular
Posts: 18
Joined: Sat Aug 11, 2007 12:25 am
Location: Stuttgart (Germany)
Contact:

Change language items in template

Post 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??
abdussamad
Regular
Posts: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan
Contact:

Post 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.
cgrauer
Regular
Posts: 18
Joined: Sat Aug 11, 2007 12:25 am
Location: Stuttgart (Germany)
Contact:

Post 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?
abdussamad
Regular
Posts: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan
Contact:

Post 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"> .
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply