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:
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).
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):
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:
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:
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.
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?
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.
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 ?
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. I just did some experimenting and it looks like that’s what the extension does.
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.
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.
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.
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.
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).
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.
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).