Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support for multilanguage sites, Internationalization (I18N)
Hi,

I'm trying to get your plugin installed and followed the rules you have set out for this('get_' script changes)
but when adding the files to the plugin-folder the complete site is unreachable?
Main page shows no items except for theme items and site name
Trying to login is impossible?

Are there certain dependencies for the installation to work
or plugins that might conflict to make it not work.

-GS 3.1
-Innovation theme
-localtesting
Reply
I18N version 3.0.1:
  • fixes some bugs with sitemap generation and viewing (thanks @AlexStarnavsky for bug reports)
  • italian translation (thanks to @alez)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:I18N version 3.0.1:
  • fixes some bugs with sitemap generation and viewing (thanks @AlexStarnavsky for bug reports)

Thank you very much for your job!
Reply
File of the Russian language, which is equipped with plug-in - is not correct.
I made a complete correct translation of this plugin on the Russian language.

The file is attached.
Reply
Hello!

I'm using i18n search for listing news on a site called "aktuell". When i try to split the news, so that only the news in the current selected language are displayed, i'm getting german (default language) news in search results too (while /?setlang=en).



German news got following tags:
news, german

English news:
news, english

... im using this code in german "aktuell":
(% searchresults tags:"news german" numWords:-1 order:reverseurl HEADER: %)
(% searchrss title="News RSS Feed" name="news" tags:"news german" numWords:30 %)

- works fine

