• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS made Simple Czech Site Zur deutschsprachigen Supportseite Site francophone Sitio en Castellano CMSMS - Magyarország CMSMS -  ???????
Pages: [1]
  Print  
Author Topic: Tips and Tricks for MLE version ** UPTODATE **  (Read 56745 times)
0 Members and 1 Guest are viewing this topic.
alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« on: 22 Sep 2007, 15:31 »

* You can see old Tips PRE 1.6 version  here

* There is a new Visual Tutorial 1.6 installation here


Alby
« Last Edit: 29 Jun 2009, 04:26 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #1 on: 06 Oct 2007, 16:10 »

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
« Last Edit: 28 Jun 2009, 12:17 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #2 on: 15 Oct 2007, 15:35 »

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 Edit: 28 Jun 2009, 13:54 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #3 on: 27 Oct 2007, 11:35 »

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):  <div class="class-{$lang}">
  View in later Tips for this



- Use {$lang_parent} in header DTD and metadata.
  For example, in template:
Quote
<!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="{$lang_parent}" lang="{$lang_parent}">
  <head>
    <meta http-equiv="Content-Language" content="{$lang_parent}" />
  </head>

  For example, if current language is it_IT and you set it for parent result:
Quote
<!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>


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 Edit: 28 Jun 2009, 12:45 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #4 on: 27 Oct 2007, 13:45 »

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 Edit: 28 Jun 2009, 13:48 by alby » Logged

manurevah
Forum Members
**

Karma: 0
Offline Offline

Posts: 37


WWW
« Reply #5 on: 30 Oct 2007, 10:33 »

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 Edit: 28 Jun 2009, 12:59 by alby » Logged
alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #6 on: 03 Nov 2007, 09:25 »

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 Edit: 03 Dec 2007, 10:24 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #7 on: 04 Dec 2007, 07:02 »

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



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
<img src="header-{$lang}.png" alt="header image {$lang_text}" title="header image {$lang_text}" />


Alby
« Last Edit: 28 Jun 2009, 13:12 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #8 on: 04 Dec 2007, 07:41 »

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 Edit: 29 Jun 2009, 04:15 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #9 on: 29 Feb 2008, 17:50 »

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 Edit: 28 Jun 2009, 13:26 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #10 on: 18 Mar 2008, 13:15 »

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 Edit: 29 Jun 2009, 04:14 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #11 on: 07 Jun 2008, 16:27 »

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 Edit: 28 Jun 2009, 13:52 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #12 on: 16 Apr 2009, 14:40 »

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)}<span>{$item.flag} {$item.text}</span>
 {else}<a href="{$item.link}">{$item.flag} {$item.text}</a>
 {/if}
{/foreach}

This display:
Quote
<a href="....."><img src="...." /> English</a>
 <span><img src="...." /> Italiano</span>
 <a href="....."><img src="...." /> Nederlands</a>


Alby
« Last Edit: 28 Jun 2009, 14:01 by alby » Logged

alby
Member Support Team
Moderator
Power Poster
*****

Karma: 140
Offline Offline

Posts: 4789


My kids


« Reply #13 on: 30 Jun 2009, 05:20 »

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 Edit: 14 Jul 2009, 06:21 by alby » Logged

Pages: [1]
  Print  
 
Jump to: