Russia
|
THE FIRST PROBLEM IS WHERE TO PLACE LANGUAGES
Some original Discuz plugins give us an idea how to organize the ML plugins.
Look inside any plugin, i.e. source/plugin/qqconnect/
We can see the plugin have onboard FIVE identical xml files but with different translations/encodings:
discuz_plugin_qqconnect.xml
discuz_plugin_qqconnect_SC_GBK.xml
discuz_plugin_qqconnect_SC_UTF8.xml
discuz_plugin_qqconnect_TC_BIG5.xml
discuz_plugin_qqconnect_TC_UTF8.xml
The first file is DEFAULT, but others have a suffix like LANGUAGE_ENCODING.
No need to reinvent the wheel again.
My idea is just use the same structure for add other languages, i.e.
discuz_plugin_qqconnect_AR_UTF8.xml
discuz_plugin_qqconnect_EN_UTF8.xml
discuz_plugin_qqconnect_PL_UTF8.xml
discuz_plugin_qqconnect_RU_UTF8.xml
etc.
As you can see, I have realized partially this idea...
THE SECOND PROBLEM IS HOW TO GET THE CURRENT PLUGIN LANGUAGES IN RUNTIME
For now Discuz can use ONLY ONE LANGUAGE (selected on installation).
All the language variables from all the plugins are combined into a single cache file:
/data/cache/cache_pluginlanguage_script.php = lang used in all the plugins code
/data/cache/cache_pluginlanguage_template.php = lang used in all the plugins templates
How to cache different languages for the same plugin?
There are 2 methods:
1) Do not cache languages, but read it dynamically.
It is very hard to realize, and is very slow...
2) Just save a separated cache file for every used language. (like for main templates now)
i.e.
/data/cache/cache_ar_pluginlanguage_script.php = AR lang used in all the plugins code
/data/cache/cache_ar_pluginlanguage_template.php = AR lang used in all the plugins templates
/data/cache/cache_en_pluginlanguage_script.php = EN lang used in all the plugins code
/data/cache/cache_en_pluginlanguage_template.php = EN lang used in all the plugins templates
etc.
It's much easier to realize.
I think we will go by the second road...
|
|