Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support for multilanguage sites, Internationalization (I18N)
Electabuzz Wrote:Hello guys Smile.
This plugin is amazing, however, i found 2 bugzya Smile

The first one is that on the "View All Pages (I18N)" menù, when you click to view a page that is translated (and thus has the lang var) the url comes up as: sum.pin?id=gallery?lang=de while the correct would be sum.pin?id=gallery&lang=de. So it has to check if the link has more parameters and append with & instead of ?.

I'll fix this (I'm using fancy urls and you are the first to find that bug).

Electabuzz Wrote:Another bug, this one really annoys me, is that when you're browsing a page in another language that is not the default, the links doesn't have the lang parameter, so the user is forced to click the language for every link, while the expected behaviour is when the user click a language it should always append the language parameter, even if there's no translated version for the current page, because its up to the i18n loader to determine whether a page doesnt have a translated counterpart and fallback to the default one, but the lang parameter should only stop of being passed when the user clicks the default language, otherwise it should only be passed, and when a page has a translations it's displayed, otherwise it falls back.

It is intentional that there is no language parameter, as the I18N plugin selects the language automatically based on the user's language settings in his browser.

You can let the user permanently (for the session) switch the language by providing links with e.g. ?setlang=de, see my example site http://mvlcek.bplaced.net.

Or you can display a page in a specific language using the parameter ?lang=de (only for that request).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek,

Is there a way I can call a (sub) menu starting from a given parent? I didn't find such an option in the documentation. I could use such a custom sub nav for a current project.

-----

I call the top navigation on a site with
Code:
<?php get_i18n_navigation(return_page_slug(),0,0); ?>

and, for some reason, I never had a real look at the markup generated for the top menu. I'm now seeing that the complete menu is output with the sub entries being simply commented out. I'm not saying it's a huge increase in page size, but for my site which has quite a few sub pages, the commented out markup amounts to several kB... I'm sure you've got a reason for doing it this way? Just out of interest, what is the reason?
Reply
polyfragmented Wrote:Is there a way I can call a (sub) menu starting from a given parent? I didn't find such an option in the documentation. I could use such a custom sub nav for a current project.

If you want to show all children of top-level page my-page, use one of
Code:
# all children:
get_i18n_navigation('my-page',1,1);
# whole sub menu tree, all entries shown
get_i18n_navigation('my-page',1,99,I18N_SHOW_MENU);
# sub menu tree, only path to page and children of page shown:
get_i18n_navigation('any-page-in-sub-menu-tree',1,99);
Adjust the second parameter (minimum level), if my-page is not a top-level entry.

polyfragmented Wrote:I'm now seeing that the complete menu is output with the sub entries being simply commented out. I'm not saying it's a huge increase in page size, but for my site which has quite a few sub pages, the commented out markup amounts to several kB... I'm sure you've got a reason for doing it this way? Just out of interest, what is the reason?

Maybe you patched the plugin or have two get_i18n_navigation calls in your template, because the original I18N plugin doesn't output commented out menu entries.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:If you want to show all children of top-level page my-page, use one of
Code:
# all children:
get_i18n_navigation('my-page',1,1);
# whole sub menu tree, all entries shown
get_i18n_navigation('my-page',1,99,I18N_SHOW_MENU);
# sub menu tree, only path to page and children of page shown:
get_i18n_navigation('any-page-in-sub-menu-tree',1,99);
Adjust the second parameter (minimum level), if my-page is not a top-level entry.
Thanks!

mvlcek Wrote:Maybe you patched the plugin or have two get_i18n_navigation calls in your template, because the original I18N plugin doesn't output commented out menu entries.
D'oh! Nevermind...
Reply
I18N version 1.5:
  • fixes a bug where the view-link did not work with fancy-urls off
  • adds helper functions find_i18n_url, return_i18n_lang_url and return_i18n_setlang_url - see here for more information
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Hello,

Using i18n v1.5 (also evident in v1.4).

Following your advice in another thread, I'm having some problems with get_i18n_content().
  • get_i18n_content($slug) returns an error (undefined function return_i18n_data() in plugins/i18n_base.php on line 207)
  • get_i18n_content($slug,true) works as intended, provided that $slug is a valid slug, otherwise the same error
I'm doing my own file_exists() check before calling get_i18n_content(), in order to provide default content. Can I get get_i18n_content() to give me a known default value if $slug doesn't exist ? (Or is that what return_i18n_data() is supposed to be doing ?)
--
Nick.
Reply
hameau Wrote:Hello,

Using i18n v1.5 (also evident in v1.4).

Following your advice in another thread, I'm having some problems with get_i18n_content().
  • get_i18n_content($slug) returns an error (undefined function return_i18n_data() in plugins/i18n_base.php on line 207)
  • get_i18n_content($slug,true) works as intended, provided that $slug is a valid slug, otherwise the same error
I'm doing my own file_exists() check before calling get_i18n_content(), in order to provide default content. Can I get get_i18n_content() to give me a known default value if $slug doesn't exist ? (Or is that what return_i18n_data() is supposed to be doing ?)

I have to check this.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I18N version 1.5.1 fixes a problem, when the user agent (e.g. RSS client) sends no HTTP_ACCEPT_LANGUAGE header.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I18N version 1.5.2 fixes a bug in get_i18n_content.

The functions get_i18n_content and get_i18n_component now return true if the page or component was found. You can use this to display a default content, if no content was output.

Example: a page might have a custom sidebar, which is stored in the component sidebar-slug, where slug is the slug of the current page. If there is no custom sidebar, display the component sidebar:
Code:
<?php get_i18n_component('sidebar-'.return_page_slug()) || get_i18n_component('sidebar'); ?>

Example: a page might have a custom sidebar, which is stored in the content of page slug-sidebar (this way you have a WYSIWYG editor), where slug is the slug of the current page. If there is no custom sidebar, display the component sidebar:
Code:
<?php get_i18n_content(return_page_slug().'-sidebar') || get_i18n_component('sidebar'); ?>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:... fixes a bug in get_i18n_content.
...
... get_i18n_content and get_i18n_component now return true ...
Good stuff – timely and effective support once again : thanks!
--
Nick.
Reply
mvlcek,

thanks to your DynPages plugin and this plugin here, I can easily include a complete sitemap into a page. Yet I'm facing a problem with it:

I can't figure out how to only display public pages (not set to 'private').

I've consulted your navigation documentation page and currently have this call:

Code:
<?php get_i18n_navigation('index',0,99,I18N_SHOW_PAGES); ?>

which produces a hierarchical sitemap with all children open. That's fine, but private pages still show up.

Suggestions?
Reply
polyfragmented Wrote:mvlcek,

thanks to your DynPages plugin and this plugin here, I can easily include a complete sitemap into a page. Yet I'm facing a problem with it:

I can't figure out how to only display public pages (not set to 'private').

I've consulted your navigation documentation page and currently have this call:

Code:
<?php get_i18n_navigation('index',0,99,I18N_SHOW_PAGES); ?>

which produces a hierarchical sitemap with all children open. That's fine, but private pages still show up.

Suggestions?

I wondered when this would come up. Currently the navigation ignores the private flag - instead it should ignore the private pages. I will fix it.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I18N version 1.6:
  • offers an enhanced navigation structure view - you can show/hide a page in the menu and toggle its private flag.
  • honors the private flag when showing a sitemap
  • can display a sitemap with titles instead of menu texts (use I18N_SHOW_TITLES instead of I18N_SHOW_PAGES)
  • new function return_i18n_component($slug)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:honors the private flag when showing a sitemap
Thanks a bunch, that helps if you're setting up a site structure in one go, but content is still missing from some pages. Or a page isn't ready yet and still worked on.
Reply
Hi,

i discovered your very cool module. Thanks for this job.

But i have a little question to made something.

I use a sidebar menu with all page intégrate in menu but in my footer i would like to create a specific like to only one page but with all translation and good link. I don't understand to do that.
Reply
Ok, if i've no reply i think it's not understood.

I would lik to create a link to a specific page like COMPANY but i would like to use the translation system to create a link translate when i change the langage of my site.

Any idea ?
Reply
jeckyl Wrote:I would lik to create a link to a specific page like COMPANY but i would like to use the translation system to create a link translate when i change the langage of my site.

You can use return_i18n_page_data($slug) to get the page data in the correct language and then extract the title. The link itself you can get with find_url($slug).

I will add a new function to the next version of the I18N plugin.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:
jeckyl Wrote:I would lik to create a link to a specific page like COMPANY but i would like to use the translation system to create a link translate when i change the langage of my site.

You can use return_i18n_page_data($slug) to get the page data in the correct language and then extract the title. The link itself you can get with find_url($slug).

I will add a new function to the next version of the I18N plugin.

Hi,

thanks, but how i can do that ?

$slug is the name i use for url of my page ?

after i retrieved all data about this $slug how i can reach only the title ?

Code:
<a href="<?php find_url('company'); ?>"><?php $toto=return_i18n_page_data('company') echo $toto['title'] ?></a>
Reply
I18N version 1.7:
  • correction of menu/title display, if it contains < or quotes
  • new function get_i18n_link($slug) to output a link with the title in the current language as link text (@jeckyl)
  • call component with parameters: get_i18n_component($name, $param1, ...) (@bugman)
  • optimization when used with I18N Custom Fields - use at least version 1.7 of I18N Custom Fields
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:get_i18n_link

Hi,

a big thanks it's work very well.
Reply
For some reason I can't save my i18n navigation menu and i've made my backup/i18n_navigation field writable.
appears most of my pages on site are set to private, so without being able to save the navigation I can't see most of my pages. Any help anyone can provide is greatly appreciated.
Reply
kerry Wrote:For some reason I can't save my i18n navigation menu and i've made my backup/i18n_navigation field writable.
backups/i18n_navigation folder, I assume ;-)

kerry Wrote:appears most of my pages on site are set to private, so without being able to save the navigation I can't see most of my pages. Any help anyone can provide is greatly appreciated.

Any error messages or warnings? Additional ones, if you switch on debug mode?
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Your changes to the navigation structure could not be saved. Make sure that a directory backups/i18n_navigation exists and is writeable.

That is what I get above when I try and save navigation, however that directory has all the permissions set. I just keep getting the same message without being able to save.
Reply
kerry Wrote:Your changes to the navigation structure could not be saved. Make sure that a directory backups/i18n_navigation exists and is writeable.

That is what I get above when I try and save navigation, however that directory has all the permissions set. I just keep getting the same message without being able to save.

This error should only show up, if the page files can not be copied to the backups/i18n_navigation directory for backup. If this directory has rights 0777 and there are no files in it, it should work.
I'm assuming of course that the page files are readable and writable - otherwise GS would not work ;-)
Only other idea: do you have non-page xml files in data/pages or files with special characters?
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Are there any known conflicts between this plugin and other plugins. I'm testing this on a couple of my sites, and in both for some reason when you click on the M to activate the item in the menu it doesn't toggle visibility.

Also, is there someway to set i18n just to automatically activate the menu rather than having to toggle them on for inclusion to the menu as you add pages.

Thanks for your help, I'm trying to diagnose what I am doing to determine causes for what i'm experiencing...though this is a great plugin regardless.

Kerry
Reply




Users browsing this thread: 4 Guest(s)