• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 131 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 9  Next
Author Message
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Wed May 21, 2008 3:02 pm 
Offline
Forum Members
Forum Members

Joined: Wed Apr 23, 2008 3:31 pm
Posts: 20
In the tag {language_menu} :

$languages = array(
  'en' => array('home', 'English'),
  'fr' => array('accueil', 'Français') );

For the moment I just have 3 pages in french & 3 in english

In french :
Accueil alias accueil          Other Languages: en=home
Et encore alias encore        Other Languages: en=else
Une journée au parc alias une-journee-au-parc  Other Languages: en=a-day-in-the-park

In english:
Home alias home              Other Languages: fr=accueil
else alias else                  Other Languages: fr=encore
A day in the park alias a-day-in-the-park  Other Languages: fr=une-journee-au-parc


Last edited by ZIGRIB on Wed May 21, 2008 3:03 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Wed May 21, 2008 3:14 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Thu Jan 25, 2007 2:54 pm
Posts: 124
Location: España / Hispanujo / Spain
Everything looks right.

Let's try another thing: Are the languages links right? Do they really point to the right page alias in the other language or to the home page? I mean, when you move the mouse over a language link, what goal URL is shown on the status bar of your browser? As an alternative, you can take a look into the XHTML source: What href URL is inside the tag?

_________________
Marcos Cruz


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Wed May 21, 2008 3:28 pm 
Offline
Forum Members
Forum Members

Joined: Wed Apr 23, 2008 3:31 pm
Posts: 20
when I move the mouse over a language link it's always the same gaol :

when i'm oven english link :
http://localhost/site/index.php?page=home

when i'm over french link :
http://localhost/site

As an alternative, you can take a look into the XHTML source: What href URL is inside the tag
How can i do it ?
If I see the source code of the page "Et encore" with firefox :


It's that what you mean ?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Wed May 21, 2008 3:48 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Thu Jan 25, 2007 2:54 pm
Posts: 124
Location: España / Hispanujo / Spain
ZIGRIB \ZIGRIB:
when i'm oven english link :
http://localhost/site/index.php?page=home
when i'm over french link :
http://localhost/site


That means the links are build wrong in the tag {language_menu}, as if you didn't filled the "Other languages" field. I cannot guess what's wrong. I am going to take a look at the code now to get it back fresh in my mind. Wait a little.

_________________
Marcos Cruz


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Wed May 21, 2008 5:08 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Thu Jan 25, 2007 2:54 pm
Posts: 124
Location: España / Hispanujo / Spain
Hello again ZIGRIB,

1) What parameters are you using in the {language_menu} tag?:

\$1:
// ----------------------------------------------------------------
// Parameters

// Show the page title in the links? (true/false)
// (if false, show the defined buttons)
$show_title = isset($params['show_title']) ? $params['show_title'] : false;

// Show an inactive link to the current page in the menu? (true/false)
// (if false, don't create a menu entry for the current page)
$show_current = isset($params['show_current']) ? $params['show_current'] : false;

// If there's no valid translation, then show a link to the default page? (true/false)
// (if false, don't create a menu entry for that language)
$show_default = isset($params['show_default']) ? $params['show_default'] : true;

// If  $show_default==false or there's no valid default page, then show an inactive link? (true/false)
// (if false, don't create a menu entry for that language)
$show_inactive = isset($params['show_inactive']) ? $params['show_inactive'] : true;


2) Please activate all the debug lines in the foreach loop inside the {language_menu} tag. I mean, delete the initial "//" of the lines that have "// DEBUG" at the end. Then refresh your pages and tell me what warnings you see in the language menu.

_________________
Marcos Cruz


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Wed May 21, 2008 5:39 pm 
Offline
Forum Members
Forum Members

Joined: Wed Apr 23, 2008 3:31 pm
Posts: 20
1) What parameters are you using in the {language_menu} tag?

I don't modify anything in parameters :

// ----------------------------------------------------------------
// Parameters

// Show the page title in the links? (true/false)
// (if false, show the defined buttons)
$show_title = isset($params['show_title']) ? $params['show_title'] : false;

// Show an inactive link to the current page in the menu? (true/false)
// (if false, don't create a menu entry for the current page)
$show_current = isset($params['show_current']) ? $params['show_current'] : false;

// If there's no valid translation, then show a link to the default page? (true/false)
// (if false, don't create a menu entry for that language)
$show_default = isset($params['show_default']) ? $params['show_default'] : true;

// If  $show_default==false or there's no valid default page, then show an inactive link? (true/false)
// (if false, don't create a menu entry for that language)
$show_inactive = isset($params['show_inactive']) ? $params['show_inactive'] : true;



2) Please activate all the debug lines in the foreach loop inside the {language_menu} tag. I mean, delete the initial "//" of the lines that have "// DEBUG" at the end. Then refresh your pages and tell me what warnings you see in the language menu.

Results :
# alternative_page=NO ALTERNATIVE! DEFAULT: English when i'm in french page
# alternative_page=NO ALTERNATIVE! DEFAULT: Français when i'm in english page


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 12:06 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Thu Jan 25, 2007 2:54 pm
Posts: 124
Location: España / Hispanujo / Spain
ZIGRIB \ZIGRIB:
I don't modify anything in parameters :


So that means in your template you put just {language_menu}, literally. So the defaults values are used for the parameters:

\$1:
$show_title = false;
$show_current = false;
$show_default = true;
$show_inactive = true;


ZIGRIB \ZIGRIB:
Results :
# alternative_page=NO ALTERNATIVE! DEFAULT: English when i'm in french page
# alternative_page=NO ALTERNATIVE! DEFAULT: Français when i'm in english page


That happens here:

\$1:
if ( $show_default == true and valid_page($language[DEFAULT_PAGE]) )
      {
        echo '<li>';
        // echo 'NO ALTERNATIVE! DEFAULT: '; // DEBUG
        smarty_cms_selflink($language[DEFAULT_PAGE],( ($show_title == true ) ? "" : $language[BUTTON] ) , "hreflang='".$language_code."'");
        echo '</li>';
      }


$show_default is true, we have seen. That means valid_page($language[DEFAULT_PAGE]) outputs false:

\$1:
function valid_page($page_alias)
{

  // Is a page alias valid?

  // References:
  // http://forum.cmsmadesimple.org/index.php/topic,3778.msg20921.html#msg20921

  global $gCms;

  $manager =& $gCms->GetHierarchyManager();
  $node =& $manager->getNodeByAlias($page_alias);
  return ( $node != null );

}


It's very strange. Are you sure you didn't mistype the alias of the pages in the Other languages content block? Please add the three "echo" commands to the function, like this:

\$1:
function valid_page($page_alias)
{

  // Is a page alias valid?

  // References:
  // http://forum.cmsmadesimple.org/index.php/topic,3778.msg20921.html#msg20921

  global $gCms;

echo '<p><strong>DEBUG</strong>:';
echo "<br/>page_alias=$page_alias";
echo '</p>';

  $manager =& $gCms->GetHierarchyManager();
  $node =& $manager->getNodeByAlias($page_alias);
  return ( $node != null );

}


Are the alias shown the good ones? Are they the same than the alias defined in the pages?

Also, uncomment the debug line here:

\$1:
if ( $language_code != $page_lang )
  {
    $alternative_page = $language_versions[$language_code];
   echo "alternative_page=$alternative_page"; // DEBUG


What alternative page is shown?

_________________
Marcos Cruz


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 1:29 pm 
Offline
Forum Members
Forum Members

Joined: Wed Apr 23, 2008 3:31 pm
Posts: 20
hello Marcos

1 - Are the alias shown the good ones? Are they the same than the alias defined in the pages?

After i have put the 3 echo in fonction valid page :

when i'm in french page:
DEBUG:
page_alias=

DEBUG:
page_alias=home

when i'm in english page :
DEBUG:
page_alias=

DEBUG:
page_alias=accueil




Also, uncomment the debug line here:
Code:
if ( $language_code != $page_lang )
  {
    $alternative_page = $language_versions[$language_code];
  echo "alternative_page=$alternative_page"; // DEBUG
What alternative page is shown?

result :
alternative_page=

it is really strange...
Perhaps i made a mistake when i followed the instructions...
I have create two pages :
the first is  name : français    type : Section Header  alias: fr
the second is name : anglais  type : Section Header  alias : en

then I created all french pages with as français page and English with as anglais page.
I mean i have :
1 - français            type : section header
1.1 - accueil          type : content
1.2 - ...                type : content

2 - Anglais            type : section header
2.1 - home            type content
2.2 - ...                type content

I have create two tags assign_page_lang & language_menu by copy and paste the code of the instructions

I put in each templates :

- on the top : {assign_page_lang}
- just after body tag :
{language_menu}

- in the content : {content block='Other languages' oneline='true' assign=other_languages wysiwyg='false'}

I have prove that alias entered in other language are the same definitely in the concerned pages
for example for the homepage I put this:
on the page accueil (alias accueil)---> en=home
on the page home (alias home)---> fr=accueil


Is it correct ?


Last edited by ZIGRIB on Thu May 22, 2008 1:50 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 5:33 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Thu Jan 25, 2007 2:54 pm
Posts: 124
Location: España / Hispanujo / Spain
ZIGRIB \ZIGRIB:
\$1:
if ( $language_code != $page_lang )
  {
    $alternative_page = $language_versions[$language_code];
   echo "alternative_page=$alternative_page"; // DEBUG

What alternative page is shown?
result :
alternative_page=


The problem is that the array $language_versions is empty! Are you using PHP 4? The function array_combine() is a PHP-5-only function. If you use PHP 4 you must add some code to ensure PHP 4 compatibility.

To see the version of your PHP, create a file called phpinfo.php with this content:
\$1:
<?php phpinfo(); ?>


Upload it into your web serber space and visit it with your browser. What PHP version is it?

_________________
Marcos Cruz


Last edited by alinome.net on Thu May 22, 2008 5:40 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 5:47 pm 
Offline
Forum Members
Forum Members

Joined: Wed Apr 23, 2008 3:31 pm
Posts: 20
On localhost i have php5 and
i try the fonctionnality online with php4 + code compatibility php4
the result is the same...


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 6:05 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Thu Jan 25, 2007 2:54 pm
Posts: 124
Location: España / Hispanujo / Spain
ZIGRIB \ZIGRIB:
On localhost i have php5 and


This is a "poltergeist"  :)

Let's see what happens about the language arrays. Uncomment these debug lines and copy and paste me the result:

\$1:
/*
echo '<p><strong>DEBUG</strong>:';
echo "<br/>language_codes="; print_r($language_codes);
echo "<br/>language_pages="; print_r($language_pages);
echo "<br/>language_versions="; print_r($language_versions);
echo '</p>';
*/

_________________
Marcos Cruz


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 6:49 pm 
Offline
Forum Members
Forum Members

Joined: Wed Apr 23, 2008 3:31 pm
Posts: 20
Result  under php4:
DEBUG:
language_codes=Array ( [0] => )
language_pages=Array ( [0] => )
language_versions=Array ( [0] => )

result under php5
DEBUG:
language_codes=Array ( [0] => )
language_pages=Array ( [0] => )
language_versions=Array ( [] => )


Last edited by ZIGRIB on Thu May 22, 2008 6:56 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 7:06 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Thu Jan 25, 2007 2:54 pm
Posts: 124
Location: España / Hispanujo / Spain
It seems the problem is here:

\$1:
$other_languages = $gCms->smarty->get_template_vars('other_languages');
foreach ( explode(';', $other_languages) as $other_language )
{
  $language_codes[]=substr($other_language, 0, 2);
  $language_pages[]=substr($other_language, 3);
}


Add the two "echo" lines:

\$1:
$other_languages = $gCms->smarty->get_template_vars('other_languages');
echo "<p>other_languages=$other_languages</p>";
foreach ( explode(';', $other_languages) as $other_language )
{
  echo "<p>other_language=$other_language</p>";
  $language_codes[]=substr($other_language, 0, 2);
  $language_pages[]=substr($other_language, 3);
}


What is the result?

_________________
Marcos Cruz


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 7:10 pm 
Offline
Forum Members
Forum Members

Joined: Wed Apr 23, 2008 3:31 pm
Posts: 20
result :

other_languages=

other_language=

DEBUG:
language_codes=Array ( [0] => )
language_pages=Array ( [0] => )
language_versions=Array ( [] => )


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: One more approach to build a multilingual site with the regular CMSMS
PostPosted: Thu May 22, 2008 7:29 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Thu Jan 25, 2007 2:54 pm
Posts: 124
Location: España / Hispanujo / Spain
ZIGRIB \ZIGRIB:
other_languages=


That means the "Other languages" content block is empty, or the variable it's assigned to cannot be fetched. I have this in my site template:

\$1:
{content block='Other languages' oneline='true' assign='other_languages' wysiwyg='false'}


If the words "block" or "assign" or their values were mistyped, that would explain the problem. You said:

ZIGRIB \ZIGRIB:
- in the content : {content block='Other languages' oneline='true' assign=other_languages wysiwyg='false'}


The difference is the quotes around 'other_languages', but they are not needed (I forgot them in the published code). Are you putting that content block in the template that is associated with your pages?

_________________
Marcos Cruz


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 131 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 9  Next

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting