vot Publish time 2011-10-30 17:25

How to add a new language into Discuz!ML (Multi-Lingual version)

Multilingual Discuz!ML can use multiple languages, selectable by a user.

But by default there is only 2 default languages - SC and TC (included into the product package).

How to add a new language into your international Discuz!ML:

1) Get any interesting for you language pack from Discuz Addon Center:
http://addon.discuz.com/?@55352.developer

sc = Simplified Chinese (简体中文)
tc = Traditional Chinese (繁體中文)
en = English (English)
fr = French (Français)
de = German (Deutsch)
pl = Polish (Polski)
ru = Russian (Русский)
es = Spanish (Español)
tr = Turkish (Türkçe)
kr = Korean (한국어)
la = Lao (ພາສາລາວ)
th = Thai (ไทย)
vn = Vietnamese (Tiếng Việt)
ar = Arabic (العربية)
fa = Farsi (Persian فارسی)
ui = Uighur
... etc.

1A) If you are a registered language developer then you can get your language pack from our language repository.

1B) If there is no language you want in the addon center or in our repository, then you can create your new language pack by duplicating English language pack. Just copy the folder /source/language/en into /source/language/xx, where "xx" is a code of your new language, i.e. "vn" for Vietnamese language.

2) Upload just downloaded language pack into the /source/language/ directory at your site.

For example, for use Vietnamese language pack copy it into /source/language/vn/ directory.

3) Open for Editing your configuration file /config/config_global_default.php:
Find these lines:
//-----------------------------------------------------------------------
// Multi-Lingual support by Valery Votintsev
//-----------------------------------------------------------------------
// "icon" - flag image file name;
// "name" - language name in NATIONAL language;
// "title" - language name in ENGLISH language;
// "dir" - text direction:
//      'ltr' (Left To Right)
//      'rtl' (Right To Left), i.e for Arabic, Hebrew, Urdu, etc.
//-----------------------------------------------------------------------
// Uncomment a language line for enable the language!
// Comment a language line that is not required!!!
//
// Enabled Language List:

$_config['languages'] = array(
//      'ar' => array('icon'=>'ar.gif', 'name'=>'العربية', 'title'=>'Arabic', 'dir'=>'rtl'),
      'sc' => array('icon'=>'zh.gif', 'name'=>'简体中文', 'title'=>'Simplified Chinese', 'dir'=>'ltr'),
      'tc' => array('icon'=>'tw.gif', 'name'=>'繁體中文', 'title'=>'Traditional Chinese', 'dir'=>'ltr'),
//      'de' => array('icon'=>'de.gif', 'name'=>'Deutsch', 'title'=>'Deutsch', 'dir'=>'ltr'),
//      'en' => array('icon'=>'en.gif', 'name'=>'English', 'title'=>'English', 'dir'=>'ltr'),
//      'es' => array('icon'=>'es.gif', 'name'=>'Español', 'title'=>'Spanish', 'dir'=>'ltr'),
//      'fr' => array('icon'=>'fr.gif', 'name'=>'Français', 'title'=>'French', 'dir'=>'ltr'),
//      'ru' => array('icon'=>'ru.gif', 'name'=>'Русский', 'title'=>'Russian', 'dir'=>'ltr'),
//      'th' => array('icon'=>'th.gif', 'name'=>'ภาษาไทย', 'title'=>'Thai', 'dir'=>'ltr'),
//      'tr' => array('icon'=>'tr.gif', 'name'=>'Türkçe', 'title'=>'Turkish', 'dir'=>'ltr'),
//      'vn' => array('icon'=>'vn.gif', 'name'=>'Tiếng Việt', 'title'=>'Vietnamese', 'dir'=>'ltr'),
);


4) Uncomment (or add) the line you need (for example, the 'vn' line):
'vn' => array('icon'=>'vn.gif', 'name'=>'Tiếng Việt', 'title'=>'Vietnamese', 'dir'=>'ltr'),

5) Edit your configuration file /config/config_global.php:
Find this lines:
// -------------------------CONFIG LANGUAGES------------------------- //
$_config['languages']['sc']['icon'] = 'zh.gif';
$_config['languages']['sc']['name'] = '简体中文';
$_config['languages']['sc']['title'] = 'Simplified Chinese';
$_config['languages']['sc']['dir'] = 'ltr';
$_config['languages']['sc']['code'] = 'zh-CN';
$_config['languages']['tc']['icon'] = 'tw.gif';
$_config['languages']['tc']['name'] = '繁體中文';
$_config['languages']['tc']['title'] = 'Traditional Chinese';
$_config['languages']['tc']['dir'] = 'ltr';
$_config['languages']['tc']['code'] = 'zh-TW';


6) Add 4 lines for your new language pack i.e. vn:


    $_config['languages']['vn']['icon'] = 'vn.gif';
    $_config['languages']['vn']['name'] = 'Tiếng Việt';
    $_config['languages']['vn']['title'] = 'Vietnamese';
    $_config['languages']['vn']['dir'] = 'ltr';
    $_config['languages']['vn']['code'] = 'vi-VN';


7) Go to your AdminCP and clean all the caches:
Admin-Center -> Tools -> Update Cache

8) That's all!


How to remove allready installed language pack:

1) Edit your configuration file /config/config_global.php:
Find and comment (or remove) lines for the removed language, i.e. "vn":
// $_config['languages']['vn']['name'] = 'Tiếng Việt';
// $_config['languages']['vn']['title'] = 'Vietnamese';
// $_config['languages']['vn']['dir'] = 'ltr';
// $_config['languages']['vn']['code'] = 'vi-VN';


2) Go to your Admin-Center -> Tools -> Update Cache
and clean all the caches.

3) Optionally you can totally remove the obsolete language pack files.
For example, remove the /source/language/vn/ directory.

4) That's all!



How to create a NEW language pack for multilingual Discuz!ML:

1) Create a new subfolder under the /source/language/ directory for your new language and copy all the content from any existing language pack into this directory.
For example, for create the Vietnamese language pack make the /source/language/vn/ directory.

2) Create a flag icon for your languagewith a size of 16x16px ( i.e. vn.gif ) and copy the icon into the language subfolder (i.e. into 'source/language/vn' folder).

3) Edit your configuration file /config/config_global.php:
Find this lines:

// -------------------------CONFIG LANGUAGES------------------------- //
$_config['languages']['sc']['icon'] = 'zh.gif';
$_config['languages']['sc']['name'] = '简体中文';
$_config['languages']['sc']['title'] = 'Simplified Chinese';
$_config['languages']['sc']['dir'] = 'ltr';
$_config['languages']['sc']['code'] = 'zh-CN';
$_config['languages']['tc']['icon'] = 'tw.gif';
$_config['languages']['tc']['name'] = '繁體中文';
$_config['languages']['tc']['title'] = 'Traditional Chinese';
$_config['languages']['tc']['dir'] = 'ltr';
$_config['languages']['tc']['code'] = 'zh-TW';


4) Add 4 new lines for your new language pack i.e. vn:


    $_config['languages']['vn']['icon'] = 'vn.gif';
    $_config['languages']['vn']['name'] = 'Tiếng Việt';
    $_config['languages']['vn']['title'] = 'Vietnamese';
    $_config['languages']['vn']['dir'] = 'ltr';
    $_config['languages']['vn']['code'] = 'vi-VN';


5) Go to your Admin-Center -> Tools -> Update Cache
and clean all the caches.

6) That's all! The language pack is turned on!

7) It is a time for a hard job!!!
Go to your language pack folder and translate ALL the files line by line.
Important! DO NOT REORDER EXISTING LINES!!!

8) For see a result of your translation, just update the cache from your Admin-Center!

9) Are you finished? Great!
Let you suggest your hard job for our community members!!!
Just compress your language pack folder and attach the archive at this forum,
or upload it to any file-upload server!



How to change the language order in "select language" menu:

Just reorder language lines as you wish in gonfig_global.php !



khalid Publish time 2011-10-31 13:40

تم تعديله بواسطةkhalid في2011-10-31 14:43

Whats about js file

Is it change when i change languge ?

vot Publish time 2011-10-31 13:45

Javascript language files placed inside the language pack.
So, javascripts are switched with the same manner as the php language files.
You have to do nothing with this.

jmepan Publish time 2011-12-01 12:59

In Discuz_X2.0_ML_UTF8_20111011_by_vot_Rev_167.rar

config_global.php not found the code:
$ _config ['languages'] = array (
'en' => array ('icon' => 'en.gif', 'title' => 'English', 'dir' => 'ltr'),
/ / 'Zh' => array ('icon' => 'zh.gif', 'title' => 'Chinese', 'dir' => 'ltr'),
/ / 'De' => array ('icon' => 'de.gif', 'title' => 'Deutsch', 'dir' => 'ltr'),
/ / 'Ru' => array ('icon' => 'ru.gif', 'title' => 'Russian', 'dir' => 'ltr'),
/ / 'Vn' => array ('icon' => 'vn.gif', 'title' => 'Vietnamese', 'dir' => 'ltr'),
/ / 'Ar' => array ('icon' => 'ar.gif', 'title' => 'Arabic', 'dir' => 'rtl'),
);
Open your configuration file /config/config_global_default.php,

found the code and copy it to config_global.php (CONFIG LANGUAGES).

Example:
// -------------------------CONFIG LANGUAGES------------------------- //
//$_config['languages']['en']['icon'] = 'en.gif';
//$_config['languages']['en']['title'] = 'English';
//$_config['languages']['en']['dir'] = 'ltr';


$_config['languages'] = array(
        'en' => array('icon'=>'en.gif', 'title'=>'English', 'dir'=>'ltr'),
        'zh' => array('icon'=>'zh.gif', 'title'=>'Chinese', 'dir'=>'ltr'),
//        'de' => array('icon'=>'de.gif', 'title'=>'Deutsch', 'dir'=>'ltr'),
//        'ru' => array('icon'=>'ru.gif', 'title'=>'Russian', 'dir'=>'ltr'),
//        'vn' => array('icon'=>'vn.gif', 'title'=>'Vietnamese', 'dir'=>'ltr'),
//        'ar' => array('icon'=>'ar.gif', 'title'=>'Arabic', 'dir'=>'rtl'),
);


That's all.

vot Publish time 2011-12-01 13:23

Thanx!

The file config_global.php is not exists in the distributive package.
This file is created automatically after installation.

But this problem occure only when upgrade from standard version to multilingual.

The problem is absent when installed from ML version.

yirihan Publish time 2011-12-21 18:00

// --------------------------CONFIG OUTPUT--------------------------- //
$_config['output']['charset'] = 'utf-8';
$_config['output']['forceheader'] = 1;
$_config['output']['gzip'] = '0';
$_config['output']['tplrefresh'] = 1;
$_config['output']['language'] = 'en';
$_config['output']['staticurl'] = 'static/';
$_config['output']['ajaxvalidate'] = '0';
$_config['output']['iecompatible'] = '0';

// --------------------------CONFIG COOKIE--------------------------- //
$_config['cookie']['cookiepre'] = 'x1wR_';
$_config['cookie']['cookiedomain'] = '';
$_config['cookie']['cookiepath'] = '/';



// -------------------------CONFIG LANGUAGES------------------------- //
$_config['languages']['en']['icon'] = 'en.gif';
$_config['languages']['en']['title'] = 'English';
$_config['languages']['en']['dir'] = 'ltr';
$_config['languages']['ru']['icon'] = 'ru.gif';
$_config['languages']['ru']['title'] = 'Russian';
$_config['languages']['ru']['dir'] = 'ltr';
$_config['languages']['vn']['icon'] = 'vn.gif';
$_config['languages']['vn']['title'] = 'Vietnamese';
$_config['languages']['vn']['dir'] = 'ltr';
$_config['languages']['ar']['icon'] = 'ar.gif';
$_config['languages']['ar']['title'] = 'Arabic';
$_config['languages']['ar']['dir'] = 'ltr';
$_config['languages']['th']['icon'] = 'th.gif';
$_config['languages']['th']['title'] = 'Thai';
$_config['languages']['th']['dir'] = 'ltr';
$_config['languages']['tr']['icon'] = 'tr.gif';
$_config['languages']['tr']['title'] = 'Turkish';
$_config['languages']['tr']['dir'] = 'ltr';
$_config['languages']['zh']['icon'] = 'zh.gif';
$_config['languages']['zh']['title'] = 'Chinese';
$_config['languages']['zh']['dir'] = 'ltr';
//$_config['languages']['de']['icon'] = 'de.gif';
//$_config['languages']['de']['title'] = 'Deutsch';
//$_config['languages']['de']['dir'] = 'ltr';

$_config['detect_language'] = true;        // Auto-detect user language: true|false
// -------------------THE END-------------------- //

?>

vot Publish time 2011-12-21 19:54

yirihan, it is the same :)

jhoxi Publish time 2012-01-17 20:05

thankssssssssssssssssssss. :)

jhoxi Publish time 2012-01-21 08:14

Edited by jhoxi at 2012-1-21 09:18

// -------------------------CONFIG LANGUAGES------------------------- //
$_config['languages']['en']['icon'] = 'en.gif';
$_config['languages']['en']['name'] = 'English';
$_config['languages']['en']['title'] = 'English';
$_config['languages']['en']['dir'] = 'ltr';

// ----------------------CONFIG DETECT_LANGUAGE---------------------- //
$_config['detect_language'] = 1;


// -------------------THE END-------------------- //

?>config_global.php ?
go! I just understand

vot Publish time 2017-11-10 20:52

Instruction was updated.
Pages: [1] 2
View full version: How to add a new language into Discuz!ML (Multi-Lingual version)