Anybody know of a way to retain caching abilities even when using the Simple Translator?
I do not know of any way around this, at this time. I’m thinking there may be some way around this by inserting hidden segments into EE, without the front end user knowing. That’s where I would start looking.
Far from having any idea on how to implement this, but would’nt there be a way to have some control over the cached files?
Activate the cache for every template you like and Simple Translator adds one cache file per language and directs the user to these files.
Just throwing stuff around…
I have simple translator installed and working great. Most of my site is available in two languages. But I have one section – a list of links to articles in newspapers – that will have entries that are either japanese OR english, but not both. I.e., some articles are in japanese, and some articles are in english, but neither article is translated into the other language. So when viewing Articles, I want the Japanese switch to display a list of articles in Japanese, and the English switch to display the list of articles in English, but these are two separate lists.
In my first attempt to set this up, I put all the _ja fields into my ‘Article’ field group. My Japanese entries have all of the English fields left blank. The problem is, all the English articles show up on the Japanese page (since they don’t have a japanese translation).
In a second attempt, I created two categories for articles – one called ‘article’ and one called ‘article_japanese.’ I used a single set of fields for both articles, and set up the following in my category nav:
{if simple_language=="Japanese"}掲載記事 {if:else}Articles
This works in the nav, but of course the language switching, while it works, doesn’t take the user to the language-specific article page (i.e., when viewing the category ‘articles-japanese,’ I don’t know how to get it to both switch to English and display ‘articles’ (the english articles category page).
Any advice anyone?
Hi jducka1,
There are a few ways to do this. I would try something like this on your articles template, where category id 101 is the Japanese category, and 102 is the English (substitute your category ids, field names):
{if simple_language=="Japanese"}
{exp:weblog:entries weblog="articles" category="101"}
<h2>{title}</h2>
{summary}
<a href="http://?">more...</a>
{/exp:weblog:categories}
{if:else}
{exp:weblog:entries weblog="articles" category="102"}
<h2>{title}</h2>
{summary}
<a href="http://?">more ...</a>
{/exp:weblog:categories}
{/if}
Since this section is either/or for the language, the custom fields for the article weblog won’t have to be in both languages. Entries in English and Japanese use the default title field.
If you’re using categories for something else, you could do something similar using Mark Huot’s Custom Field Limiter, and instead of category=”101” you could create a drop-down custom field called article_lang with the options “English” and “Japanese”. Then limit the weblog entries tag using the ‘article_lang’ custom field:
{exp:weblog:entries weblog="articles" article_lang="English"}
Does that address the problem, or did I misunderstand the question?
I’ve made a simple 3 language site (http://www.chambres-charente.com) and used {exp:translator:simple} to switch languages. I’d like to have a country flag for each li but the inbuilt css hooks don’t allow for it and I’ve tried the ideas further back in the thread with no luck. Any chance of some css id hooks to style the li’s? Or am I missing something and it can be done?
Absolutely brilliantly simple implementation of crafting a multi language site - THANKS VERY MUCH Mark.
Cheers Lee
If it makes any difference I’m using this for my nav bar:
<div id=”menubar”> <ul> {if simple_language == "English"} <li>welcome</li> <li>rooms</li> <li>breakfast</li> <li>prices</li> <li>local area</li> <li>contact us</li> {if:elseif simple_language == "French"} <li>bienvenue </li> <li>chambres</li> <li>petit déjeuner</li> <li>tarifs</li> <li>environs</li> <li>coordonnées</li> {if:else} <li>welkom</li> <li>kamers</li> <li>ontbijt</li> <li>prijzen</li> <li>omgeving</li> <li>contactgegevens</li> {/if} </ul>
</div>
Hi leeaston,
I think you’re on the right track - I’d just change your menu a bit so you can add the id parameter to the ul tag:
<div id="menubar">
{if simple_language == "English"}
<ul id="en">
<li>welcome</li>
<li>rooms</li>
<li>breakfast</li>
<li>prices</li>
<li>local area</li>
<li>contact us</li>
</ul>
{if:elseif simple_language == "French"}
<ul id="fr">
<li>bienvenue </li>
<li>chambres</li>
<li>petit déjeuner</li>
<li>tarifs</li>
<li>environs</li>
<li>coordonnées</li>
</ul>
{if:else}
<ul id="nl">
<li>welkom</li>
<li>kamers</li>
<li>ontbijt</li>
<li>prijzen</li>
<li>omgeving</li>
<li>contactgegevens</li>
</ul>
{/if}
</div>
Then you can style your lists as you like:
ul#en li {
background-image: url(/images/flag_en.gif);
padding-left: 20px;
etc...
}
ul#fr li {
background-image: url(/images/flag_fr.gif);
padding-left: 20px;
etc...
}
ul#nl li {
background-image: url(/images/flag_nl.gif);
padding-left: 20px;
etc...
}
Hope that helps!
Hi bcartier,
sorry I probably shouldn’t have put the nav code, it’s not really what I’m trying to style. The code below is what is output by {exp:translator:simple}, I’m trying to style each li, but to do that they need individual id’s I think.
<ul class=”simple-translator”> <li class=”first”>English</li> <li class=”selected”>French</li> <li class=”last”>Dutch</li> </ul>
Well, I have it installed on 1.6.2 now, and it seems to be switching the content. Great!
However, the {exp:translator:simple} tag produces zero output.
I can work out the format of the language switching links, and have just manually appended a suffix, eg /lang/_ja to test it. I guess I can hard-code these links if I have to? (I need to style the language links individually anyway, so this might be the only way to go in any event.)
Still, it’s slightly worrying that the tag doesn’t work. Have I made a mistake with this (hard to see where!), or is there some other problem with the extension/EE 1.6.2 ?
Anyone?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.