in english "aktuell":
(% searchresults tags:"news english" numWords:-1 order:reverseurl HEADER: %)
(% searchrss title="News RSS Feed" name="news" tags:"news english" numWords:30 %

... no search result.



With just one tag "news" i'm getting german news listed too (bad), if english laguage is selected.
No english news when german is selected (fine - but useless because i'm getting german news listed while /?setlang=en).

Please - need help!!! The whole site depends on multilanguage and client wants the news splitted.

Thanks in advance,
Rob
:-)

ps.: please excuse my bad english today - this issue is driving me (and my boss) mad.
Reply
Robzilla Wrote:Hello!

I'm using i18n search for listing news on a site called "aktuell". When i try to split the news, so that only the news in the current selected language are displayed, i'm getting german (default language) news in search results too (while /?setlang=en).

The problem is that I18N Search currently uses only the tags/keywords from the default language.
Instead of using a tag for the language, use the language itself:

German news:
Code:
(% searchresults tags:"news" lang:de numWords:-1 order:reverseurl HEADER: %)
(% searchrss title="News RSS Feed" name="news" tags:"news" lang:de numWords:30 %)

English news:
Code:
(% searchresults tags:"news" lang:en numWords:-1 order:reverseurl HEADER: %)
(% searchrss title="News RSS Feed" name="news" tags:"news" lang:en numWords:30 %

Make sure that the default language on the pages view is set correctly.
You need to provide tags only for the default language's pages.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Thank you thank you thank you!!!
Rob
:-)
Reply
Hi mvlcek,

Used your 'Multiple independent menus' as described here http://mvlcek.bplaced.net/multi-level-na...-multiple/ together with the navigation as a dropdown menu, great explanation & plugin!

But how te set the link from the menu without dummy root pages? .htaccess?
Example : from www.domain.nl/menu1/contact/ to www.domain.nl/contact/

And the active dropdown menu has no 'currentpath' class.
Reply
possible in the site settings in the field Custom Permalink Structure: specify % slug%
Reply
@Oleg06

THX! %slug% (%slug%/ in my case) does the job !
Reply
I think I may have found a way to use your custom navigation rendering to (albeit inelegantly) patch up the problem of level 3 and lower directory links if the permalink struture is %parent%/%slug% (the problem being from GetSimple itself, not this plugin of course).

For example, for this structured site:

Home
Menu 1
- Subdir 1-1
- - Subdir 1-1-1
- - Subdir 1-1-2
- - Subdir 1-1-3
- Menu 1-2
- Menu 1-3
Menu 2
Menu 3

The link for "Subdir 1-1-1" is "/subdir-1-1/subdir-1-1-1" instead of "menu-1/subdir-1-1/subdir-1-1-1". To fix this, with your custom rendering example (thanks again for providing this feature!), change

Code:
<?php echo htmlspecialchars($item->link); ?>

to

Code:
<?php
  if($item->parent=='subdir-1-1') $subDir = 'menu-1/';
  else $subDir = '';

  // this displays the link in its entirety
  if($item->parent!=='') {
    get_site_url(); echo $subDir; echo htmlspecialchars($item->parent); echo '/'; echo htmlspecialchars($item->slug); echo '/'; }
  else { get_site_url(); echo htmlspecialchars($item->slug); }
?>

The code basically says "if the current item's parent is level X, include level X-1 in the url". The general solution for further levels is this:
Code:
<?php
  // level 3 links - change lv2-# and lv1-# to the slugs of your respective levels
  if($item->parent=='lv2-1') $subDir = 'lv1-1/';
  elseif($item->parent=='lv2-1') $subDir = 'lv1-2/';
  // level 4 links
    elseif ($item->parent=='lv3-1') $subDir = 'lv1-1/lv2-1/';
    elseif ($item->parent=='lv3-2') $subDir = 'lv1-2/lv2-2/';
  // end of levels - add your extra levels as according with the given examples
  else $subDir = '';

  // don't alter this - it echos the link in its entirety
  if($item->parent!=='') {
    get_site_url(); echo $subDir; echo htmlspecialchars($item->parent); echo '/'; echo htmlspecialchars($item->slug); echo '/'; }
  else { get_site_url(); echo htmlspecialchars($item->slug); }
?>

I wanted to post it here first to see if you thought it was a valid solution, mvlcek. If it is then I'll make a tutorial out of it to better explain its use and hopefully tidy up the code a bit more.
Reply
mvlcek Wrote:
yojoe Wrote:Mvlcek: does your menu plugin allow to display only slugs of a certain parent ?
Supposing yes, how should I call it ?
I doubt this is going to work: <?php get_i18n_navigation(return_page_slug("parent-url-name")); ?>

If your parent slug is "parent-url-name" and it is on the topmost level (hierarchy level 0), you should be able to display all children (hierarchy level 1) like this:

Code:
<?php get_i18n_navigation("parent-url-name", 1, 1); ?>

Or replace the third parameter with null to see the whole subtree.

I am trying this but my menu doesn't show the third level child pages. I tried substituting the third parameter with null and 0 and 99 but it didn't work.
<?php get_i18n_navigation("parent-url-name", 1, 0); ?>
<?php get_i18n_navigation("parent-url-name", 1, null); ?>
<?php get_i18n_navigation("parent-url-name", 1, 99); ?>

How do I get to show my third level menu as drop down in my second level topmenu. My css is correct since if I change the second parameter to 0 it shows me the root level menu with the second level as drop downs.
Reply
andyash Wrote:I am trying this but my menu doesn't show the third level child pages. I tried substituting the third parameter with null and 0 and 99 but it didn't work.

My previous answer was incorrect :-(

The code to show all levels independent of the current page should be:
Code:
<?php get_i18n_navigation("parent-url-name", 1, 99, I18N_SHOW_MENU); ?>
(third parameter 99 and additional parameter I18N_SHOW_MENU, as otherwise only the children of the given page are shown)

And if you want the current page/path to be marked with classes (current, currentpath), you should use the following code:
Code:
<?php
  $bc = return_i18n_breadcrumbs(return_page_slug());
  get_i18n_navigation($bc[0]['url']=='parent-url-name'?return_page_slug():'parent-url-name',1,99,I18N_SHOW_MENU);
?>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
This worked great. Thanks.
Reply
Hi folks,

My aim is to create a menu that shows the full hierarchy for the current page: all children of the current page and all parents of the current page, back to the top level parent. But not the other top level menu items that are not part of the hierarchy of the current page.

Is that possible with I18N navigation plugin?

Thanks.
Reply
Cerulean Wrote:Hi folks,

My aim is to create a menu that shows the full hierarchy for the current page: all children of the current page and all parents of the current page, back to the top level parent. But not the other top level menu items that are not part of the hierarchy of the current page.

Is that possible with I18N navigation plugin?

Yes, you have to use custom rendering, keep track of the current menu level and only display the entries returned from return_i18n_breadcrumbs(return_page_slug()), if the level is less than that of the current page.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:Yes, you have to use custom rendering

Oh wow, custom rendering is a powerful feature! Thanks for the advice.
Reply
I am currently at a bit of a loss with regards to setting up different language versions on a current project that do not contain the exact same pages.

On a previous project I used <?php get_i18n_navigation(return_page_slug(), 0, 100, I18N_SHOW_LANGUAGE); ?> on the standard I18n navigation that worked perfectly in combination with a language switch to the root using ?setlang=en. Only the smaller number of pages for that language showed up after clicking the language switch link.

However this site uses a pulldown menu + a 2nd independent navigation in the sidebar.

Looking at Martin Vlcek's website I reasoned the correct syntax should be <?php get_i18n_navigation(return_page_slug(),0,4,I18N_FILTER_MENU | I18N_FILTER_LANGUAGE); ?> for the pulldown menu.

And <?php $bc = return_i18n_breadcrumbs(return_page_slug()); get_i18n_navigation($bc[0]['url']=='sidebar-navigatie'?return_page_slug():'sidebar-navigatie',1,99,I18N_FILTER_MENU | I18N_FILTER_LANGUAGE);?> for the sidebar menu.

Yet upon switching the language it shows all the navigational links, in this case 3 German ones and the rest from the default Dutch. Which is not what I want obviously.

When I click on one of the German links all the Dutch links dissappear and only the German ones remain. That is what I want!

How can I make sure that when I switch the language from Dutch to German, only the actually existing German pages show up, and not the Dutch ones filling the gaps as it where?

From reading Martin's explanation on his website I thought the filter method used above would do the job, but apparently not.

Hope somebody can help me out with this.

Thanks in advance!
Reply
Hello,

I have a little problem.

I have set the fancy URLs to include the %language% slug. Also I have added a htaccess rule to show the /en/ content when accessing / (without redirecting).

The problem is all links obviously still contain the /en/ slug, is there a way to remove the slug for the main language?
Reply
reitermarkus Wrote:The problem is all links obviously still contain the /en/ slug, is there a way to remove the slug for the main language?

You can also use the placeholder %nondefaultlanguage% for languages other than the default language. You have to change the rules in your .htaccess appropriately.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Have been experimenting further in the meantime, switching positions on the filters (first language, then menu), but that doesn't seem to make a difference.

I switch the language using a setlanguage link that points to the homepage, so /?setlanguage=de in this case. The settings I am using on my 2 menu's are in my previous post.

However instead of just showing the actually existing pages in German, it shows the german pages PLUS the default Dutch ones that aren't available in German.

Subsequently clicking on a German page WILL then show only the actually available German pages but I cannot seem to make the language switch point to the just-german pages.

What am I doing wrong?
Reply
Draxeiro Wrote:I switch the language using a setlanguage link that points to the homepage, so /?setlanguage=de in this case. The settings I am using on my 2 menu's are in my previous post.

(it should rather be ?setlang=de - but see below)

Draxeiro Wrote:However instead of just showing the actually existing pages in German, it shows the german pages PLUS the default Dutch ones that aren't available in German.

Subsequently clicking on a German page WILL then show only the actually available German pages but I cannot seem to make the language switch point to the just-german pages.

Do you include the language in the URL? like /de/slug?

If you use fancy URLs with %language% or %nondefaultlanguage%, setlang won't have an effect, as you have to use a specific language URL instead, i.e. a link /nl/slug?setlang=de would be translated by your .htaccess to /index.php?id=slug&lang=nl&setlang=de, which will show the dutch page and dutch navigation (but maybe with german menu texts?)

Just use the following link instead:
Code:
<a href="<?php echo htmlspecialchars(return_i18n_setlang_url('de')); ?>">deutsch</a>
which translates to /de/slug (or similar depending on your fancy URL setting).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:
Draxeiro Wrote:However instead of just showing the actually existing pages in German, it shows the german pages PLUS the default Dutch ones that aren't available in German.

Subsequently clicking on a German page WILL then show only the actually available German pages but I cannot seem to make the language switch point to the just-german pages.

Do you include the language in the URL? like /de/slug?

If you use fancy URLs with %language% or %nondefaultlanguage%, setlang won't have an effect, as you have to use a specific language URL instead, i.e. a link /nl/slug?setlang=de would be translated by your .htaccess to /index.php?id=slug&lang=nl&setlang=de, which will show the dutch page and dutch navigation (but maybe with german menu texts?)

Just use the following link instead:
Code:
<a href="<?php echo htmlspecialchars(return_i18n_setlang_url('de')); ?>">deutsch</a>
which translates to /de/slug (or similar depending on your fancy URL setting).

I'm not using any kind of fancy url setting (didn't know that was possible actually), so I was and am literally using /?setlang=de or index/?setlang=de (makes no difference I think) as the link to the German language pages.

Did that on another site too, but there I used your regular menu code instead of the call for using a pulldown (so <?php get_i18n_navigation(return_page_slug(), 0, 100, I18N_SHOW_LANGUAGE); ?> as the menu call), and there it works like a charm: only shows the available pages in that language.

But here, so far no dice, also while using your <a href="<?php echo htmlspecialchars(return_i18n_setlang_url('de')); ?>">deutsch</a> link. That yields the same result as the /?setlang=de link: showing all the pages INCLUDING the german ones. And if I then click on one of the german pages only those are left.

From that previous site I just mentioned and your answer I know this should be possible but I cannot really understand what is going wrong...

By the way, if I would want to use %language% or %nondefaultlanguage%? Should that be set up in the permalink field or rather somewhere in the htaccess file? Tried it in the permalink field but then it couldn't find the pages with the _de addition anymore.
Reply
Draxeiro Wrote:However instead of just showing the actually existing pages in German, it shows the german pages PLUS the default Dutch ones that aren't available in German.

Subsequently clicking on a German page WILL then show only the actually available German pages but I cannot seem to make the language switch point to the just-german pages.

This happens, if you switch to german on a page that does not have a german version.

See http://mvlcek.bplaced.net/ (which currently works like this, but hides sub pages - I18N_FILTER_MENU | I18N_FILTER_LANGUAGE | I18N_FILTER_CURRENT):
  • if you switch the language on the index page (which has a german version), it will work as you want it to work
  • if you go to e.g. getsimple (which has no german version) on the english site and then switch to german, it will not find a german version and show the english page, thus the language is english and the english menu is shown. The same happens if you manually switch to a non-existing language, e.g. /?setlang=fr.
You have to make sure that the set language links link to existing pages, e.g. always to index, if this page exists in all languages.

Draxeiro Wrote:By the way, if I would want to use %language% or %nondefaultlanguage%? Should that be set up in the permalink field or rather somewhere in the htaccess file? Tried it in the permalink field but then it couldn't find the pages with the _de addition anymore.

See here.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:This happens, if you switch to german on a page that does not have a german version.

See http://mvlcek.bplaced.net/ (which currently works like this, but hides sub pages - I18N_FILTER_MENU | I18N_FILTER_LANGUAGE | I18N_FILTER_CURRENT):
  • if you switch the language on the index page (which has a german version), it will work as you want it to work
  • if you go to e.g. getsimple (which has no german version) on the english site and then switch to german, it will not find a german version and show the english page, thus the language is english and the english menu is shown. The same happens if you manually switch to a non-existing language, e.g. /?setlang=fr.
You have to make sure that the set language links link to existing pages, e.g. always to index, if this page exists in all languages.

Strange thing is that I had done it exactly the way you suggest and then it didn't work. As this is also the way I had done it on that other website.

Just tried it again, and now it does work!

However I did notice the language switch for the default language on the pages tab was suddenly back on the out-of-the-box 'de' instead of 'nl' I set and saved it to so maybe that was confusing it...

In any case, things seem to work fine now. Good to know that I was basically doing everything right (with the filter commands and language switch link), but odd that it didn't seem to work initially.
Reply




Users browsing this thread: 1 Guest(s)