Hi!
Let me present you one package (snippet + plugin) for multilanguage, an alternative of the so far known ones. I don’t see myself as a PHP developer (at least not a good one) but I really tried to reduce the resources required in the work to the minimum. All things are tested and they work. In order to avoid dissatisfied people I have to mention that this is alpha or pre-alpha :-j version. I’m sure that there are more things to be made so the code can be better, faster, etc. I’m open to your ideas and optimization of the code.
Let me present you Multylingo
The package Мultylingo (the snippet and the plugin) allows the construction of a full-featured multilingual site without the requirement of making extra templates. You can also customize error pages in every language. You can use them in a combination or separately persuant to your needs. There are no problem to another plugins and snippets (at least in the texts). It is tested on MODx 1.0.4 с PHP 5.2.4 but I think that it will work without any problems if you use it with older version of MODx 0.9.6.3 and PHP 4.x. If you have any questions, I’m here to answer them. If I have difficulties with the answer I hope the others who know about such stuff can help to figure it out.
For more information about the usage of the package you can read the file readme.txt
Snippet is used in the following way:
[[Multylingo? &parents=`2,3,4,5,6` &default_lang=`en` &textchunk=`examle`]]
In &default_lang you must enter the two-letter abbreviation of the main language that you use on your site (it is positioned in the main folder )
In &parents you must enter the folders of the rest of the languages - the second, third or more languages you have (up to the 6th) It’s good to follow this sequence when you enter the elements from chunk
In &textchunk you enter the name of the chunk who serve to show the text according to the different languages. Its use is described below
The first two elements &parents и &default_lang are required and obligatory, and &textchunk is used only if you want (by preference)
It’s important the documents which are entered as main folders of the languages to have alias for &parents and the main language to be entered (&default_lang ) according to the following model:
http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
As a result of snippet you can bring out the following Placeholders
[+lang-big+] - shows the language of the following snippet automatically according to the following language (where the document is). It can be used for Ditto, Jot, etc.
[+lang-ids+] - shows the following parent according to the following language (placement of the folder). It can be used in AjaxSearch or others
[+text1+] , [+text2+] ... [+text10+] Shows following text from the given in advance in the chunk (it’s taken from &textchunk ) according to recommendations below.
Plugin Multylingo
Used to display 404 pages for various languages.
This code is based on my code here:
http://modxcms.com/forums/index.php/topic,46636.msg274624.html#msg274624
Developed here:
http://modxcms.com/forums/index.php/topic,46636.msg274991.html#msg274991
The following System Events should be checked:
[X] OnPageNotFound
In order to work it’s necessary to be activated for SEF of the addresses and Use Friendly URL alias path
In $parents are mentioned the Id addresses of the languages where their alias is extract automatically
It works only with two-letter aliases of parents addresses of the languages (it can be easily remake)
English country names and code elements ISO 3166-1 and the corresponding ISO 3166-1-alpha-2 code elements
http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
The maximum number of languages is 6 (5+1). 5 given and one main who is extract automatically
In $parents are mentioned ID addresses of the folders of the following languages without first.
The maximum number pages for errors in the languages is 6 (5+1). 5 given and one 404 which is extract automatically (site’s main page)
In $langs_404 are mentioned ID addresses of 404 errors in the sequence you put themin $parents