Tips and Tricks for MLE version ** UPTODATE **

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.
Locked
alby

Tips and Tricks for MLE version ** UPTODATE **

Post by alby »

* You can see old Tips PRE 1.6 version  here

* There is a new Visual Tutorial 1.6 installation here


Alby
Last edited by alby on Mon Jun 29, 2009 8:26 am, edited 1 time in total.
alby

Tips and Tricks for MLE version #1

Post by alby »

Tips and Tricks - #1
I am not sure about 'locale'=>'xx_XX', Is this correct?


In Unix environment create a php file with this code (or if you have a shell access use:  locale -a  command):

Code: Select all

<?php
$output = shell_exec('locale -a');
echo $output;
?>
send on server and go with your browser.
Check the locale strings. Choose locale string with utf8 if you use utf8.

In Windows environment, see this link for your locale string



- pixelenvy found a pretty exhaustive list of locale string.

- It's important that use locale languages contained in CMSMS translations (look in [cmsms_root]/admin/lang and [cmsms_root]modules/MODULE/lang) or post a request in Translations forum for your language inclusion.


Alby
Last edited by alby on Sun Jun 28, 2009 4:17 pm, edited 1 time in total.
alby

Tips and Tricks for MLE version #2

Post by alby »

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 toggling.

Optional params (look help tag):
"spacer" for flags separation or html layout.
"class" to apply to links/span.
"text" for display textual and not flags language switch.
"nocurrent" not dispaly current textual/flag language.
"urlparam" on each lang link add a new static/dynamic param. NO in mod_rewrite or internal url_rewriting.
"assign" assign to smarty array for custom layout (view Tips and Tricks - #11 for a example).

The flag folder is defined in Global Settings > MLE languages  (default [cmsms_root]/uploads/lang)
In Multilang project there is a zip with words flag (from flags.blogpotato.de)
I choose png type for less problems in pdf conversion


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

Tips and Tricks for MLE version #3

Post by alby »

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, de_DE)
 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



- Use {$lang_parent} in header DTD and metadata.
 For example, in template:

 
   
 
 For example, if current language is it_IT and you set it for parent result:

 
   
 

Others (for current language) are:
{$lang_flag}: img tag of current flag language
{$lang_text}: native text of current language
{$lang_local}: locale setting of current language


Alby
Last edited by alby on Sun Jun 28, 2009 4:45 pm, edited 1 time in total.
alby

Tips and Tricks for MLE version #4

Post by alby »

Tips and Tricks - #4
I don't want to display menu item if that page is not ready in current language!

This is default behavior!
When a language menu is empty (usually page not ready) then menu link in this language to that page is not present.
Lang flag is not present for switching to if that language page is not ready.

If you want display menu link to page not ready also, you can use "Show from DEFAULT_LANG if current lang is not ready" check in Global Settings > MLE settings because this fallback to DEFAULT_LANG menu/content (attention, this MUST be presents!)
Look to Tips and Tricks - #9 for content/content block/content_image.


Alby
Last edited by alby on Sun Jun 28, 2009 5:48 pm, edited 1 time in total.
manurevah
Forum Members
Forum Members
Posts: 37
Joined: Fri Aug 03, 2007 2:24 pm

Pass other params in lang

Post by 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:
(original post is here)

Look urlparam parameter in Tips and Tricks - #2


Alby
Last edited by Anonymous on Sun Jun 28, 2009 4:59 pm, edited 1 time in total.
alby

Tips and Tricks for MLE version #5

Post by alby »

Tips and Tricks - #5
Can I use different news to every language site?

For News module you can use this method:

Create one category for every languages. For example:
Home-en_US, Home-it_IT, Home-fr_FR, Home-nl_NL

In template call news module:
{news category="Home-$lang" .....other params....}



Alby
Last edited by alby on Mon Dec 03, 2007 3:24 pm, edited 1 time in total.
alby

Tips and Tricks for MLE version #6

Post by alby »

Tips and Tricks - #6
Can I use different item (style/image/...) to every language site?

Look to Tips and Tricks - #3, you can use language smarty variable for custom your layout for every language.


Example 1: I want apply a different style css body and image background for every language:

In stylesheet:
/* This is the common code */
body {
text-align: left;
font-family: Verdana, Arial, sans-serif;
background-color: #9734C3;
background-attachment: fixed;
background-repeat: repeat-y;
}

/* This is the français and english code: different image, font-size and line-height */
#body-fr_FR {
background-image: url(uploads/images/bg-fr.gif);
font-size: 75%;
line-height: 1.4em;
}
#body-en_US {
background-image: url(uploads/images/bg-en.gif);
font-size: 78%;
line-height: 1.5em;
}
In template use:
........

........



Example 2: I want to have a different html img tag for every language:

- Prepare a img for every language and rename to something-xx_XX (ex: header-en_US.png, header-nl_NL.png)
- In template use:

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

Tips and Tricks for MLE version #7

Post by alby »

Tips and Tricks - #7
Can I display different text to every language site?

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

Use TranslationManager module!
A very simple howto:
- Install TranslationManager module.
- Read module help.
- Go in "New/Import language" tab and select your languages (1).
- 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 (same of DEFAULT LANG).
- 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} in template or calling module/tag: {breadcrumbs starttext=$mystring}

There is a Visual Tutorial in wiki

Alby
Last edited by alby on Mon Jun 29, 2009 8:15 am, edited 1 time in total.
alby

Tips and Tricks for MLE version #8

Post by alby »

Tips and Tricks - #8
I have a problem with mysql with utf-8!

Global Settings > MLE languages set already good lenght field for MLE.
moorezilla post here this tips.

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

Tips and Tricks for MLE version #9

Post by alby »

Tips and Tricks - #9
I want to display "default language" content/content block/content_image if current language page is not ready (empty contents)!

Look to Tips and Tricks - #4 for menu link
Default behaviour is not display menu link if content page is not ready and lang flag is not present for switching to if that language page is not ready.

If you want display all pages with content of relative DEFAULT LANG page (this must be already set) use "Show from DEFAULT_LANG if current lang is not ready" check in Global Settings > MLE settings
This fallback content/content block/content_image of current language to relative DEFAULT_LANG (attention, this MUST be presents!)

For a redirect UDT to homepage if page is not ready look to old Tips and Tricks - #9


Alby
Last edited by alby on Mon Jun 29, 2009 8:14 am, edited 1 time in total.
alby

Tips and Tricks for MLE version #10

Post by alby »

Tips and Tricks - #10
How do "opacity" for no current lang icons flag?

Add in img style of languages a string (default:  opacity:1;).
If you want set another string to replace, go to Global Settings > MLE settings and set that string.
Automaticaly opacity percent is 55, if you want set another percent set always in Global Settings > MLE settings
Attention because not work well in IE6

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

Tips and Tricks for MLE version #11

Post by alby »

Tips and Tricks - #11
How to have a custom language switch layout?

You have possibility of assign a smarty variable to lang tag {lang assign='mle_switch'} for later use
An example:
{lang assign='mle_switch'}
....................
{foreach from=$mle_switch key=key item=item}
{if isset($item.current)}{$item.flag} {$item.text}
{else}{$item.flag} {$item.text}
{/if}
{/foreach}
This display:
English
Italiano
Nederlands

Alby
Last edited by alby on Sun Jun 28, 2009 6:01 pm, edited 1 time in total.
alby

Tips and Tricks for MLE version #12

Post by alby »

Tips and Tricks - #12
How add a new language not present in languages dropdown?

CMSMS MLE version use same languages of original CMSMS.
If in Add new languages dropdown is missing your language (no CMSMS translation), you can add this new language with simple steps:

1. Choose a new language from dropdown (more close to your if possible, in this example xx_XX)

2. Substitute all values in "New Language" form in accord of your new language, for example
  locale_cms => 'xx_XX'  to  'yy_YY'  (where "yy_YY" is "parent-code_COUNTRY-CODE" of your new language)

3. Test DB and Config in General Settings > MLE settings

4. Now create in root of CMSMS a  [cmsms_root]/module_custom  folder and create "into"  MODULE/lang  subfolders for each important frontend module (substitute MODULE with real module name, ex: FrontEndUsers!!)

5. Now for each MODULE copy  [cmsms_root]/modules/MODULE/lang/ext/xx_XX.php  to  [cmsms_root]/module_custom/MODULE/lang/yy_YY.php  (ie: copy and rename filename)

6. Edit [cmsms_root]/module_custom/MODULE/lang/yy_YY.php and substitute translation string from xx_XX language to yy_YY language

Very important is that when you edit use a simple editor (better if save in Unix and UTF8 without BOM format), NOT use wordpad or word!!

HOWEVER why not share translations in CMSMS?


Alby
Last edited by alby on Tue Jul 14, 2009 10:21 am, edited 1 time in total.
Locked

Return to “[locked] CMSMS MLE fork”