7 of 9
7
Simple Translator (formerly known as Another Language Switcher)
Posted: 05 October 2007 12:37 PM   [ Ignore ]   [ # 109 ]  
Summer Student
Total Posts:  23
Joined  09-26-2006

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?

Profile
 
 
Posted: 06 October 2007 07:48 AM   [ Ignore ]   [ # 110 ]  
Lab Assistant
RankRank
Total Posts:  104
Joined  09-19-2006

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="?">more...</a>
   
{/exp:weblog:categories}
{if
:else}
   {exp
:weblog:entries weblog="articles" category="102"}
      
<h2>{title}</h2>
      
{summary}
      
<a href="?">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?

Profile
 
 
Posted: 22 October 2007 11:56 AM   [ Ignore ]   [ # 111 ]  
Grad Student
Rank
Total Posts:  92
Joined  11-11-2006

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>

Profile
 
 
Posted: 22 October 2007 09:00 PM   [ Ignore ]   [ # 112 ]  
Lab Assistant
RankRank
Total Posts:  104
Joined  09-19-2006

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!

Profile
 
 
Posted: 23 October 2007 01:18 AM   [ Ignore ]   [ # 113 ]  
Grad Student
Rank
Total Posts:  92
Joined  11-11-2006

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>

Profile
 
 
Posted: 24 October 2007 04:38 AM   [ Ignore ]   [ # 114 ]  
Grad Student
Rank
Total Posts:  65
Joined  06-06-2007

It doesn’t seem to work with Category custom fields. Can anyone confirm this?

If it doesn’t is this possible for the future?

Profile
 
 
Posted: 31 October 2007 11:14 AM   [ Ignore ]   [ # 115 ]  
Grad Student
Rank
Total Posts:  92
Joined  11-11-2006

Anyone got any ideas about how to go about making a bilingual site made with simple translator get indexed by search engines in both of it’s languages - or does it just happen?

Thanks for any ideas?
Lee

Profile
 
 
Posted: 19 November 2007 06:26 AM   [ Ignore ]   [ # 116 ]  
Grad Student
Rank
Total Posts:  65
Joined  06-06-2007

The “selected” class applied to current language does change if it’s a page using the pages module. If you navigate away to a different site page it does change though.

Profile
 
 
Posted: 19 November 2007 06:41 AM   [ Ignore ]   [ # 117 ]  
Grad Student
Rank
Total Posts:  65
Joined  06-06-2007

I’d also like to request the category custom fields switching. This would make menu titles a LOT easier.

Profile
 
 
Posted: 01 February 2008 10:41 AM   [ Ignore ]   [ # 118 ]  
Lab Assistant
RankRank
Total Posts:  140
Joined  07-20-2006

This looks like a fantastic extension - just what I am looking for!

Can anyone confirm whether it is compatible with the latest EE version (1.6.2)?

 Signature 

Web designer and EE Pro Network member

Profile
 
 
Posted: 13 February 2008 01:16 PM   [ Ignore ]   [ # 119 ]  
Lab Assistant
RankRank
Total Posts:  140
Joined  07-20-2006

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?

 Signature 

Web designer and EE Pro Network member

Profile
 
 
Posted: 14 February 2008 04:23 AM   [ Ignore ]   [ # 120 ]  
Lab Assistant
RankRank
Total Posts:  140
Joined  07-20-2006

And the answer is…

To get this to work I had to go into the extension’s settings page and click on ‘submit’ to accept the defaults.

 Signature 

Web designer and EE Pro Network member

Profile
 
 
Posted: 25 February 2008 06:21 AM   [ Ignore ]   [ # 121 ]  
Grad Student
Rank
Total Posts:  63
Joined  01-14-2008

Mark, is there any way to get this to display the specified language if its field content exists, and to display the default language’s field content if not? This would be useful in a site where there is not always a translation for 100% of the content, which I imagine happens more often than not.

EDIT: Oops. I feel silly now. smile I just did some experimenting and it looks like that’s what the extension does. smile

Profile
 
 
Posted: 26 February 2008 07:17 AM   [ Ignore ]   [ # 122 ]  
Grad Student
Rank
Total Posts:  63
Joined  01-14-2008

Ok, real question this time. :p Is there any way to have it pick up on related entries? For example, let’s say I have article-author (a relationship field) pointing to one entry, and article-author_jp (another relationship field) pointing to another entry altogether. The extension doesn’t seem to pick up and switch the field designated in the related_entries’ id=”” parameter, so it would always retrieve the fields from the entry designated in article-author, and never from article-author_jp.

Profile
 
 
Posted: 01 March 2008 06:24 AM   [ Ignore ]   [ # 123 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  120
Joined  02-21-2005

First I want to thank you for this really very useful extension. Although I am a real newbe in Expression Engine and I am absolutely no code-writer (I use Freeway to have my templates made) I managed to get it working. That says a lot about the way you made this.

But I do have some questions.

I cannot get my page validated. And I noticed exactly the same error on another page that uses your extension .

The validator says:

Line 142, Column 34: document type does not allow element "ul" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.
        
<
p><ul class="simple-translator"><li class="selected first"><a href="http://ww


The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "
<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

Another request, that might or might not be related.

Is it possible that for the next update you take away the hyphen in the part in the sourcecode that creates the style ? My software does not allow me to use something like ul.simple-translator (we must use ul.simpletranslator) So I had to add manually this part in my CSS stylesheet. There seems to be a very good reason why Freeway does not allow that, but I cannot explain that.


Hope to hear from you
best regards

Atelier

 Signature 

Atelier2

Atelier Voor Beeldhouwwerken

Profile
 
 
Posted: 04 March 2008 07:01 AM   [ Ignore ]   [ # 124 ]  
Grad Student
Rank
Total Posts:  63
Joined  01-14-2008
atelier2 - 01 March 2008 06:24 AM

First I want to thank you for this really very useful extension. Although I am a real newbe in Expression Engine and I am absolutely no code-writer (I use Freeway to have my templates made) I managed to get it working. That says a lot about the way you made this.

But I do have some questions.

I cannot get my page validated. And I noticed exactly the same error on another page that uses your extension .

The validator says:

Line 142, Column 34: document type does not allow element "ul" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.
        
<
p><ul class="simple-translator"><li class="selected first"><a href="http://ww


The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "
<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

I believe your problem is that a UL element should not be placed inside a P element. Generally a hierarchy would be UL -> LI -> P -> [text inside the P] (although the need for a P inside an LI is a matter of personal opinion and taste, I believe).

Profile
 
 
Posted: 04 March 2008 07:17 AM   [ Ignore ]   [ # 125 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  120
Joined  02-21-2005

Thanks for replying.

We found the solution, after a lot of trial and error. In this case it did help by using a script-action that removes the p-tag from the container. For more info please have a look here: link to discussion .

But the result is that the page gets validated, and that MSIE 6 and 7 renders the code as we want.

 Signature 

Atelier2

Atelier Voor Beeldhouwwerken

Profile
 
 
Posted: 19 March 2008 09:57 AM   [ Ignore ]   [ # 126 ]  
Grad Student
Avatar
Rank
Total Posts:  81
Joined  09-08-2006

I was wondering if any of you who use this extension already, how does Google spiders the alternate languages. Because the URLs are being obfuscated or just changed during access? Or maybe a search engine sitemap.xml could feature all links hardcoded with lang/_sk/ in their URLs (sk for slovak).

Any advice or info is welcome
Thank you

 Signature 

Stan Majerski
elemental media

Profile
 
 
   
7 of 9
7
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64492 Total Logged-in Users: 72
Total Topics: 81036 Total Anonymous Users: 33
Total Replies: 436076 Total Guests: 284
Total Posts: 517112    
Members ( View Memberlist )