We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Simple Translator (formerly known as Another Language Switcher)

Development and Programming

Ingmar Greil's avatar
Ingmar Greil
29,243 posts
about 18 years ago
Ingmar Greil's avatar Ingmar Greil
I’ve PM’d you but my PM sent messages folder is reporting being empty, which is odd.

Not at all. The default is not to store outgoing messages.

       
deckard97's avatar
deckard97
137 posts
17 years ago
deckard97's avatar deckard97

Thanks Mark for this extension.

Anybody know of a way to retain caching abilities even when using the Simple Translator?

I just found out (and it’s logical) that the language switch is not possible on the templates where I had enabled the cache.

?

thanks

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot
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.

       
deckard97's avatar
deckard97
137 posts
17 years ago
deckard97's avatar deckard97

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…

       
jducka1's avatar
jducka1
12 posts
17 years ago
jducka1's avatar jducka1

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?

       
Brent Cartier's avatar
Brent Cartier
87 posts
17 years ago
Brent Cartier's avatar Brent Cartier

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?

       
leeaston's avatar
leeaston
634 posts
17 years ago
leeaston's avatar leeaston

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>

       
Brent Cartier's avatar
Brent Cartier
87 posts
17 years ago
Brent Cartier's avatar Brent Cartier

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!

       
leeaston's avatar
leeaston
634 posts
17 years ago
leeaston's avatar leeaston

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>

       
NKT com's avatar
NKT com
124 posts
17 years ago
NKT com's avatar NKT com

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

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

       
leeaston's avatar
leeaston
634 posts
17 years ago
leeaston's avatar leeaston

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

       
NKT com's avatar
NKT com
124 posts
17 years ago
NKT com's avatar NKT com

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.

       
NKT com's avatar
NKT com
124 posts
17 years ago
NKT com's avatar NKT com

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

       
MID's avatar
MID
166 posts
17 years ago
MID's avatar MID

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)?

       
MID's avatar
MID
166 posts
17 years ago
MID's avatar MID

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?

       
First 6 7 8 9 10 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.