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

I fail to understand one thing with my website and the navigation plugin.
Its a opensource theme i have downloaded and i try to edit the navigation look that is build upon 2 pictures.
( i suppose because it needs to expand. )

The navigation plugin can load one of the picture but it fails to load the second picture.
I will try to explain with code. ( i dont have a online website right now )

So my CSS is as follow.

Code:
/* topmenu */
div#topmenu{
   position:absolute;
   top:46px;
   right:0px;
   height:27px;
}

div#topmenu ul{
   padding:0px;
   margin:0px;
   list-style:none;
   float:left;
   font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;
}

div#topmenu li{
   float:left;
   display:block;
   margin:0 0 0 6px;
}

div#topmenu li a{
   float:left;
   display:block;
   position:relative;
   background:transparent url(../images/menu-r.png) 100% 0 no-repeat;
   height:27px;
   padding:0 5px 0 0;
   overflow:hidden;
   color:#202020;
   text-decoration:none;
   text-transform:uppercase;
   font-size:13px;
   font-weight:bold;
   line-height:27px;
}

div#topmenu li a span{
   display:block;
   background:url(../images/menu-l.png) 0 0 no-repeat;
   padding:0 10px 0 15px;
}

div#topmenu li a.current, div#topmenu li a:hover{
   background:url(../images/menu-r.png) 100% -28px no-repeat;
   text-decoration:none;
}

div#topmenu li a.current span, div#topmenu li a:hover span{
   background:url(../images/menu-l.png) 0 -28px no-repeat;
}

As you can see in the CSS i have under div#topmenu li a{ a picture and this one is loaded.
But there is also a picture under div#topmenu li a span{ this one is not loaded, see picture i attached, the span picture are supposed to span over the text.    
Here is my template for the menu.


PHP Code:
   <!-- topmenu -->
 
   <div id="topmenu">
 
     <ul>
    <!--<
a href=""><span>Services</span></a>--> // This one works because the <span> is included
        
<?php get_i18n_navigation(return_page_slug()); ?>
      </ul>
    </div>
    <!-- / topmenu --> 

What i fail to understand is where do i add <span> to the i18n_navigation


Many thanx for your help and im sorry to ask basic questions, im under a learning process.

/Dimi
Reply
(2015-04-28, 16:05:45)Dimi Wrote: What i fail to understand is where do i add <span> to the i18n_navigation

Either you adjust your CSS to work without additional <span> or you must use custom rendering for your navigation.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Greetings,

A new topic, the browser path to the sub-pages is giving me problems when I18N is enabled..

Am converting a wordpress site to GS.  Set up I18N and have used it many times.  However, this time am not using the I18N Navigation Menu features as am using the Zurb Foundation top bar menu.

The wordpress site has 3 levels and each level is part of the browser path.  For example getting to a level 3 page looks like this:
domainname.com/wholesale/shoes/mens

With I18N enabled only the parent without the grandparent is used and this works: domainname.com/shoes/mens

I need all 3 levels in order to match up with the wordpress site for the google history for the website.

When I disabled I18N all three paths are used.  With I18N enabled only 2 paths are used.

Is there an update I can make?

Thanks for any replies, I did some research and the I18N parameters for this general topic seemed to be specific to configuring the I18N Navigation Menu which I am not using rather than specifiying the number of parents for the browser URL path.

Many thanks in advance.
Reply
changing %parent%/%slug% to %parents%/%slug% didn't help ?
Reply
(2015-05-09, 19:13:08)morvy Wrote: changing %parent%/%slug% to %parents%/%slug% didn't help ?

Hi morvy,

Many thanks for your reply.  I've looked at the documentation for I18N and don't see where to make this update.  where please?

cheers
Reply
in administration, go to settings and there is custom permalink structure, i18n adds "parents" placeholder, I don't use it but I tried it a while ago and it worked for basic pages

http://get-simple.info/wiki/how_to:websi...y_seo_urls
Reply
Hello to all,

having a strange issue here;
- installed a fresh GS335 (and later older 334 too for a test) and I8N plugin.

Trying to see the best option for a (sub)navigation and testing I8N vs Child Menu.

What i need is to print only Sub-navigation links in one DIV and in the other DIV links to their pages.

Following the instruction it should work like this:
<?php get_i18n_navigation(return_page_slug(),1,99); ?>
But it does not print anything on the page.

What does work within I8N plugin is placing
- <?php get_i18n_navigation(return_page_slug(),0,99); ?> prints only Navigation,

or

- <?php get_i18n_navigation('index',0,99,I18N_SHOW_PAGES); ?>
and then I get the whole sitemap printed.

What i'm doing wrong here?

Thanx for any help,
Reply
you need to use I18N_SHOW_MENU Wink more info here:

http://mvlcek.bplaced.net/get-simple/mul...navigation
Reply
(2015-06-02, 23:56:50)alex_d Wrote: Following the instruction it should work like this:
<?php get_i18n_navigation(return_page_slug(),1,99); ?>

This will print the levels 1 to 99 (=2nd level and up) of the current page, i.e. the current page must be a top page with sub pages or one of the pages below the top level. It will only show pages which are marked as being in the menu.

See http://mvlcek.bplaced.net/get-simple/mul...v-top-left for more.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Thanx Martin & Morvy for the reply,

I have this now for the printing the sub navigation <?php get_i18n_navigation(return_page_slug(), 1, 1, true); ?>

and this  for the printing the pages <?php get_i18n_navigation(return_page_slug(), 2, 2, true); ?>

and it works now, will test further ..

Thanx once again !

Alex
Reply
is it possible to use components to breadcrumbs?
Reply
you can use return_i18n_breadcrumbs and do whatever you need with the array it returns
Reply
(2015-06-07, 05:27:38)Oleg06 Wrote: is it possible to use components to breadcrumbs?

I'm not sure I understand the question.

Instead of using

Code:
get_i18n_breadcrumbs(return_page_slug());

you can use something like

Code:
$breadcrumbs = return_i18n_breadcrumbs(return_page_slug());
foreach ($breadcrumbs as $item) {
  // get a specific component for this page:
  get_i18n_component('breadcrumb_'.$item['url']);
  // or do anything else with $item['url'], $item['parent'], $item['menu'] and $item['title']
};

in the template.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I would like to be able to use https://developers.google.com/structured...hl=en&rd=1 without interfering with the code of the plugin
Reply
well, maybe this code will help you (it's also for structured data), there are some hacks for slugs and for News Manager breadcrumbs ..


Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); } ?>
<?php if(return_page_slug()!="index") {

$links = return_i18n_breadcrumbs(return_page_slug());
$separator = ' <i class="fa fa-caret-right"></i> ';
?>
<div class="breadcrumbs">
    <div class="container" itemscope itemtype="http://schema.org/BreadcrumbList">
        <span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
            <a href="<?php echo find_url('index',null); ?>" title="Domov" itemprop="item">
                <i class="fa fa-home fa-lg"></i><span class="visuallyhidden" itemprop="name"><?php get_site_name(); ?></span>
            </a><?php echo $separator; ?>
            <meta itemprop="position" content="1"/>
        </span>
        <?php
        $n = count($links);
        for($i=0; $i<$n; $i++) {
            if($links[$i]['parent']!="") $links[$i]['parent'] = "/".$links[$i]['parent'];
            if($i==$n-1 && return_page_slug()!= "blog" || nm_is_main()) $separator = "";
            if($links[$i]['menu']!="") $title = $links[$i]['menu'];
            else $title = $links[$i]['title'];
            echo '<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">',
                    '<a href="'.rtrim($SITEURL,"/").$links[$i]['parent'].'/'.$links[$i]['url'].'" itemprop="item" title="'.$links[$i]['title'].'">',
                        '<span itemprop="name">'.$title.'</span>',
                    '</a>'.$separator,
                    '<meta itemprop="position" content="'.($i+2).'"/>',
                '</span>',"\n";
        }
        if(return_page_slug() == "blog") {
            if(nm_is_single()) {
                $all = nm_get_posts();
                foreach ($all as $post) {
                    if($post->slug == nm_post_slug(false)) {
                        echo '<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">',
                            '<a href="'.nm_post_url(false).'" itemprop="item" title="'.$post->title.'">',
                            '<span itemprop="name">'.$post->title.'</span>',
                            '</a>',
                            '<meta itemprop="position" content="'.($i+2).'"/>',
                        '</span>';
                    }
                }
            }
        }
        ?>
    </div>
</div>
<?php } ?>
Reply
mvlcek, i have found an issue:

When page is private, i18n_navigation plugin do not stores it in cache and when  return_i18n_structure function is called there are no private pages.
In GS private pages are accessible when user is logged in so it should return private pages too.

Additionally when page is private and you set menu order this change is saved to page xml file, but when you again start to edit this page menu order is 0 because there is no private pages in i18n_navigation saved structure.

I think internally i18n_pages should return all pages, including private ones, on frontend it can stay as it is.
http://flexphperia.net - my portfolio
Reply
:-) Thanks
Reply
Is there a tutorial on this plug-in for the non-technical user? I have been able to build multiple language versions of the content pages, but the sidebar is always in English. I am using the default Innovation theme. I found the call to get_component in the theme file sidebar.inc.php and changed the original call to: <?php get_i18n_component('sidebar'); ?>. I went to the "Edit theme components" page, but I can see no way to build sidebar versions for different languages. Please explain.

Also, how can I add links to the header that allow the user to switch the language of the current page?
Reply
I was able to solve these problems.  For language-specific sidebar, I went to "Edit theme components" and added additional sidebar versions: "sidebar_fr", "sidebar_ru", etc. There is guidance on the author's site.

The set-language links in the header required a custom style added to the header css. Using "Edit theme" to edit the theme files. In style.css, add the following to define the "setla" element (adjust as desired):

Code:
/* HEADER: language setting */
header setla {
    position:absolute;
    top:0;
    right:0;
    font-size:10px;
}
header setla a:link,
header setla a:visited {
    color:white;
    text-decoration:none;
}

Then in header.inc.php, add the following inside the header => wrapper section, e.g.:

Code:
<setla>
<a href="<?php echo htmlspecialchars(return_i18n_setlang_url('en')); ?>">english</a>
<a href="<?php echo htmlspecialchars(return_i18n_setlang_url('ru')); ?>">русский</a>
<a href="<?php echo htmlspecialchars(return_i18n_setlang_url('fr')); ?>">francais</a>
</setla>
Reply
I am using this plugin in one section of my site, where I would also like to have a link to the english and german version.

Right now in my sidebar i have this:

Code:
<div align="left"><a href="<?php echo htmlspecialchars(return_i18n_setlang_url('de')); ?>">deutsch</a> | <a href="<?php echo htmlspecialchars(return_i18n_setlang_url('en')); ?>">english</a></div>

Is it possible to show this link only if the given page is availible in the other language,too?

I think it should be possible to create some php if-if-not-structure... right? Smile

Have a nice weekend!
Reply
(2015-07-17, 22:52:19)stwneu Wrote: I am using this plugin in one section of my site, where I would also like to have a link to the english and german version.

Right now in my sidebar i have this:



Code:
<div align="left"><a href="<?php echo htmlspecialchars(return_i18n_setlang_url('de')); ?>">deutsch</a> | <a href="<?php echo htmlspecialchars(return_i18n_setlang_url('en')); ?>">english</a></div>

Is it possible to show this link only if the given page is availible in the other language,too?

Use return_i18n_available_languages(return_page_slug()), e.g.:
Code:
<div align="left">
<?php $langs = return_i18n_available_languages(return_page_slug()); ?>
<?php if (in_array('de', $langs)) { ?>
 <a href="<?php echo htmlspecialchars(return_i18n_setlang_url('de')); ?>">deutsch</a>
<?php } ?>
<?php if (in_array('de', $langs) && in_array('en', $langs)) { echo '|'; } ?>
<?php if (in_array('de', $langs)) { ?>
  <a href="<?php echo htmlspecialchars(return_i18n_setlang_url('en')); ?>">english</a>
<?php } ?>
</div>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Is it necessary to wrap each i18n navigation call inside htmlspecialchars?
Reply
It seems that "excluding" a page from being added to the menu doesn't work properly, on my website: helgesverre.com under the "contact" menu item i have marked the thank you page as "toggle visibility in menu" as Off, but it still shows up (tested both when logged in and in incognito mode), is there something I have missed?

Code I am using:

PHP Code:
<nav id="nav">
    <
ul>
 
       <?php get_i18n_navigation('index'099I18N_SHOW_PAGES); ?>
    </ul>
</nav> 
Web Developer
Plugins: GS Plugin Installer | Referrer Blocker | Password Protect
Reply
(2015-08-01, 05:38:11)HelgeSverre Wrote: It seems that "excluding" a page from being added to the menu doesn't work properly, on my website: helgesverre.com under the "contact" menu item i have marked the thank you page as "toggle visibility in menu" as Off, but it still shows up (tested both when logged in and in incognito mode), is there something I have missed?

Code I am using:



PHP Code:
<nav id="nav">
 
   <ul>
 
       <?php get_i18n_navigation('index'099I18N_SHOW_PAGES); ?>
    </ul>
</nav> 

See http://mvlcek.bplaced.net/get-simple/mul...navigation: set the fourth parameter to I18N_SHOW_MENU.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
(2015-08-01, 05:51:43)mvlcek Wrote:
(2015-08-01, 05:38:11)HelgeSverre Wrote: It seems that "excluding" a page from being added to the menu doesn't work properly, on my website: helgesverre.com under the "contact" menu item i have marked the thank you page as "toggle visibility in menu" as Off, but it still shows up (tested both when logged in and in incognito mode), is there something I have missed?

Code I am using:




PHP Code:
<nav id="nav">
 
   <ul>
 
       <?php get_i18n_navigation('index'099I18N_SHOW_PAGES); ?>
    </ul>
</nav> 

See http://mvlcek.bplaced.net/get-simple/mul...navigation: set the fourth parameter to I18N_SHOW_MENU.

Beautiful!
It's working now, thanks!
Web Developer
Plugins: GS Plugin Installer | Referrer Blocker | Password Protect
Reply




Users browsing this thread: 5 Guest(s)