Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support for multilanguage sites, Internationalization (I18N)
kerry Wrote: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.

The changes only take effect, when you click on "Save Navigation Structure".
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I am trying to modify Chris's socialize plugin for i18n support but I just don't know where I lost it. I've read the wiki and created a gs-socialize/lang/ folder along with two necessary php language files: en_US.php & pl_PL.php. However, I always get the text shown in English.

Code:
<?php
/*
Plugin Name: GS-Socialize
Description: Adds social bookmark icons/links to the bottom of all posts/pages.
Version: 1.1
Author: Chris Cagle
Author URI: http://www.cagintranet.com/
*/

# get correct id for plugin
$thisfile=basename(__FILE__, ".php");
define('GSSOCIALICONPATH', $SITEURL.'plugins/gs-socialize/img/');

#i18n support
global $LANG;
if (function_exists('i18n_load_texts')) {
  i18n_load_texts('gs-socialize');
} else {  
  i18n_merge('gs-socialize') || i18n_merge('gs-socialize','en_US');
}

# registration
register_plugin(
    $thisfile,
    'GS Socialize',
    '1.1',
    'Chris Cagle',
    'http://www.cagintranet.com/',
    'Adds social bookmark icons/links to the bottom of all posts/pages',
    '',
    ''
);

# hooks
add_action('theme-header', 'gssocial_css');
add_action('content-bottom', 'gssocial_icons');

# functions
function gssocial_css() {
    echo '
        <style type="text/css">
            div#socialize {margin:20px 0;}
            div#socialize a {margin:0 8px 0 0 0;}
        </style>
    ';
}

function gssocial_icons() {
    echo '
    <div id="socialize">
        <b class="gssocial-title" >' .i18n_r("gs-socialize/SHARE"). '</b>&nbsp;
        <a href="http://www.facebook.com/share.php?u='. get_page_url(TRUE) .'&t='. return_page_title() .'" title="Facebook" ><img src="'.GSSOCIALICONPATH .'facebook.png" alt="Facebook" /></a>
        <a href="http://twitter.com/home?status='. return_page_title() .' - '. get_page_url(TRUE) .'" title="Twitter" ><img src="'.GSSOCIALICONPATH .'twitter.png" alt="Twitter" /></a>
    </div>';
/*        
        <a href="http://delicious.com/post?url='. get_page_url(TRUE) .'&title='. return_page_title() .'" title="Add to Delicious" ><img src="'.GSSOCIALICONPATH .'delicious.png" alt="Add to Delicious" /></a>
        <a href="http://digg.com/submit?phase=2&url='. get_page_url(TRUE) .'&title='. return_page_title() .'" title="Submit to Digg" ><img src="'.GSSOCIALICONPATH .'digg.png" alt="Submit to Digg" /></a>
        <a href="http://www.stumbleupon.com/submit?url='. get_page_url(TRUE) .'&title='. return_page_title() .'" title="Stumble This" ><img src="'.GSSOCIALICONPATH .'stumble.png" alt="Stumble This" /></a>
    
    ';
*/
}

?>
Reply
vinta9e Wrote:I am trying to modify Chris's socialize plugin for i18n support but I just don't know where I lost it. I've read the wiki and created a gs-socialize/lang/ folder along with two necessary php language files: en_US.php & pl_PL.php. However, I always get the text shown in English.

Looks ok.
In GS 3.0 you need to specify the frontend language in gsconfig.php: just add a line
Code:
$LANG = 'pl_PL';

If you use the I18N plugin this line is not necessary - the language is automatically determined.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I do use GS 3.0 with I18N v1.7

I did assign the $LANG='pl_PL' within gsconfig.php just to try it. It would force the socialize plugin output to polish and throw a funky handful of warnings right at the beginning of html page output:
Quote:Warning: include_once(/admin/lang/pl_PL.php) [function.include-once]: failed to open stream: No such file or directory in /admin/inc/common.php on line 163

Warning: include_once() [function.include]: Failed opening '/admin/lang/pl_PL.php' for inclusion (include_path='.:/:/usr/local/php/pear5') in /admin/inc/common.php on line 163

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /admin/inc/basic.php on line 560
My site's pages are in Polish when unspecified (as set in the admin) + most pages translated to english under slug_en.

EDIT: Well I still don't know why or how things go about that but I've decided to just include an iframe [like it!] button instead. I think I will just keep it that way.

But here comes my next thought: Do you think GS+I18N could be modified (custom fields?) for the ability to override the page slug for translated pages? I mean: keeping the _en suffixes for XML file storage is great because it makes it easy for GS to "connect" the two language versions of the same content, organize the backend menu etc.

However, it could be beneficial for SEO to have meaningful URLs in every language.
I am no expert but wouldn't it ease Googlebot crawling too?
Reply
I don't wan't to be ungrateful, but this navigation s**ks!

I've got this:

-year 2011
--users 2011 (V)
--gallery 2011 (V)
--sponsors 2011 (V)

-archive (V)
---2010
----users
----gallery
----sponsors

-contact (V)
-home (V)

(V) - Visible in menu.

preaty simple, right ?
And it does worked with get_navigation(), it shows in menu all pages that was added as Visible..

But when I use get_i18n_navigation() i just can force it to show all pages as i want.

get_i18n_navigation('index',0,9,I18N_SHOW_MENU); cool, this show all pages... but only if there is a path to each page.
It will not show 'users 2011', 'gallery 2011' in menu until year 2011 isn't switched to be visible.


Next thing:
Ok I've made 'year 2011' to be visible in menu, but i don't want to have <ul> nested in next <ul>
so:
If
php get_i18n_navigation('index',0,9,I18N_SHOW_MENU);

shows all pages from level 0 to 10, so that does mean that:

get_i18n_navigation('index',1,9,I18N_SHOW_MENU);

should show the sam pages like function above, but without level 0.
But You know what ? It does not!! it shows nothin.

This plugin (i18n) is great.. really! But navigation s**ks!
Reply
Hi,

why you say that ???

This plugin don't make that you want, is plugin fault or is structure of your navigation ?

If you want don't have some link on some level can make.
Reply
grs84pl Wrote:If
php get_i18n_navigation('index',0,9,I18N_SHOW_MENU);

shows all pages from level 0 to 10, so that does mean that:

get_i18n_navigation('index',1,9,I18N_SHOW_MENU);

should show the sam pages like function above, but without level 0.
But You know what ? It does not!! it shows nothin.

Of course not.
For the navigation the pages form a tree (with an invisible root node) - or, if you like it better - a folder structure like on your computer. At any time you can see the contents of one "folder" and - if you want - all sub "folders" (pages).

But you will never be able to see the contents of two sibling "folders" at the same time (without seeing their common parent "folder".

If you want to see two sibling folders on your computer at the same time, you have to open two file explorers. In the same way, for the navigation you have to have two get_i18n_navigation calls.

You have to organize your pages as you want to see them in the navigation, not organize them in a "group similar pages together" kind of way and then try to show them in another way.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Ok. You hava a point in there, but that does not fix my problem.
Maby there shoud be another tag, "display in topmenu" and function that shows every page that has menuStatus = Y

For my purpose I've made that:
Code:
function get_i18n_topmenu(){
//     Wyświetla menu z całej strony i sortuje je według kolejności pojawienia na liście w backendzie

    $children = return_i18n_pages();
    foreach ($children as $child){
        if ( isset($child ['menuStatus']) && $child ['menuStatus'] == 'Y'){
                $dane[] = array('url' => $child ['url'], 'order' => $child['menuOrder']);
        }
        }

//     Zmiana kolumn na wiersze dla funkcji array_multisort();
    foreach ($dane as $klucz => $wiersz){
        $url[$klucz] =  $wiersz['url'];
        $order[$klucz] = $wiersz['order'];
    }
    array_multisort($order, SORT_ASC,$dane);

//     Stworzenie posortowanego menu
    foreach ($dane as $slug){
    echo '<li>';
    get_i18n_link($slug['url']);
    echo '</li>';
    }
}

And modyfied: get_i18n_link():
Code:
function get_i18n_link($slug) {
  $data = return_i18n_page_data($slug);
[b]  if ($data->menu == '')
  $url_name = $data->title;
  else
  $url_name = $data->menu;[/b]
  if (!$data) return false;
  echo '<a href="'.find_url($slug,(string) $data->parent).'">'.stripslashes((string) [b]$url_name[/b]).'</a>';
  return true;
}

This function displays and sort menu items. modyfication of get_i18n_link allows to show page menu name (if any) or shows page title (old behavior).
Reply
grs84pl Wrote:Ok. You hava a point in there, but that does not fix my problem.
Maby there shoud be another tag, "display in topmenu" and function that shows every page that has menuStatus = Y

For my purpose I've made that:
Code:
function get_i18n_topmenu(){
  ...
}

I'm glad you could easily adapt the plugin to your requirements.

You should put this function into functions.php in your theme directory (create it if it does not exist). It is automatically included, so all defined functions are available in your theme.

grs84pl Wrote:And modyfied: get_i18n_link():
Code:
function get_i18n_link($slug) {
...
}

Rather then modifying it, rename it to get_my_i18n_link and also put it into functions.php.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
can be somehow attach to the menu tags? Smile rhetorical question, I do not understand php,
for example
<?php get_i18n_navigation(return_page_slug(),'tags'=>'catalog'); ?>
Reply
mvlcek Wrote:Rather then modifying it, rename it to get_my_i18n_link and also put it into functions.php.
I will do that Smile Thanks
Reply
I jump on this because I have to do a bilingual site, but the english content is not shown

I did like this:
GS 3.0 (most actual version)
I18N-plugins downloaded (most actual version) and installed
in Cardinal-theme :
Code:
<?php get_i18n_navigation(return_page_slug(),0,100); ?> and
<?php get_i18n_component('sidebar'); ?>

slugs are set to:
Code:
index.php?id=%slug%
no URL rewrite

language is defined in gsconfig.php to de_DE
pages are created and seen in the i18N-View

Code:
RewriteEngine off
in .htaccess

but the pages are not loaded, even when I enter the link directly in the URL adressbar:
http://free-jazz.de/index.php?id=kontakt&lang=en

the german version is loaded all the time, no language switch

did I miss something?
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
Connie Wrote:...
but the pages are not loaded, even when I enter the link directly in the URL adressbar:
http://free-jazz.de/index.php?id=kontakt&lang=en

the german version is loaded all the time, no language switch

did I miss something?

It seems you are immediately redirecting to the URL without parameters - thus the language never takes effect.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:It seems you are immediately redirecting to the URL without parameters - thus the language never takes effect.

Martin,

this link is produced by

Code:
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('de')); ?>">In deutsch</a><br />
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('en')); ?>">english version</a>

in the sidebar-component, now I switched to Cardinal theme where sidebar is active and you see my problem

I think I will do a rest and start anew ... if you haven't found a fast answer for me ;=)
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
Connie Wrote:
mvlcek Wrote:It seems you are immediately redirecting to the URL without parameters - thus the language never takes effect.

this link is produced by

Code:
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('de')); ?>">In deutsch</a><br />
<a href="<?php echo htmlspecialchars(return_i18n_lang_url('en')); ?>">english version</a>

in the sidebar-component, now I switched to Cardinal theme where sidebar is active and you see my problem

I think I will do a rest and start anew ... if you haven't found a fast answer for me ;=)

The link produced is correct, but the server immediately redirects to the URL without lang parameter.
Maybe you have canonical redirects switched on in your gsconfig.php.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Martin,

you are such a samaritan! Yes, that was it !

I disabled the canonical redirects and now it is working!

Cheers, hurra!

I am glad and thankful,

Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
Hi,
first of all thanks for your plug-in, it's briliant! : )

But can you help me with something, although I set the default language as pl (in the base php file as well in the panel) i made the _en and _de version of the same page, but still when I enter the website the default language (without any suffix) is _en. As if _en and _pl (which is supposed to be default) swapped.
Im not sure I explained it clearly...but hope you know what wrong.
Reply
lanooz Wrote:Hi,
first of all thanks for your plug-in, it's briliant! : )

But can you help me with something, although I set the default language as pl (in the base php file as well in the panel) i made the _en and _de version of the same page, but still when I enter the website the default language (without any suffix) is _en. As if _en and _pl (which is supposed to be default) swapped.
Im not sure I explained it clearly...but hope you know what wrong.

The suffix is never shown when you visit the site. The language is automatically selected based on your preferred languages in the browser.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Dear team,
first of all congratulations for your work. I'm on my first try of getsimple and it's I18N plugin... all of this works fine just I guess I miss something: how should I swich the language using fancy urls? Is there a cleaner way to do this than using ?lang=it (es. using /en/ after the domain) ? Is the plugin supposed to show any swich language buttons and does not on my installation or it is right without?
Thank you.
Pietro
Reply
bonzodese Wrote:Is the plugin supposed to show any swich language buttons and does not on my installation or it is right without?

so many questions at once ...

you can show a switch language links in your template, but for that you must read the support page:

http://mvlcek.bplaced.net/get-simple/i18n?lang=en

here you will find the info how to display links to switch to different languages, for example

english || italiano || deutsch

will need 3 links in your template, each one directing to one language version
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
mvlcek Wrote:
lanooz Wrote:Hi,
first of all thanks for your plug-in, it's briliant! : )

But can you help me with something, although I set the default language as pl (in the base php file as well in the panel) i made the _en and _de version of the same page, but still when I enter the website the default language (without any suffix) is _en. As if _en and _pl (which is supposed to be default) swapped.
Im not sure I explained it clearly...but hope you know what wrong.

The suffix is never shown when you visit the site. The language is automatically selected based on your preferred languages in the browser.

oh..based on a browser, now I see...But, is there a way to set a default language regardless to the browser?
Reply
did you really check the options / settings of the multilanguage-plugin?

There is a setting for the default language:

go to pages, choose the "Show all pages I18N" at the right menu
set the default language for all pages without language-index
save this setting


Cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
Connie Wrote:did you really check the options / settings of the multilanguage-plugin?

There is a setting for the default language:

go to pages, choose the "Show all pages I18N" at the right menu
set the default language for all pages without language-index
save this setting


Cheers, Connie

I have done that already. For "Language of all pages with URLs without language code (like "index")," i set up "pl" and created "en" version of default pages - but the site still reads the browser language.
Reply
did you set the $lang-variable in the gsconfig.php as well to "pl_PL"?
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
I need a css for the styling in IE, as the menue does not show the same as in other browsers,

[Image: ie8.jpg]

please see here
[Image: firefox5.jpg]

maybe somebody of you has a working css for the IE?

Thanks in advance,

Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply




Users browsing this thread: 2 Guest(s)