Cataloger Multilanguage

This is a FORK of the CMS Made Simple project and is not oficially supported in any way by the CMS Made Simple development team.
akronim

Cataloger Multilanguage

Post by akronim »

hi there
anyone was able to implement multilanguge capability for cataloger module ?

if not, do you have any idea where to modify the module ?

bye
liudaz

Re: Cataloger Multilanguage

Post by liudaz »

I have just ran into the same problem. Maybe somebody has got any solution for that?

My guess i could solve this with different attributes for each language. My item attribute list would look like this:
EN item1
RU item1
FR item1
EN item2
Ru item2
FR item2....

Then with separate three templates for different languages i could call each of the attributes...
But the problem is: how could i call different cataloger templates with different language selections?
CMS MS: 1.0.2 MLE, cataloger: 0.5.3

Has anybody got any other thoughts or suggestions?

Yhanks in advance.
liudaz

Re: Cataloger Multilanguage

Post by liudaz »

Well.. i have got far far not the best solution for this problem, but for my CMS MS 1.0.2 MLE site this works.

I created different attributes for diffrent languages: attribute1RU ant attribute1EN.
In my cataloger item template i put:

Code: Select all

-- the image JS code goes here --
{php}
if ($_REQUEST['hl']=='en'){
echo '
{/literal}
Attribute1: {attribute1en}
{literal}';}
} else { echo '
{/literal}
Attribute1: {attribute1ru}
{literal}';}
{/php}
Affcourse, it eliminates big part of cataloger module flexibility, but for today, i couldn find any better solution.
alby

Re: Cataloger Multilanguage

Post by alby »

liudaz wrote: Well.. i have got far far not the best solution for this problem, but for my CMS MS 1.0.2 MLE site this works.

I created different attributes for diffrent languages: attribute1RU ant attribute1EN.
In my cataloger item template i put:

Code: Select all

-- the image JS code goes here --
{php}
if ($_REQUEST['hl']=='en'){
echo '
{/literal}
Attribute1: {attribute1en}
{literal}';}
} else { echo '
{/literal}
Attribute1: {attribute1ru}
{literal}';}
{/php}
Affcourse, it eliminates big part of cataloger module flexibility, but for today, i couldn find any better solution.
I read this topic now.
I am testing an other solution. I add a function for translate, for example, $jpg_logo_en_US or $jpg_logo_it_IT or $jpg_logo_de_DE to generic $jpg_logo for use in multilingual module template

Follow this topic for 1.2 release

Alby
liudaz

Re: Cataloger Multilanguage

Post by liudaz »

Thank you. CMS MS 1.1.2 MLE is the version of cms i have been waiting for a long time. ;)
freelage

Re: Cataloger Multilanguage

Post by freelage »

Hello, I am new in CMSMS i have the same problem with {$notes} function in catalog module, what can I do to use this Catalog function in my multi language site.

10q very much  :)
alby

Re: Cataloger Multilanguage

Post by alby »

freelage wrote: Hello, I am new in CMSMS i have the same problem with {$notes} function in catalog module, what can I do to use this Catalog function in my multi language site.
$notes is hardcode in Catalog module.
You can use concat_lang plugin (in 1.2) but for your items only

Alby
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Re: Cataloger Multilanguage

Post by giggler »

Can you show how concat_lang is used...in this instance with "Notes"?

Thanks!
alby

Re: Cataloger Multilanguage

Post by alby »

giggler wrote: Can you show how concat_lang is used...in this instance with "Notes"?
No, $notes is hardcoded. This is workaround (all modules are monolingual).
For personal attributes (ex: jpg_logo_LANG, name_LANG, icon_LANG where LANG are your languages) you can use:

Code: Select all

{concat_lang lang="$lang" vars="jpg_logo,name,icon" separator="_"}
this substitute (ex:  jpg_logo_it_IT with jpg_logo)
and use $jpg_logo, $name, $icon in template

Alby
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Re: Cataloger Multilanguage

Post by giggler »

K, this actually works if you want to use Notes for different language and yes you do need to change the modules files:

action.edittempl.php
contenttype.catalogcategory.php
contenttype.catalogitem.php
contenttype.catalogitem.php

Anywhere you see Notes, add the same code for Notes_es_ES (or what ever the language is) for example:

Find this:

Code: Select all

$this->mProperties->Add('string', 'notes', '');
Add this underneath:

Code: Select all

$this->mProperties->Add('string', 'notes_es_ES', '');
Find this:

Code: Select all

array_push($ret,array('Notes',create_textarea(true, $this->GetPropertyValue('notes'), 'notes', '', 'notes', '', $stylesheet, 80, 10)));
Add this underneath it:

Code: Select all

array_push($ret,array('Notes_es_ES',create_textarea(true, $this->GetPropertyValue('notes_es_ES'), 'notes_es_ES', '', 'notes_es_ES', '', $stylesheet, 80, 10)));
The easier way is open the files mentioned above and just do a search for notes and follow the concept of adding things for Note_xx_XX.


As for the sub template you are using - in this case, I've delete all the other auto attribute code for the item template.

Code: Select all

<div class="catalog_item">
<p>{$title}</p>
{if $lang==es_ES}{$notes_es_ES}{else}{$notes}{/if}</div>

{literal}
<__script__ type="text/javascript">
function repl(img)
   {
   document.item_image.src=img;
   }
</__script>
{/literal}
</div>
So let's say you create attributes for Size and another for Size_es_ES, you will put this in the template:

Code: Select all

{if $lang==es_ES}{$size_es_ES}{else}{$size}{/if}
if you have different more than two language, then just keep adding the language and keep using else and elseif statement. Of course this is going to make your cataloger input page really really long if you have lots of attributes, but at the moment this will work.

BTW-there might be a way to make it so that each of the language input boxes actually appear when you click on the flag in admin for the item page so it's not so messy and it's probably in action.editempl.php or contetype file - I just don't know how to do that at the moment... But seriously, since you can use notes to input anything you want (and style it the way you want), why not just put all the attributes there instead of one box for each attribute, this will make the item input page nice and short...
Last edited by giggler on Fri Dec 14, 2007 8:02 am, edited 1 time in total.
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Re: Cataloger Multilanguage

Post by giggler »

Alby, for the above multilang for notes workaround I posted - I was wondering if there is a way to use something like this for files like contentype.cataglogitem.php so that the correct field appear for the correct language page in Admin as well:

I've tried this and it woudn't work:

Code: Select all

if ($lang =='es')
{
$ret[] = array('Notes_es_ES',create_textarea(true, $this->GetPropertyValue('notes_es_ES'), 'notes_es_ES', '', 'notes_es_ES', '', $stylesheet, 80, 10));
}
I've also tried

Code: Select all

if ($_REQUEST['hl']=='es')
alby

Re: Cataloger Multilanguage

Post by alby »

Today I give a look that is at home with the influence  :(

However, not much agree with modules make multilingual because:
(1) change very often
(2) is not saying that this version of module works well with that version of CMSMS MLE
(3) are many modules and I am one and I should also follow other projects besides CMSMS !!

Alby
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Re: Cataloger Multilanguage

Post by giggler »

Hi Alby -  You're right and don't worry about it because I think it's already a great thing you did with MLE and I'm sure modules being still in one language isn't going to be a big deal. 

Thanks for your hard work!
alby

Re: Cataloger Multilanguage

Post by alby »

giggler wrote: Hi Alby -  You're right and don't worry about it because I think it's already a great thing you did with MLE and I'm sure modules being still in one language isn't going to be a big deal. 

Thanks for your hard work!
Ok, I tested and worked. I thinked use concat_lang but in this way is better.
NOW I modify contenttype.catalogitem.php ONLY, today see for other two contenttype and tomorrow post results.

It's totaly transparent:
- notes and user attributes are transformed in NAME_LANGKEY
- in display (cataloger template) you continue with {$NAME}

Ex, my conf testing:
- LANG:

Code: Select all

 'ita' => array(
	'block'=>'it',
	'flag'=>'<img src="images/lang/it.png" style="border:0" alt="Italiano" />',
	'text'=>'Italiano',
	'locale_cms'=>'it_IT',
 ),
- User defined: nome

In editing you have (label text): Nome_ita (for nome) and Notes (no, it's correct but hidden, view source for notes_ita)
In display use always:  {$nome} and {$notes}

Alby
alby

Re: Cataloger Multilanguage

Post by alby »

Someone can test this attach (VS Cataloger 0.5.6)?
Important:
- backup Cataloger folder
- backup DB
- uncompress files and overwrite (check date file)

- No modify your template
- For new catalog/item there aren't problems
- For edit prev catalog/item, you must enter in page and submit only (this modify your variables), re-enter in page and edit your values and submit again (re-enter in page for check if values are taken)

Alby
Attachments

[The extension mpg has been deactivated and can no longer be displayed.]

Locked

Return to “[locked] CMSMS MLE fork”