| |
| | |

CodersClub

 Forgot password?
 Register
Search
View: 25598|Reply: 10
Collapse the left

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

  [Copy link]

 Russia

Post time: 2011-10-30 17:25
| Show all posts |Read mode
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:
  1. //-----------------------------------------------------------------------
  2. // Multi-Lingual support by Valery Votintsev
  3. //-----------------------------------------------------------------------
  4. // "icon" - flag image file name;
  5. // "name" - language name in NATIONAL language;
  6. // "title" - language name in ENGLISH language;
  7. // "dir" - text direction:
  8. //        'ltr' (Left To Right)
  9. //        'rtl' (Right To Left), i.e for Arabic, Hebrew, Urdu, etc.
  10. //-----------------------------------------------------------------------
  11. // Uncomment a language line for enable the language!
  12. // Comment a language line that is not required!!!
  13. //
  14. // Enabled Language List:

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


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


5) Edit your configuration file /config/config_global.php:
Find this lines:
  1. // -------------------------  CONFIG LANGUAGES  ------------------------- //
  2. $_config['languages']['sc']['icon'] = 'zh.gif';
  3. $_config['languages']['sc']['name'] = '简体中文';
  4. $_config['languages']['sc']['title'] = 'Simplified Chinese';
  5. $_config['languages']['sc']['dir'] = 'ltr';
  6. $_config['languages']['sc']['code'] = 'zh-CN';
  7. $_config['languages']['tc']['icon'] = 'tw.gif';
  8. $_config['languages']['tc']['name'] = '繁體中文';
  9. $_config['languages']['tc']['title'] = 'Traditional Chinese';
  10. $_config['languages']['tc']['dir'] = 'ltr';
  11. $_config['languages']['tc']['code'] = 'zh-TW';
Copy the Code


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


  1.     $_config['languages']['vn']['icon'] = 'vn.gif';
  2.     $_config['languages']['vn']['name'] = 'Tiếng Việt';
  3.     $_config['languages']['vn']['title'] = 'Vietnamese';
  4.     $_config['languages']['vn']['dir'] = 'ltr';
  5.     $_config['languages']['vn']['code'] = 'vi-VN';
Copy the Code


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":
  1. // $_config['languages']['vn']['name'] = 'Tiếng Việt';
  2. // $_config['languages']['vn']['title'] = 'Vietnamese';
  3. // $_config['languages']['vn']['dir'] = 'ltr';
  4. // $_config['languages']['vn']['code'] = 'vi-VN';
Copy the Code


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 language  with 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:

  1. // -------------------------  CONFIG LANGUAGES  ------------------------- //
  2. $_config['languages']['sc']['icon'] = 'zh.gif';
  3. $_config['languages']['sc']['name'] = '简体中文';
  4. $_config['languages']['sc']['title'] = 'Simplified Chinese';
  5. $_config['languages']['sc']['dir'] = 'ltr';
  6. $_config['languages']['sc']['code'] = 'zh-CN';
  7. $_config['languages']['tc']['icon'] = 'tw.gif';
  8. $_config['languages']['tc']['name'] = '繁體中文';
  9. $_config['languages']['tc']['title'] = 'Traditional Chinese';
  10. $_config['languages']['tc']['dir'] = 'ltr';
  11. $_config['languages']['tc']['code'] = 'zh-TW';
Copy the Code


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


  1.     $_config['languages']['vn']['icon'] = 'vn.gif';
  2.     $_config['languages']['vn']['name'] = 'Tiếng Việt';
  3.     $_config['languages']['vn']['title'] = 'Vietnamese';
  4.     $_config['languages']['vn']['dir'] = 'ltr';
  5.     $_config['languages']['vn']['code'] = 'vi-VN';
Copy the Code


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 !



 Palestine

Post time: 2011-10-31 13:40
| Show all posts
تم تعديله بواسطة  khalid في  2011-10-31 14:43

Whats about js file

Is it change when i change languge ?

 Russia

 Author| Post time: 2011-10-31 13:45
| Show all posts
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.

Comments

OH , i found it :)  Post time 2011-10-31 13:54

 China

Post time: 2011-12-01 12:59
| Show all posts
In Discuz_X2.0_ML_UTF8_20111011_by_vot_Rev_167.rar

config_global.php not found the code:
  1. $ _config ['languages'] = array (
  2. 'en' => array ('icon' => 'en.gif', 'title' => 'English', 'dir' => 'ltr'),
  3. / / 'Zh' => array ('icon' => 'zh.gif', 'title' => 'Chinese', 'dir' => 'ltr'),
  4. / / 'De' => array ('icon' => 'de.gif', 'title' => 'Deutsch', 'dir' => 'ltr'),
  5. / / 'Ru' => array ('icon' => 'ru.gif', 'title' => 'Russian', 'dir' => 'ltr'),
  6. / / 'Vn' => array ('icon' => 'vn.gif', 'title' => 'Vietnamese', 'dir' => 'ltr'),
  7. / / 'Ar' => array ('icon' => 'ar.gif', 'title' => 'Arabic', 'dir' => 'rtl'),
  8. );
Copy the Code

Open your configuration file /config/config_global_default.php,

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

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


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

Copy the Code

That's all.

 Russia

 Author| Post time: 2011-12-01 13:23
| Show all posts
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.

Post time: 2011-12-21 18:00
| Show all posts
// --------------------------  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  -------------------- //

?>

 Russia

 Author| Post time: 2011-12-21 19:54
| Show all posts
yirihan, it is the same
Post time: 2012-01-17 20:05
| Show all posts
thankssssssssssssssssssss.
Post time: 2012-01-21 08:14
| Show all posts
Edited by jhoxi at 2012-1-21 09:18
  1. // -------------------------  CONFIG LANGUAGES  ------------------------- //
  2. $_config['languages']['en']['icon'] = 'en.gif';
  3. $_config['languages']['en']['name'] = 'English';
  4. $_config['languages']['en']['title'] = 'English';
  5. $_config['languages']['en']['dir'] = 'ltr';

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


  8. // -------------------  THE END  -------------------- //

  9. ?>
Copy the Code
config_global.php ?
go! I just understand

 Russia

 Author| Post time: 2017-11-10 20:52
| Show all posts
Instruction was updated.
You have to log in before you can reply Login | Register

Points Rules

Archive|Mobile|Dark room|CodersClub

Top.Mail.Ru
Top.Mail.Ru

2024-11-23 10:41 GMT+3 , Processed in 0.091494 sec., 10 queries .

Powered by Discuz! X3.4 Release 20230520

© 2001-2024 Discuz! Team.

MultiLingual version, Rev. 4301, © codersclub.org

Quick Reply To Top Return to the list