[Chameleon] Add new language, template chameleon, please help

Normand Savard nsavard at mapgears.com
Thu Jul 13 11:21:13 EDT 2006


Ines wrote:

>Hello, I'm a new user of Chameleon. I have to make a web page with this map
>server in 3 languages: english, spanish, portuguese. I'm new in this type of
>project, and I don't understand wery well how can I do to do it. I readed
>this link:
>http://chameleon-tiki.maptools.org/tiki-index.php?page=How+to+add+a+new+lang
>uage+file+to+a+widget&highlight=language
>
>I maked that, but I Don't know how to continue. Is in your page some
>tutorial "step by step" that can help me?
>
>  
>
Ines,

I don't think there is any tutorial on this topic.  The best way is to 
look to the sample_bilingual application.  The language files you made 
are used for the translation of the widgets.   For example when you load 
sample_bilingual.phtml in your browser and click on tools, then on 
locate, the text is written in English.  If you switch language by 
clicking the French link in the upper left corner of the application and 
you repeat the steps above the text will appear in French.

In order to have a multilanguage application you need to add the 
following line in the phtml file:

$oApp->CWCAddRegionalTemplate( 'en-CA', 
dirname(__FILE__).'/yourapp_en.html', 
dirname(__FILE__).'/sample_resource_en.php' );
$oApp->CWCAddRegionalTemplate( 'fr-CA', 
dirname(__FILE__).'/yourapp_fr.html', 
dirname(__FILE__).'/sample_resource_fr.php' );
$oApp->CWCAddRegionalTemplate( 'fr-CA', 
dirname(__FILE__).'/yourapp_pt.html', 
dirname(__FILE__).'/sample_resource_pg.php' );
$oApp->CWCInitialize( dirname(__FILE__).'/yourapp_pt.html', $szMapFile  );

Then in the html file you will need some links to switch from one 
language to the other like for example in the yourapp_pt.html file:

<div id="LanguageLayer" name="LanguageLayer">
  <table border="0" cellspacing="0" cellpadding="1">
    <tr>
      <td><cwc2 type="Link" linktype="javascript" 
jsfunction="setLanguage" jsparams="en-CA" styleresource="TextButtons" 
Label="English" ImageTip="Click to set language to English" 
ImageWidth="50" ImageHeight="20" LabelAlign="center">
              <image state="normal"/>
              <image state="hover"/>
              <image state="selected"/>
          </cwc2></td>
       <td><cwc2 type="Link" linktype="javascript" 
jsfunction="setLanguage" jsparams="fr-CA" styleresource="TextButtons" 
Label="French" ImageTip="Click to set language to French" 
ImageWidth="50" ImageHeight="20" LabelAlign="center">
              <image state="normal"/>
              <image state="hover"/>
              <image state="selected"/>
          </cwc2></td>
   </tr>
  </table>
</div>


The default language can be set in chameleon.xml configuration file.


Regards,

Norm


More information about the Chameleon mailing list