I've come across this problem: I want to run a site in English and German. For some other website I use the Multilingual Entries plugin together with some Language Specific HTML Nuggets to display the dynamic content. And well that kinda works, I can display almost everything in both languages.
But the thing that I am not satisfied with is the fact that the static basic site layout can only be done in one language. I'm talking about menu items, header/footers... those things that appear in the index.tpl.
Is it possible to change the multilingual plugin in a way that it also changes the site template in the same way this is done with categories? (Properties/Templates of categories plugin) So I can do a version of the style in both languages.
Multi-Languages to change the site template?
-
- Regular
- Posts: 450
- Joined: Thu May 26, 2005 10:43 am
- Location: Bonn, Germany
- Contact:
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Multi-Languages to change the site template?
Hi!
You can change the template by using a config.inc.php and using constants for language abstraction. The bulletproof template for example does that with lang_XX.inc.php files. The selected language will be included based on the visitors language setting.
Regards,
Garvin
You can change the template by using a config.inc.php and using constants for language abstraction. The bulletproof template for example does that with lang_XX.inc.php files. The selected language will be included based on the visitors language setting.
Regards,
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/
# 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/
-
- Regular
- Posts: 450
- Joined: Thu May 26, 2005 10:43 am
- Location: Bonn, Germany
- Contact:
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Actually it's really easy, just look at it once. It's much less complex than you think, and it saves time if you do it right the first time
Regards,
Garvin
Actually it's really easy, just look at it once. It's much less complex than you think, and it saves time if you do it right the first time
Regards,
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/
# 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/
-
- Regular
- Posts: 30
- Joined: Sat Dec 10, 2005 11:50 pm
- Contact:
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
If inside lang_XX.inc.pphj you have:
you can use this in your .tpl files:
Regards,
Garvin
If inside lang_XX.inc.pphj you have:
Code: Select all
define('YOUR_VAR', 'Blabla');
Code: Select all
{$CONST.YOUR_VAR}
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/
# 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/
-
- Regular
- Posts: 30
- Joined: Sat Dec 10, 2005 11:50 pm
- Contact:
So I was looking at /bulletproof/ tpl files and found index.tpl hold part of what I would use.
So for the site name and description I changed $blogTitle and $blogDescription with $CONST.CUST_LANG_TITLE and $CONST.CUST_LANG_DESC respectively and that worked perfectly.
For others reading this, don't forget to add the definitions to each language file.
With the following code though, it seems like I would have to call the definition from somewhere else. The question would be where would I change it for the site nav links?
Code: Select all
<!-- #serendipity_banner: this is the header area. it holds the blog title and -->
<!-- description headlines -->
<div id="serendipity_banner">
<h1><span class="{if $template_option.firbtitle == 'false'}in{/if}visible"><a class="homelink1" href="{$serendipityBaseURL}">{$head_title|@default:$blogTitle|truncate:80:" ..."}</a></span></h1>
<h2><span class="{if $template_option.firbdescr == 'false'}in{/if}visible"><a class="homelink2" href="{$serendipityBaseURL}">{$head_subtitle|@default:$blogDescription}</a></span></h2>
</div>
<div id="serendipity_below_banner"></div>
{if $template_option.sitenavpos == 'below'}
For others reading this, don't forget to add the definitions to each language file.
With the following code though, it seems like I would have to call the definition from somewhere else. The question would be where would I change it for the site nav links?
Code: Select all
<!-- #sitenav: this holds a list of navigational links which can be customized -->
<!-- in the theme configurator -->
<a name="skipnav"></a>
<div id="sitenav" class="snbelow">
<ul>
{foreach from=$navlinks item="navlink" name="navbar"}
<li class="{if $currpage==$navlink.href}currentpage{/if}{if $smarty.foreach.navbar.first} navlink_first{/if}{if $smarty.foreach.navbar.last} navlink_last{/if}"><a href="{$navlink.href}" title="{$navlink.title}">{$navlink.title}</a></li>
{/foreach}
</ul>
<!-- quicksearch option in the navigational link menu bar only when navbar is -->
<!-- above or below the banner -->
{if $template_option.sitenav_quicksearch == 'true'}
<form id="navbarsearchform" action="{$serendipityBaseURL}" method="get"><input type="hidden" name="serendipity[action]" value="search" /><input alt="{$CONST.QUICKSEARCH}" type="text" name="serendipity[searchTerm]" value="{$CONST.QUICKSEARCH}..." onfocus="if(this.value=='{$CONST.QUICKSEARCH}...')value=''" onblur="if(this.value=='')value='{$CONST.QUICKSEARCH}...';" /></form>
{/if}
</div>
{/if}
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
That's harder, because the title of nav links are maintained through the admin interface.
For that to use langauge abstraction, you'd actually need to edit the template's config.inc.php file and hardcode the navlink item names there. This is all a bit awkward to fill in.
Inside config.inc.pho you have this:
This is what you need to replace with constants, something like this:
Then inside your lang_XXX.php files you'd need this:
Then you have that constant differently for each language file, and the navlinks will fetch the constant from that file and put into the smarty $navlinks array by relaying it through that constant.
Regards,
Garvin
That's harder, because the title of nav links are maintained through the admin interface.
For that to use langauge abstraction, you'd actually need to edit the template's config.inc.php file and hardcode the navlink item names there. This is all a bit awkward to fill in.
Inside config.inc.pho you have this:
Code: Select all
for ($i = 0; $i < $template_loaded_config['amount']; $i++) {
$navlinks[] = array(
'title' => $template_loaded_config['navlink' . $i . 'text'],
'href' => $template_loaded_config['navlink' . $i . 'url']
);
Code: Select all
for ($i = 0; $i < $template_loaded_config['amount']; $i++) {
$navlinks[] = array(
'title' => constant('NAVLINK' . $i . 'TEXT'),
'href' => $template_loaded_config['navlink' . $i . 'url']
);
Code: Select all
@define('NAVLINK1TEXT', 'Your navitem 1 title');
Regards,
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/
# 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/
-
- Regular
- Posts: 30
- Joined: Sat Dec 10, 2005 11:50 pm
- Contact: