GetSimple Support Forum
Support for multilanguage sites, Internationalization (I18N) - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: Support for multilanguage sites, Internationalization (I18N) (/showthread.php?tid=1221)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43


Support for multilanguage sites, Internationalization (I18N) - Oleg06 - 2011-09-25

I'm sorry, take care of the Denver Smile


Support for multilanguage sites, Internationalization (I18N) - dizarter - 2011-09-25

Thanks for the fix, but, switching languages on the index page still doesn't work.

When on the index page, URLs for page switching show example.com/de/ (for Detusch) and example.com/en/ (for English). Clicking any of those returns a 404 page not found.

It does work if I replace this code in frontend.class.php (lines 252-257)

Code:
if ((string) $slug && $slug != 'index') {
  $plink = str_replace('%slug%', $slug, $plink);
} else {
  $plink = str_replace('%slug%/', '', $plink);
  $plink = str_replace('%slug%', '', $plink);
}

with this

Code:
if ((string) $slug) {
  $plink = str_replace('%slug%', $slug, $plink);
}

Now, another question - how to make visiting example.com auto-redirect to example.com/de/index?

I know it has something to do with adding a rule to .htaccess file, but not sure how to apply it.

Thanks for the excellent and fast support.

EDIT:

Thinking about this a little more, it would be best to not show default language in the URL at all (only show the language part of the URL if translation to another language is requested).

Something like this would do the trick (also in frontend.class.php)

Where it says

Code:
$plink = str_replace('%language%', $lang, $PERMALINK_ORIG);

I have replaced with

Code:
$deflang = return_i18n_default_language();

if ($lang != $deflang) {
  $plink = str_replace('%language%', $lang, $PERMALINK_ORIG);
} else {
  $plink = str_replace('%language%/', '', $PERMALINK_ORIG);
}



Support for multilanguage sites, Internationalization (I18N) - mvlcek - 2011-09-25

dizarter Wrote:Thanks for the fix, but, switching languages on the index page still doesn't work.

You are probably missing a rule in .htaccess. Try this:
Code:
RewriteRule ^/?$ en/ [R,L]   # redirect to language of your choice
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|de)/(.*?/)?([A-Za-z0-9_-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(en|de)/?$ index.php?lang=$1 [QSA,L]   # handle index page without 'index'
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
or that:
Code:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^/?$ en/ [R,L] # redirect to language of your choice
RewriteRule ^(en|de)/(.*)$ $2?lang=$1 [QSA,DPI]    # replace with your languages
RewriteRule ^(.*);(\d+)([^\d/][^/]*)?/?$ $1$3?page=$2 [QSA,DPI]  # for use with pagify plugin
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
RewriteRule ^ index.php [L]   # for everything else show home page

dizarter Wrote:Now, another question - how to make visiting example.com auto-redirect to example.com/de/index?

See the examples above.


Support for multilanguage sites, Internationalization (I18N) - dizarter - 2011-09-25

Yes, thank you, I missed the .htaccess part completely.

One more suggestion, it's easy to implement.

It has to do with having all pages in default language displayed without the language prefix while translated versions of those pages do get the language prefix

Code:
$deflang = return_i18n_default_language();
    
if ($lang != $deflang) {
  $plink = str_replace('%language%', $lang, $PERMALINK_ORIG);
} else {
  $plink = str_replace('%language%/', '', $PERMALINK_ORIG);
}

This is useful for me, because I already have my pages without the language indexed on google, and adding the same pages with language prefix would probably penalize my rank because of having duplicate content (multiple URLs resolving to the sam content page).

mvlcek Wrote:
dizarter Wrote:Thanks for the fix, but, switching languages on the index page still doesn't work.

You are probably missing a rule in .htaccess. Try this:
Code:
RewriteRule ^/?$ en/ [R,L]   # redirect to language of your choice
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|de)/(.*?/)?([A-Za-z0-9_-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(en|de)/?$ index.php?lang=$1 [QSA,L]   # handle index page without 'index'
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
or that:
Code:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^/?$ en/ [R,L] # redirect to language of your choice
RewriteRule ^(en|de)/(.*)$ $2?lang=$1 [QSA,DPI]    # replace with your languages
RewriteRule ^(.*);(\d+)([^\d/][^/]*)?/?$ $1$3?page=$2 [QSA,DPI]  # for use with pagify plugin
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
RewriteRule ^ index.php [L]   # for everything else show home page

dizarter Wrote:Now, another question - how to make visiting example.com auto-redirect to example.com/de/index?

See the examples above.



Support for multilanguage sites, Internationalization (I18N) - dizarter - 2011-09-25

And yet another suggestion - is it possible to make the plugin work with "Generate Sitemap" under "Theme"?

The %language% placeholder is not recognized and is output "as is" in the resulting XML.

Thanks once again for the excellent support.


Support for multilanguage sites, Internationalization (I18N) - tazmandev - 2011-09-28

Quote:One more suggestion, it's easy to implement.

It has to do with having all pages in default language displayed without the language prefix while translated versions of those pages do get the language prefix

Quote:$deflang = return_i18n_default_language();

if ($lang != $deflang) {
$plink = str_replace('%language%', $lang, $PERMALINK_ORIG);
} else {
$plink = str_replace('%language%/', '', $PERMALINK_ORIG);
}

I had a very similar problem with dizarter.

From the SEO point of view, must agree that default language index page should look like www.domain.com not www.domain.com/en/

I was upgrading a site from static to GetSimple powered and transposing the existing multilanguage ULRs to I18N plugin.

The site allready has PR2 on mainpage domain , and redirecting the frontpage http://www.pensiuneahanna.ro/ to http://www.pensiuneahanna.ro/ro/ (romanian as default language) was risky with google SR and PR.

I think that default language index page should be treated exactly like GetSimple does, it is left with no parameter.

The "auto" language based on user preferences and session vars, is NOT Seo friendly, unfortunately.

I had to hack getFancyLanguageUrl() function to make my ulr look like old urls. (witch I am not happy with)

And Last:
It is a god practice (a must SEO practice) that on multilanguage sites, to use multilanguage slug urls.
Using slug to identify coresponding pages, makes this imposible. It would be a chalange to find a solution to this.

I know this sounds somehow "demanding" but I have noticed that you are realy preoccupied with I18N system, and the plugin is realy so perfect, that it's a pity to neglect the fancy url / slugs.

Best regards


Support for multilanguage sites, Internationalization (I18N) - mvlcek - 2011-09-28

tazmandev Wrote:From the SEO point of view, must agree that default language index page should look like www.domain.com not www.domain.com/en/

I'm not sure, if from a SEO point of view this is so, as from my point of view (and for my uses) it is much more important to be user friendly then SEO friendly.
But I thought that that's what the canonical meta tag was for, too?

tazmandev Wrote:I think that default language index page should be treated exactly like GetSimple does, it is left with no parameter.

The "auto" language based on user preferences and session vars, is NOT Seo friendly, unfortunately.

As mentioned above - it's USER friendly.

tazmandev Wrote:I had to hack getFancyLanguageUrl() function to make my ulr look like old urls. (witch I am not happy with)

I can include that in a future version.

tazmandev Wrote:And Last:
It is a god practice (a must SEO practice) that on multilanguage sites, to use multilanguage slug urls.
Using slug to identify coresponding pages, makes this imposible. It would be a chalange to find a solution to this.

I know this sounds somehow "demanding" but I have noticed that you are realy preoccupied with I18N system, and the plugin is realy so perfect, that it's a pity to neglect the fancy url / slugs.

That would be another plugin for somebody else to do.
(The I18N plugin started as a small simple plugin for a relative who needed 3 languages on her site)


Support for multilanguage sites, Internationalization (I18N) - dizarter - 2011-09-30

Perhaps a not so bad solution would be to change the form of the translated slug to something like

index_en_TRANSLATED-SLUG

This way we just expand the current logic to include a translated string in the same variable, then splitting this string on underscore will give us all three needed vars: basic slug, language and translated slug.

I am very busy these days with two other projects, but this seems interesting to try to code.

As soon as I find some time I will try to implement this then post here for the review and evetual implementation in the official version.


Support for multilanguage sites, Internationalization (I18N) - tazmandev - 2011-10-06

Ok, I agree user friendly is important.
Perhaps some little adjustments could be done, without being user unfriendly.

What I mean is: Option that when using Fancy URL, and main language set in config, main language to have url unchanged, like dizarter modified the code. This would solve most of seo issues, and let the web designer chose the behavior.

Do not get me wrong. I really appreciate the hard work you put into this plugin, witch is an excellent one. I also understand that this is gnu code and modifs are made on "spare" time.

Thank you again for this great plugin.


Support for multilanguage sites, Internationalization (I18N) - mvlcek - 2011-10-06

I18N version 2.5:
  • specify %nondefaultlanguage%/ in your custom permalink structure to only get the language in the URL, if it is not the default language. E.g. /my-page (for english, default) and /de/my-page (for german)
You have to add define('I18N_IGNORE_USER_LANGUAGE',true); to your gsconfig.php and add appropriate rules to your .htaccess.


Support for multilanguage sites, Internationalization (I18N) - missfx - 2011-10-06

How add .current (if it's possible) on my flags links ?

(I use <?php echo htmlspecialchars(return_i18n_lang_url('en')); ?> )

Thanks a lot


Support for multilanguage sites, Internationalization (I18N) - mvlcek - 2011-10-07

missfx Wrote:How add .current (if it's possible) on my flags links ?

(I use <?php echo htmlspecialchars(return_i18n_lang_url('en')); ?> )

Thanks a lot

Something like the following (assuming en as default languages, de and es as additional languages):
Code:
<?php
  $clang = return_i18n_default_language();
  $langs = return_i18n_languages();
  foreach ($langs as $l) if ($l == 'de' || $l == 'es') { $clang = $l; break; }
?>
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('en')); ?>" class="<?php if ($clang == 'en') echo 'current'; ?>">...</a>
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('de')); ?>" class="<?php if ($clang == 'de') echo 'current'; ?>">...</a>
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('es')); ?>" class="<?php if ($clang == 'es') echo 'current'; ?>">...</a>



Support for multilanguage sites, Internationalization (I18N) - tazmandev - 2011-10-07

mvlcek: I Bow to you. Thank you very much for the update. You made (at least) my live easier.

The %nondefaultlanguage% is realy so ... briliant and simple solution.


Support for multilanguage sites, Internationalization (I18N) - missfx - 2011-10-13

Great thanks a lot !!!


mvlcek Wrote:
missfx Wrote:How add .current (if it's possible) on my flags links ?

(I use <?php echo htmlspecialchars(return_i18n_lang_url('en')); ?> )

Thanks a lot

Something like the following (assuming en as default languages, de and es as additional languages):
Code:
<?php
  $clang = return_i18n_default_language();
  $langs = return_i18n_languages();
  foreach ($langs as $l) if ($l == 'de' || $l == 'es') { $clang = $l; break; }
?>
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('en')); ?>" class="<?php if ($clang == 'en') echo 'current'; ?>">...</a>
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('de')); ?>" class="<?php if ($clang == 'de') echo 'current'; ?>">...</a>
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('es')); ?>" class="<?php if ($clang == 'es') echo 'current'; ?>">...</a>



Support for multilanguage sites, Internationalization (I18N) - Synergy - 2011-10-16

Is it possible to show navigational links for certain pages in the footer?

I don't want the privacy page to show in the main navigational menu only in the footer menu.


Support for multilanguage sites, Internationalization (I18N) - mvlcek - 2011-10-16

Synergy Wrote:Is it possible to show navigational links for certain pages in the footer?

I don't want the privacy page to show in the main navigational menu only in the footer menu.

Just switch off "Add to menu" for this page and add a link in the footer with
Code:
<?php get_i18n_link('privacy'); ?>



Support for multilanguage sites, Internationalization (I18N) - hameau - 2011-10-20

Hello,

I am using get_i18n_navigation(return_page_slug(), 0,99, I18N_SHOW_PAGES) to generate a site listing. I also have a custom 404 page, with page-slug "404" (necessary to have GS present this page for a 404 error).

I want to hide the 404 page in the site listing, but I18N generates each list-item class from the page slug. The 404 page entry starts: <li class="404">, but a class name must begin with a letter. Using a css selector of .404 has no effect.

I have forced a substitution of 'four04' for the class in this case, but perhaps the I18N plug-in should consider cases where page slugs may start with a non-letter character. Not a high probability outside the 404 case, I agree, but possible.


Support for multilanguage sites, Internationalization (I18N) - SlavaP - 2011-10-26

mvlcek, why i18n_navigation does'nt have RU translation while i18n_base does?
you can fix it with attachment Smile


Support for multilanguage sites, Internationalization (I18N) - mvlcek - 2011-10-26

I18N version 2.5.1:
  • includes a russian translation for the navigation part (thanks @SlavaP)
  • prefixes CSS classes derived from slug names with "x" if they do not start with A to Z (@hameau)
  • fixes some small bugs in the pages view



Support for multilanguage sites, Internationalization (I18N) - SlavaP - 2011-10-27

mvlcek, you're VERY fast Smile


Support for multilanguage sites, Internationalization (I18N) - SlavaP - 2011-10-31

mvlcek, as for now, if i have the structure something similar
Code:
page / subpage / sub-subpage / sub-sub-subpage
with fancy urls enabled I see that link of the last level subpage is
Code:
example.com/sub-subpage/sub-sub-subpage
(the only TWO LAST sublevels) instead of
Code:
example.com/SUBPAGE/sub-subpage/sub-sub-subpage
Is it the limitation of GS rewright rules or you can fix it? (your site has the same issue I see)


Support for multilanguage sites, Internationalization (I18N) - mvlcek - 2011-10-31

SlavaP Wrote:mvlcek, as for now, if i have the structure something similar
Code:
page / subpage / sub-subpage / sub-sub-subpage
with fancy urls enabled I see that link of the last level subpage is
Code:
example.com/sub-subpage/sub-sub-subpage
(the only TWO LAST sublevels) instead of
Code:
example.com/SUBPAGE/sub-subpage/sub-sub-subpage
Is it the limitation of GS rewright rules or you can fix it? (your site has the same issue I see)

This is a limitation of how GetSimple creates links.
The link creating function is used in too many places to be easily extendable by a plugin.


Support for multilanguage sites, Internationalization (I18N) - sax - 2011-11-01

Hello,
If I look in the source code of a new generated page, I have the wrong language and charset:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

It should be de and utf-8.
  • I set "Language of all pages with URLs without language code" to "de".
  • I use the newest getsimple 3.1B r551
  • I changed get_i18n_navigation(return_page_slug()) and get_i18n_component(id) in my theme

What is wrong??


Support for multilanguage sites, Internationalization (I18N) - mvlcek - 2011-11-01

sax Wrote:Hello,
If I look in the source code of a new generated page, I have the wrong language and charset:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

It should be de and utf-8.
  • I set "Language of all pages with URLs without language code" to "de".
  • I use the newest getsimple 3.1B r551
  • I changed get_i18n_navigation(return_page_slug()) and get_i18n_component(id) in my theme

What is wrong??

Just change your template for the character set.
You can use the following instead of a hardcoded language in your template:
Code:
<?php global $language; echo @$language ? $language : 'en'; ?>



Support for multilanguage sites, Internationalization (I18N) - sax - 2011-11-02

Thank you mvlcek.
I didn't find out how your code <?php global $language; echo @$language ? $language : 'en'; ?> works,
but I thought that I18N sets the language according to the site name ending (..._en)?

I need 'de' language setting for german sites and 'en' for english sites because google robots ignore sites with wrong language settings (I had this problem before....). Is there another theme that can do this? Or do I have to make two versions of the same theme with different language settings?

Kind regards Matthias