CMS Made Simple Forums
https://forum.cmsmadesimple.org/

Tips and Tricks for MLE version ** UPTODATE **
https://forum.cmsmadesimple.org/viewtopic.php?f=41&t=15318
Page 1 of 1

Author:  alby [ Sat Sep 22, 2007 7:31 pm ]
Post subject:  Tips and Tricks for MLE version ** UPTODATE **

* You can see old Tips PRE 1.6 version  here

* There is a new Visual Tutorial 1.6 installation here


Alby

Author:  alby [ Sat Oct 06, 2007 8:10 pm ]
Post subject:  Tips and Tricks for MLE version #1

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:
<?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

Author:  alby [ Mon Oct 15, 2007 7:35 pm ]
Post subject:  Tips and Tricks for MLE version #2

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

Author:  alby [ Sat Oct 27, 2007 3:35 pm ]
Post subject:  Tips and Tricks for MLE version #3

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:
Quote:


 
   
 


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


 
   
 



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

Author:  alby [ Sat Oct 27, 2007 5:45 pm ]
Post subject:  Tips and Tricks for MLE version #4

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

Author:  manurevah [ Tue Oct 30, 2007 2:33 pm ]
Post subject:  Pass other params in lang

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

Author:  alby [ Sat Nov 03, 2007 1:25 pm ]
Post subject:  Tips and Tricks for MLE version #5

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

Author:  alby [ Tue Dec 04, 2007 12:02 pm ]
Post subject:  Tips and Tricks for MLE version #6

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:
Quote:
/* 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:
Quote:
........
id="body-{$lang}">
........






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:
Quote:
header image <strong>{$lang_text}</strong>



Alby

Author:  alby [ Tue Dec 04, 2007 12:41 pm ]
Post subject:  Tips and Tricks for MLE version #7

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

Author:  alby [ Fri Feb 29, 2008 10:50 pm ]
Post subject:  Tips and Tricks for MLE version #8

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

Author:  alby [ Tue Mar 18, 2008 5:15 pm ]
Post subject:  Tips and Tricks for MLE version #9

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

Author:  alby [ Sat Jun 07, 2008 8:27 pm ]
Post subject:  Tips and Tricks for MLE version #10

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

Author:  alby [ Thu Apr 16, 2009 6:40 pm ]
Post subject:  Tips and Tricks for MLE version #11

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:

Quote:
{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:
Quote:



Alby

Author:  alby [ Tue Jun 30, 2009 9:20 am ]
Post subject:  Tips and Tricks for MLE version #12

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

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/