• 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




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Tips and Tricks for MLE version ** PRE 1.6 **
PostPosted: Sun Jun 28, 2009 4:31 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
Tips and Tricks - #2


Can I switch from one language to another?

{lang} plugin (use in page template or content page) print language flag icons and relative link for language switching.
There is a optional parameter "spacer" for flags separation or html layout
From 1.2.1 version there is a optional parameter "text" for display textual language switch (you MUST set the output text in config_lang.php lang array)

The img source tags of flag icons are defined in config_lang.php lang array
Language flag icons are in  [cmsms_root]/admin/images/lang  and  [cmsms_root]/images/lang

If not present check for new flags here

I choose png type for less problems in pdf conversion



Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Last edited by alby on Tue Jun 30, 2009 9:25 am, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tips and Tricks for MLE version PRE 1.6
PostPosted: Sun Jun 28, 2009 4:35 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
Tips and Tricks - #3


Are there languages tags/variables that I can use in page template or content page?

- Variable {$lang} is assigned to current locale language (ex. en_US, it_IT)
  Use this for general purpose.
  For example:
  smarty language parameter (ex: calling module):  lang="$lang"
  smarty language category (ex: News category):  category="General-$lang"
  language stylesheet (ex: style language dependant): 

  View in later Tips for this



- Variable {$currlang} (from 1.2.1 version USE {$parent_lang}) is assigned to parent locale language (ex. en, it)
  Use this in header DTD and metadata.
  For example, in template:
 
Code:
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$parent_lang}" lang="{$parent_lang}">
  <head>
    <meta http-equiv="Content-Language" content="{$parent_lang}" />
  </head>
 


  if current language is it_XX result:
 
Code:
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
  <head>
    <meta http-equiv="Content-Language" content="it" />
  </head>
 


  and if current language is en_XX result:
 
Code:
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Language" content="en" />
  </head>
 



Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tips and Tricks for MLE version PRE 1.6
PostPosted: Sun Jun 28, 2009 4:46 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
Tips and Tricks - #4


I don't want to display empty menu items if current language is not ready!

From 1.4.1b this is default behavior!


OLD method DEPRECATED:

- In MenuManager template add this check: {if !empty($node->menutext)}

For example, with this simple menu (I add in red code):
Quote:



Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tips and Tricks for MLE version PRE 1.6
PostPosted: Sun Jun 28, 2009 4:56 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
ORIGINAL AUTHOR: manurevah


i encountered a small issue with pages using GET values while the rest of the site is using pretty URLs, after banging my head against the edge of a sharp table numerous times i figured something out that works for me so hereis:

i have 2 templates that are identical except for {lang}, for the pages that ignore pretty urls and use GET variables i use {lang2}, a usertag and here are the contents to that
Quote:
$myid=$_GET['myid'];  //Alby: it's  $_GET['lid'];
$page=$_GET['page'];

echo '

fr_FR


en_US
';


in this case i use $myid to do my thing, and $page used to define the page we are on.


--------------------------------------------------------------------
I have modify this post for keep a CLEAN topic (Alby)
--------------------------------------------------------------------
1. You can try this also:  {lang2  lid="XXX"}
In this method, page is automatic and lid is fixed (XXX), page dependant ($page_alias) or GET dependant ($smarty.get.lid)
Work in WHOLE site (if pretty url are disabled) because lid can be empty

UDT lang2 code:
Quote:
global $gCms;
global $hls;

$contentops =& $gCms->GetContentOperations();
$contentobj = $contentops->LoadContentFromId( $gCms->variables['content_id'] );
$alias = $contentobj->Alias();

$url = $gCms->config['root_url'].'/index.php?'.$gCms->config['query_var'].'='.$alias;
if (! empty($params['lid'])) $url .= '&lid='. $params['lid'];
if (isset($hls))
{
foreach($hls as $key=>$mle)
{
echo ''. $mle['flag'] .'';
}
}



2. FROM 1.2.1 version in lang tag there is urlparam parameter
use {lang urlparam="&lid=XXXX"}

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Last edited by alby on Sun Jun 28, 2009 5:03 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tips and Tricks for MLE version PRE 1.6
PostPosted: Sun Jun 28, 2009 5:00 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
ORIGINAL AUTHOR: neelesh


Hi All,

I have created a document for the installation and some basic troubleshooting of CMSMS MLE ver 1.2.

You can view the document Installation and Trouble Shooting

Or you may aslo have a look at http://forum.cmsmadesimple.org/index.php/topic,16458.0.html

Thanks,
Neelesh

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Last edited by alby on Sun Jun 28, 2009 5:03 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tips and Tricks for MLE version PRE 1.6
PostPosted: Sun Jun 28, 2009 5:13 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
Tips and Tricks - #7


Can I display different text to every language site?

Yes for simple text in template or in module/tag with a calling param (check help if exist).

Use Translationmanager module! A very simple howto:
- Install this module
- Read module help
- Go in "New/Import language" tab and select your languages. For use from old method, import your MLE languages selecting MLE strings in 2b. In other case Add new language (2a)
- Set your Default language
- In template use {tr_key key="your_key" lang="$lang" assign="mystring"} before of use.
  Now you have $mystring smarty variable for generic use {$mystring} or calling module/tag: {breadcrumbs starttext=$mystring}


OLD method DEPRECATED:

In mle folder there is a subdirecory lang. In this folder there are language files for whole site.
If not exist your locale.php file, copy from en_US.php to your locale file (ex: en_AU.php); open and add a new row in all your language files of your site (view example in file):
Code:
/*  'key'  =>  'string of your text',  */
'my_text_template' => 'translation_of_my_text_template_in_this_locale',
'you_are_here' => 'translation_of_you_are_here_in_this_locale',


best practices:
- for 'key' use normal, lower and no space character, it's a small string that remember your text;
- for 'string of your text' pay attention to your encode/charset (use a tool online, for example UTF-8) or transform your text in html entity (search in google for this or here there is a table conversion);

Tomorrow.................. I think for a complete db tool  ::)


After use in template or in calling module/tag with {$mle_translation.key}:
Text in template:
Quote:
.......
{$mle_translation.my_text_template}
.......


Calling module/tag:
Quote:
{breadcrumbs starttext=`$mle_translation.you_are_here`}



Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tips and Tricks for MLE version PRE 1.6
PostPosted: Sun Jun 28, 2009 5:24 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
Tips and Tricks - #8


I have a problem with mysql with utf-8!

To fix this, you must changed mysql tables to use 165 for varchars.
moorezilla post here this tips.

Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tips and Tricks for MLE version PRE 1.6
PostPosted: Sun Jun 28, 2009 5:27 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
Tips and Tricks - #9


I want to display "default language" page if current language page is not ready (empty content)!


a. You want redirect to DEFAULT_LANG page. You can use a UDT:
[sorry, for a bug, this method don't work from 1.2.5 to 1.4.1]
1a. In Extensions > User Defined Tags create, click on Add User Defined Tag
2a. In Name: redirect_lang
      In Code:
Code:
global $gCms, $hls;

if( (! empty($params['lang'])) && (array_key_exists($params['lang'], $hls)) )
   $hl = $params['lang'];
else
   $hl = DEFAULT_LANG;

if(! empty($params['to'])) $alias = $params['to'];
else
{
   $pageinfo =& $gCms->variables['pageinfo'];
   $alias = $pageinfo->content_alias;
}

$config = $gCms->GetConfig();
$contentops =& $gCms->GetContentOperations();
$contentobj = $contentops->LoadContentFromAlias( $alias );

if($config['assume_mod_rewrite'])
{
   if($config['use_hierarchy'] == true) $_end = $contentobj->HierarchyPath().(isset($config['page_extension'])?$config['page_extension']:'.html');
   else $_end = $alias .(isset($config['page_extension'])?$config['page_extension']:'.html');
   $url = $config['root_url'].'/'.$hl.'/'.$_end;
}
else
{
   if(isset($_SERVER['PHP_SELF']) && $config['internal_pretty_urls'] == true)
   {
      if($config['use_hierarchy'] == true) $_end = $contentobj->HierarchyPath().(isset($config['page_extension'])?$config['page_extension']:'.html');
      else $_end = $alias .(isset($config['page_extension'])?$config['page_extension']:'.html');
      $url = $config['root_url'].'/index.php/'.$hl.'/'.$_end;
   }
   else
   {
      $url = $config['root_url'].'/index.php?'.$config['query_var'].'='.$alias.'&hl='.$hl;
   }
}
redirect($url);


3a. In your template substitute this code:
Code:
{content}

with:
Code:
{content assign='maincontent'}
{if $maincontent eq ''}{redirect_lang}{else}{$maincontent}{/if}


Optional parameters:
lang: overwrite DEFAULT_LANG of config_lang.php (default value). Ex: lang='nl_NL'
to: overwrite same page redirect (default value). It's a alias name page. Ex: to='new-page'




b. You want display DEFAULT_LANG (menu/content/content block="XXX"/global content) if other languages are not ready.
Pay attention:
In 1.2.4 is broken!
In 1.2.4b use new param: view_default=1)
From 1.2.5 you must set $default_lang_fallback to true in config_lang.php
Finally from 1.3 set in Site Admin > Global Settings.



Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tips and Tricks for MLE version PRE 1.6
PostPosted: Sun Jun 28, 2009 5:50 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
Tips and Tricks - #10


How do "opacity" for no current lang icons flag?

Add in style of flag of languages array in config_lang.php a string (default:  opacity:1;).
If you set another string to replace, go to Site Admin > Global Settings and set this string.
Automaticaly opacity percent is 50, if you set another percent set always in Site Admin > Global Settings
Attention because not work well in IE6

Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

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: