1
phppp
xLanguage 2.0
  • 2005/6/24 15:32

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


xlangauge 2.0

An eXtensible Multi-language content and character encoding Management Module+Hack

Multilanguage management handles displaying contents of different languages, like English, French and Chinese
Character encoding management handles contents of different encoding sets for one language, like GB2312 (Chinese Simplified) and BIG5 (Chinese Traditional) for Chinese.


What xlanguage CAN do:
1 displaying content of specified language based on user's dynamic choice
2 converting content from one character encoding set to another


What xlanguage canNOT do:
1 xlanguage does NOT have the ability of translating content from one language to another one. You have to input contents of various languages by yourself
2 xlanguage does NOT work without adding one line to XOOPS/include/common.php (see guide below)
3 xlanguage does NOT have the ability of converting content from one character encoding to another if none of "iconv", "mb_string" or "xconv" is available.


Features:
1 auto-detection of visitor's language on his first visitor
2 memorizing users' langauge preferences
3 switching contents of different languges/encoding sets on-fly
4 supporting M-S-M mode for character encoding handler


Note:
M-S-M: Multiple encoding input, Single encoding storage, Multiple encoding output.
M-S-M allows one site to fit various users with different language character encoding usages. For example, a site having xlanguage implemented porperly allows users to input content either with GB2312, with BIG5 or UTF-8 encoding and to store the content into DB with specified encoding, for say GB2312, and to display the content either with GB2312, with BIG5 or with UTF-8 encoding.


User guide:

1 upload "xlanguage" folder to XOOPS/modules/

2 insert one line
include_once XOOPS_ROOT_PATH.'/modules/xlanguage/api.php';
into XOOPS/include/common.php
RIGHT BEFORE
// #################### Include site-wide lang file ##################
if ( file_exists(XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/global.php") ) {
include_once XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/global.php";
} else {
include_once XOOPS_ROOT_PATH."/language/english/global.php";
}

3 add basic langauges and extended languages from xlanguage's module preference page

4 make the block "langauge selection" visible through system=>block

5 if you use the encoding conversion management only, for instance, switching Schinese and Tchinese, congratulations, you have made it!

6 if you use multi-language contents management, adding content with corresponding tags to your content management modules:
[languagecode]Content of the language[/languagecode]
languagecode should be the "language code" of each ___basic___ language configured in module admin area, can be for one single language or multiple languages, example:
[english]This is my content in English[/english][french]*&^%(sorry, I do not know how to type it -- D.J.)[/french][schinese]ÖÐÎÄÄÚÈÝ[/schinese]
OR:
[english|french]This is my content in English or in French[/english|french][schinese]ÖÐÎÄÄÚÈÝ[/schinese]
You should not use the tag of "schinese" and "tchinese" together since the content will be converted from one to the other automatically using iconv, mbsting or xconv according to your system configure.

7 xconv module is suggested to Chinese users (module available at https://xoops.org.cn)


Credits:
1 Adi Chiributa - webmaster@artistic.ro, language handler
2 wjue - http://www.wjue.org, ziling BIG5-GB2312 conversion
3 GIJOE - http://www.peak.ne.jp, easiest multilanguage hack


Note:
1 download: https://xoops.org.cn/modules/wfdownloads/singlefile.php?cid=8&lid=297
2 look forward to your feedback so that it could be released at xoops.org ASAP

2
davidl2
Re: xLanguage 2.0
  • 2005/6/24 16:08

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


That seems very very painless to apply!

3
karedokx
Re: xLanguage 2.0
  • 2005/6/24 17:57

  • karedokx

  • Quite a regular

  • Posts: 319

  • Since: 2004/7/1 6


phppp,
what is the different/advantage of this module compare to gijoe's emlh?

question:
if we apply this multilanguage feature, for example we offer 2 language: english and french, will it double the size of the webpage we return to the client (as the content size has technically been doubled)?

or the module will be smart enough to return the related content to the users?

4
phppp
Re: xLanguage 2.0
  • 2005/6/24 23:59

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


Quote:

karedokx wrote:
phppp,
what is the different/advantage of this module compare to gijoe's emlh?


In one word, GIJOE's eml is a hardcoded "hack" (could not find an appropriate word), handling multi-language content parsing and displaying.
xlanguage is a module with backend management, handling both multilanguage content and multi-encoding content, as well as user local language auto-detection. You could set all languages you need from module preferences. Another feature you might not use it: content can be automatically converted to proper encoding for a multi-encoding language (extremely useful to Chinese users).

For multi-language content parsing, xlanguage use GIJOE's regexp function and expands it.


Quote:

question:
or the module will be smart enough to return the related content to the users?

It will return contents of required language only.


Note:
As dicussed before, the current multi-language handling techniques, which are based on tag parsing, have much limitation and I think it is ok to use as hacks or third-party module, but not ready for XOOPS core.
I have been building a production site with the xlanguage and an experimental technique. Will share my thoughts after XOOPS 2.2 released.

5
karedokx
Re: xLanguage 2.0
  • 2005/6/25 18:37

  • karedokx

  • Quite a regular

  • Posts: 319

  • Since: 2004/7/1 6


thanks for your explanation phppp.

keep the good work. i really appreciate your work and contribution...

Login

Who's Online

175 user(s) are online (105 user(s) are browsing Support Forums)


Members: 0


Guests: 175


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits