One more approach to build a multilingual site with the regular CMSMS

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
User avatar
alinome.net
Forum Members
Forum Members
Posts: 124
Joined: Thu Jan 25, 2007 2:54 pm
Location: España / Hispanujo / Spain

Re: One more approach to build a multilingual site with the regular CMSMS

Post by alinome.net »

Radice wrote:

Code: Select all

alternative_page=DEFAULT CAN NOT BE USED! INACTIVE BUTTON: English
That means that the following condition is false:

Code: Select all

 
      if ( $show_default == true and valid_page($language[DEFAULT_PAGE]) )
Your default page for the English language is not valid.

You said you array is:

Code: Select all

$languages = array(
  'it' => array('italiano', '<span xml:lang="it">Italiano</span>'),
  'en' => array('english', '<span xml:lang="en">English</span>'),
  'sr' => array('serbo', '<span xml:lang="sr">Serbo</span>') );
That means there has to be a page with alias "english" that will be used by default when no English translation is avalaible. The same about "italiano" and "serbo". Do you have created those pages?

Anyway that is not the reason why the link to the actual translation is not shown. What is the content of the other_languages field of that page? If the format of the content is wrong, then the default page would be used.
Marcos Cruz
User avatar
alinome.net
Forum Members
Forum Members
Posts: 124
Joined: Thu Jan 25, 2007 2:54 pm
Location: España / Hispanujo / Spain

Re: One more approach to build a multilingual site with the regular CMSMS

Post by alinome.net »

Hi Radice.
> Ciao Marcos, i take some screenshot from my cms pages so you can see what i
> did.
> Default page is index, situated under "it" folder (u can see from the
> images). Now I use only english and italian language.
> I created 2 "default"
> pages for "it" and "en" if there is no content/translation avaible, as u told
> me in your post.
> Thank you again
In 1.jpg I see something wrong: That page is it/Home, and in other languages you wrote "it=Home". Something similar is wrong in 4.jpg, an English page, and in 2.jpg, another Italian page...

I suspect that you didn't understood what "other languages" is for: you have to fill it with the alternative translations, if they exist.

Example:

Imagine an italian page called "milano" (it/milano in the tree). Its English translation would be the page "milan" (en/milan in the tree).

OK? So what do you have to write in "other languages" in both pages?:

In "other languages" of it/milano you have to write "en=milan".
In "other languages" of en/milan you have to write "it=milano".

It's very simple: you have to write what translations are avalaible for each page, with the given format, or nothing if no translation is avalaible.

Another problem is the default pages. They are in the array, as we saw before. Those pages have to exist in their language tree.

Another point: In "other languages" and in the language array, use the page alias, not the page title.

Please confirm that you are using "other pages" "other languages" properly and the default pages do exist. I think that is the problem.

Cheers,
Marcos
Last edited by alinome.net on Fri Mar 27, 2009 2:04 pm, edited 1 time in total.
Marcos Cruz
Radice
Forum Members
Forum Members
Posts: 10
Joined: Fri Mar 13, 2009 9:06 am

Re: One more approach to build a multilingual site with the regular CMSMS

Post by Radice »

If i understood well....

it/about->alias:about->other languages: en=about_en
en/about->alias:about_en->other languages: it=about

or

it/contatti->alias:contatti->other languages: en=contacts
en/contacts->alias:contacts->other languages: it=contatti

There's a translation for each italian's page.
I can't rename all english pages with different names, because there's not a translation for the page name (you can't translate Strumicka 15! :D ). So some page NAME in "it" and "en" will be the same. ALIAS ARE DIFFERENTS!!!!!

Default page for "it" and "en" are it/Home and en/Home_en.
From the index (there's only a background image and you can choose which language use: no menu, no content) page i can choose the language: if i press italian i will be redirect to it/Home page, en/Home_en for english.


Please confirm that you are using "other pages" properly????????? where i found "other pages"??
Last edited by Radice on Fri Mar 27, 2009 1:12 pm, edited 1 time in total.
User avatar
alinome.net
Forum Members
Forum Members
Posts: 124
Joined: Thu Jan 25, 2007 2:54 pm
Location: España / Hispanujo / Spain

Re: One more approach to build a multilingual site with the regular CMSMS

Post by alinome.net »

Radice wrote: it/about->alias:about->other languages: en=about_en
en/about->alias:about_en->other languages: it=about

or

it/contatti->alias:contatti->other languages: en=contacts
en/contacts->alias:contacts->other languages: it=contatti
That's right.
Radice wrote: There's a translation for each italian's page.
I can't rename all english pages with different names, because there's not a translation for the page name (you can't translate Strumicka 15! :D ). So some page NAME in "it" and "en" will be the same. ALIAS ARE DIFFERENTS!!!!!
No problem. You have to use the alias.
Radice wrote: Default page for "it" and "en" are it/Home and en/Home_en.
From the index (there's only a background image and you can choose which language use: no menu, no content) page i can choose the language: if i press italian i will be redirect to it/Home page, en/Home_en for english.
Good, though it has no relation to the language menu. To use those pages as default in the language menu of every individual page, put Home and Home_en as the default pages in the language array. They will be used if no translation has been indicated for some page.
Radice wrote: Please confirm that you are using "other pages" properly????????? where i found "other pages"??
Sorry, I meant "other languages" :)
Marcos Cruz
Radice
Forum Members
Forum Members
Posts: 10
Joined: Fri Mar 13, 2009 9:06 am

Re: One more approach to build a multilingual site with the regular CMSMS

Post by Radice »

Sorry if i'm so obstinate :D

"To use those pages as default in the language menu of every individual page, put Home and Home_en as the default pages in the language array"

u mean to put home after header: es:

it/header->1
it/home->1.1

Because i can set only one page as the default site's page: now this page is it/index.

Thank you again

Paolo

ps: now i'm going to change all other_language, than i will update you
User avatar
alinome.net
Forum Members
Forum Members
Posts: 124
Joined: Thu Jan 25, 2007 2:54 pm
Location: España / Hispanujo / Spain

Re: One more approach to build a multilingual site with the regular CMSMS

Post by alinome.net »

Radice wrote: "To use those pages as default in the language menu of every individual page, put Home and Home_en as the default pages in the language array"

u mean to put home after header: es:

it/header->1
it/home->1.1
I don't understand what you mean. Anyway I mean to put them in the language array, in the language_menu tag:

Code: Select all

$languages = array(
  'it' => array('Home', '<span xml:lang="it">Italiano</span>'),
  'en' => array('Home_en', '<span xml:lang="en">English</span>') ) ;
That's the place.
Radice wrote: Because i can set only one page as the default site's page: now this page is it/index.
Right. The CMSMS' default page has nothing to do with the default pages of this multilingual system.

Cheers,
Marcos
Marcos Cruz
Radice
Forum Members
Forum Members
Posts: 10
Joined: Fri Mar 13, 2009 9:06 am

Re: One more approach to build a multilingual site with the regular CMSMS

Post by Radice »

Ok now it works fine!!!

the problem was here:

Code: Select all

$languages = array(
  'it' => array('Home', '<span xml:lang="it">Italiano</span>'),
  'en' => array('Home_en', '<span xml:lang="en">English</span>') ) ;
thank you so much :D

paolo
Last edited by Radice on Fri Mar 27, 2009 3:20 pm, edited 1 time in total.
raza
New Member
New Member
Posts: 2
Joined: Mon Apr 06, 2009 6:04 am

Re: One more approach to build a multilingual site with the regular CMSMS

Post by raza »

alinome,
your approach is great. i'm using it and so far all went well.
Thank you so much for such a simple approach and easy to implement.

But i was wondering, how do i get {news} module in multilingual too using your approach. I can't seem to be able to get around it. I understand little of programming (php/smarty).

FYI, my site only requires 2 language (bilingual) and rely heavily on news module.

Would be so very grateful if you can help out.


Thanks.
User avatar
alinome.net
Forum Members
Forum Members
Posts: 124
Joined: Thu Jan 25, 2007 2:54 pm
Location: España / Hispanujo / Spain

Re: One more approach to build a multilingual site with the regular CMSMS

Post by alinome.net »

Hi raza,

Glad you find the code useful and easy.
raza wrote: But i was wondering, how do i get {news} module in multilingual too using your approach. I can't seem to be able to get around it. I understand little of programming (php/smarty).
Some time ago someone asked something similar. Then I tinkered a bit with the news module; I don't remember the details but I think it would require to program a whole "ad hoc" addon, a lot of work. I'm sorry I cannot help about that; I'm not using the news modules in my CMSMS sites. I hope CMSMS will become multingual soon.

Cheers,
Marcos
Marcos Cruz
raza
New Member
New Member
Posts: 2
Joined: Mon Apr 06, 2009 6:04 am

Re: One more approach to build a multilingual site with the regular CMSMS

Post by raza »

alinome.net wrote: Some time ago someone asked something similar. Then I tinkered a bit with the news module; I don't remember the details but I think it would require to program a whole "ad hoc" addon, a lot of work. I'm sorry I cannot help about that; I'm not using the news modules in my CMSMS sites. I hope CMSMS will become multingual soon.

Cheers,
Marcos
Too bad to hear that..  :-[
i'd have to try and hack it out somehow, or say "no" to my client then.

But anyways, still you've made a good workaround with the multilingual. I like it better than MLE.
Hoping CMSMS will have full  multilingual support soon.

Thanks again Marcos.
User avatar
alinome.net
Forum Members
Forum Members
Posts: 124
Joined: Thu Jan 25, 2007 2:54 pm
Location: España / Hispanujo / Spain

Re: One more approach to build a multilingual site with the regular CMSMS

Post by alinome.net »

I received the following doubt:
I am trying to get the links where you switch language not to be a list. i have tried to find the specific code line telling it to become a list but can't find it. so i would be glad if you could help me out.

So in shorter terms: Where is the code telling the language links to line up in a list?.
The language menu is a list of links, so it must be coded as a XHTML list. That's the first layer, the "semantic" layer of page making. The second layer is the look: you can change it using styles (CSS). That's the recommend way doing this kind of things. But I'll explain both possible solutions.

1) The CSS solution

First, in your template, surround your language menu tag with a with a unique id:

Code: Select all

<div id='langmenu'>
{language_menu show_title=false show_current=false show_default=true show_inactive=true}
</div> <!-- langmenu -->
(The parameters of language_menu are taken from a site of mine, they are not relevant to the example).

Then change the style of the menu in your CSS. This is only an example how to convert the ordinary look of a list into a one-line list of elements without separators:

Code: Select all

#langmenu ul {
	background-color: #F0F0F0;
	font-size: 1em;
	line-height: 1em;
	margin: .5em auto;
	padding: .5em;
	list-style: none;
}

#langmenu ul li {
	margin:0 1em 0 0;
	display:inline;
	}
You could create visual separators with this add-on:

Code: Select all

#langmenu ul li+li {
	border-left: 1px dotted blue;
	}
The possibilities are endless.

2) The "hard" solution

If there's some special reason why the CSS solution is not enough and you really need to remove the in the code, it's easy too:

In the language_menu tag look for the line "// Create the menu".

Then find and remove this line:

Code: Select all

echo '<ul>';
And this one too (the last one):

Code: Select all

echo '</ul>';
(Another option is to change the "" and "" to "" and ""; then the menu would be into a marked paragraph).

Between those lines, in the code, there are several occurrences of "" and "". You can change them to "" and "" if you want to keep some CSS control later, or simply remove the first and change the second to "
"... Endless options, depending of what you need.

Anyway I recommend the CSS solution: lists must be lists; that improves the page's usability.

Hope this helps.

Cheers,
Marcos
Last edited by alinome.net on Fri May 08, 2009 9:41 am, edited 1 time in total.
Marcos Cruz
Radice
Forum Members
Forum Members
Posts: 10
Joined: Fri Mar 13, 2009 9:06 am

Re: One more approach to build a multilingual site with the regular CMSMS

Post by Radice »

hi, i have another little problem. i tried to disable tiltle (es: title="About"), but i can't find a solution. can you help me?
User avatar
alinome.net
Forum Members
Forum Members
Posts: 124
Joined: Thu Jan 25, 2007 2:54 pm
Location: España / Hispanujo / Spain

Re: One more approach to build a multilingual site with the regular CMSMS

Post by alinome.net »

Radice wrote: i tried to disable tiltle (es: title="About"), but i can't find a solution. can you help me?
I'm not sure what you mean. Do you want to remove the link title attribute of the language menu's elements? I think they are added by {cms_selflink}. You can do the following:

In the language_menu tag, find function smarty_cms_selflink and add an empty title attribute:

Code: Select all

title=''
to the following line of  the function:

Code: Select all

smarty_tag ("{cms_selflink page=$page" . ( (empty($text)) ? '' : " text='$text'" ) . ' more="' . $more . '"}');
So the result will be the following:

Code: Select all

smarty_tag ("{cms_selflink title='' page=$page" . ( (empty($text)) ? '' : " text='$text'" ) . ' more="' . $more . '"}');
Then the links will show no title.

Is that what you need?

Cheers,
Marcos
Marcos Cruz
Radice
Forum Members
Forum Members
Posts: 10
Joined: Fri Mar 13, 2009 9:06 am

Re: One more approach to build a multilingual site with the regular CMSMS

Post by Radice »

Yes, that's what i meant. You solved my problem. Thank you again,

paolo
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: One more approach to build a multilingual site with the regular CMSMS

Post by blast2007 »

raza wrote: But i was wondering, how do i get {news} module in multilingual too using your approach. I can't seem to be able to get around it. I understand little of programming (php/smarty).
If question in still alive, I can suggest this way:
- create two news categories: en_news and es_news and fill with your items.
- call news module in this way:

Code: Select all

{if $page_lang == 'en'}
   {news category="en_news"}
{/if}
{if $page_lang == 'es'}
   {news category="es_news"}
{/if}
or better:

Code: Select all

{assign var=news_cat value=$page_lang|cat:'_news'}
{news category="$news_cat"}
This can be done in a page or in a template.
Hope it helps.

regards
blast
Last edited by blast2007 on Mon Jul 06, 2009 3:00 pm, edited 1 time in total.
Post Reply

Return to “Tips and Tricks”