Language

Fusion installs with the option of English, Deutsch, or Nederland language. This article addresses the creation of additional languages.

Language Files

Language files are located in …/includes/lang directory. There are two main files for each language, where xx is the language code like de or en:

  • site_xx.inc
  • countries_xx.inc

Format is: define(“name”,”value”);

To translate to new language create a new file site_xx and copy the content of a language file you understand then translate the values. You could also try the Windows language editor, created by chicagoBlues to ease the task. A small howto can be found in our forum: http://www.fusionticket.org/index.php/forum/20-Languages/4684-languageeditor.

Language files must be “UTF-8 without BOM” encoded.

[top]

Language Config (as of v7)

Language needs to be set in the admin config page now!

Language Config (prior v7)

The configuration of the internationalization is located in …includes/config/init_common.php file at the end.

To add a new language you should add an entry to the accepted languages array:

//accepted languages
$_SHOP->langs=array('en','nl','de'); 
$_SHOP->langs_names=array( 
'en'=>'English', 
'de'=>'Deutsch', 
'nl'=>'Nederlands

The next array, $_SHOP→langs_locales, contains optional dialects for each language. Fusion Ticket will try xx, and then xx_XX (where xx is the name of the language and XX the dialect). If the dialect is different, like en_US (American English), explicitly specify it. Otherwise it requires no entry.

$_SHOP->langs_locales=array( 
 'sv'=>'sv_SE'

[top]

Defining the Server's System Locales

In order for your language to display the site correctly, you need to know and configure the correct locale of your site. Each server, where Fusion ticket is installed, has its own set of locales. You can get a list of supported locales via a request to your ISP.

Alternatively, you can check yourself via SSH, just type the command

locale -a

The system will provide you a list of installed locales, like

 ...
 af_ZA.UTF-8
 am_ET.UTF-8
 be_BY.CP1131
 ...

and so on.

Also, you must edit locale settings in the ../includes/config/init_common.php file:

Actual:

$_SHOP->langs_locales=array('sv'=>'sv_SE','ru'=>'ru_RU');

Correct:

$_SHOP->langs_locales=array('sv'=>'sv_SE.UTF-8','ru'=>'ru_RU.UTF-8');

ATTENTION! Please note that most of the names of locales are case sensitive. This mean, that

 ru_RU.UTF-8

is not the same as

ru_RU.utf-8

Enter just the value of the locale, which would give the system.

Appendix: To access the site via SSH, you can use “Putty”
Homepage: http://www.putty.org/
Download: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Manual: http://www.chiark.greenend.org.uk/~sgtatham/putty/docs.html

Step-by-step:

  1. Install “Putty”
  2. Log in to your site using the username and password
  3. Type command “locale –a” (without quotes)
  4. You will receive a list of installed locales on the server, like this:
    • af_ZA.ISO8859-1
    • af_ZA.ISO8859-15
    • af_ZA.UTF-8
    • am_ET.UTF-8
    • be_BY.CP1131
    • be_BY.CP1251
    • be_BY.ISO8859-5
    • de_AT.ISO8859-1
    • de_AT.ISO8859-15
    • de_AT.UTF-8
    • de_CH.ISO8859-1
    • de_CH.ISO8859-15
    • de_CH.UTF-8
    • de_DE.ISO8859-1
    • de_DE.ISO8859-15
    • de_DE.UTF-8
    • el_GR.ISO8859-7
    • el_GR.UTF-8
    • ru_RU.CP1251
    • ru_RU.CP866
    • ru_RU.ISO8859-5
    • ru_RU.KOI8-R
    • ru_RU.UTF-8
    • uk_UA.KOI8-U
    • uk_UA.UTF-8
    • zh_CN.GB18030
    • zh_CN.GB2312
    • zh_CN.GBK
    • zh_CN.UTF-8
    • zh_CN.eucCN
    • zh_HK.Big5HKSCS
    • zh_HK.UTF-8
    • zh_TW.Big5
    • zh_TW.UTF-8
  5. Edit the language locales array in the ..includes/config/init_common.php file.

[top]

Block File

Create a file in …/includes/shop_plugins/block.xx.php. This allows the language to be chosen.

function smarty_block_xx ($params, $content, &$smarty,&$repeat) { 
  global $_SHOP; 
  if($_SHOP->lang=='xx'){
    return $content;
  }
  }
?>

[top]

E-mail Templates

Email templates contain multiple languages. To specify the language of the tag contents use lang attribute of the tag.

Examples:

  • Unordered List Item<subject lang=“en” value=“Confirmation for your order no. $order_id”/>
  • Unordered List Item<subject lang=“fr” value=“Confirmation de Votre commande nr. $order_id”/>

[top]

Web Templates (Smarty)

Smarty templates access internationalized strings from the site_xx.inc type files using this syntax: {!name!}

Current language is stored in the $_SHOP_lang smarty variable

There are also special language tags - (where xx is the language name):

{xx} some text {/xx}

These tags are defined in …/includes/shop_plugins/block.xx.php files.
When you translate Fusion Ticket, add those block files for your language.

Create a new file block.xx.php and include this code.

<?php
function smarty_block_xx ($params, $content, &$smarty,&$repeat) {\\ 
global $_SHOP;\\ 
if($_SHOP->lang=='xx'){\\ 
return $content;  }\\ 
}\\ 
?>\\ 

[top]

Order Handling

In Order Handling, ‘Payment label’, ‘Shipment label’, and ‘HTML Template for explanations’ also use language tags. ie.

  • {fr}Par l'E-mail{/fr}
  • {de}Durch E-Mail{/de}
  • {it}Dal E-mail{/it}
  • {en}By E-mail{/en}

[top]

Submit Your Translation.

Once your translation is finished, and tested, you can contribute it to the project.

[top]


<< Back to Advanced Coding

language.txt · Last modified: 2013/05/14 16:17 by embee
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki