Problems with multiple language support that need more thinking and discussion.
Contents
Who wants those translated system and help pages?
This is a common message on our mailing list:
Hi. Is there an easy way to delete all the foreign-language help? (Which, for me, means non-English.) It really clutters up search results.
For many people, 700 pages in languages your wiki users can't or don't want to read and installed behind your back are not welcome. Those pages:
- clutter up search results,
- slow down search in medium to small wikis,
- get served behind your back with content that you did not write and can't even read, and
get spidered by search engines again and again, wasting your bandwidth.
Those pages are needed in the special case of international wiki that want to serve help pages in many languages. I don't have data on how much this feature is needed, but its the number one problem I have with each new wiki I install.
Solution
You can remove all languages from your underlay directory and then download only the LanguagePackages you need and install them. An easy to use install and remove script will be available soon.
Other solutions to this problems are found in RemovingUnwantedLanguages and in PackageInstaller.
Secret translated FrontPage
MoinMoin will serve a translated template FrontPage in the user language. That page contains the translated version of FrontPage, which say nothing about your wiki. When a visitor visit your wiki in the first time, and his browser is set to require other language than your wiki language, he will get one of the translated FrontPages MoinMoin hides in your underlay directory.
These are needed only in one case, a multi language wiki, like [MainPage: WikiPedia] which is actually not one wiki but a big farm of wikis connected by interwiki links. In short, nobody needs that feature.
Even worse, those pages are not considered as members of SystemPagesInLanguageGroup, so if you used a script that remove all members of system pages from unwanted languages, you will be left with the translated front pages.
Solution
There is a fix for this problem, set page_front_page in the wiki configuration to a name that is not translated, like "Home":
page_front_page = u'Home'
Now all users will get your special front page, and not a translated page.
See RemovingUnwantedLanguages for details how to get rid of translated front pages.
Mis-configured browsers
Most users do not know you can configure your browser language. On some cases (Safari and Hebrew user) the browser will be always configured in a wrong way, requiring English instead of Hebrew.
In this case, visitors might not get the language they want to get, or the language you want to serve. This has severe effect for an Hebrew wiki, when you design your wiki for right to left only and visitors get your wiki in English, in left to right - and your wiki header look visually broken.
To fix this problem, you should either patch the code that check the browser language, or disable unwanted languages, as described in RemovingUnwantedLanguages. Disabling unwanted languages may be the best solution for a local wiki.
Download patch: ignore-browser-lang.patch -- similar fix committed to moin 1.5 branch
Another solution
To force moin to use a certain language, you can add this to your moin.wsgi (when using wsgi, tested with 1.7.2) or wikiconfig.py (untested):
import MoinMoin.i18n MoinMoin.i18n.requestLanguage = lambda request, try_user=None: 'nl'
why not language_default = "en" and language_ignore_browser = True in wikiconfig.py?
Solution
Add languages configuration option:
# use 'en' as default, allow all other languages, usable for this wiki, which # use for international project. Keep the behavior of previous versions. [Default] available_languages = None # setup for local wiki that publish also English and French content. the first # item in the list is the `default_lang` available_languages = ['de', 'en', 'fr'] # local wiki that serve only German content available_languages = ['de']
This may be enough to solve also the translate system and help pages problem, if we ignore all pages not in languages not in this list. We can keep the current directory structure, ship all pages like we do today, and there is no need to add or remove pages. The wiki need to keep the available page list in some cache, so you don't have to read all pages to get the page language each time.
Another alternative is to have each language files in a separate package - both the .po and .py files, together with the system and help pages. You will be able to install or remove the package with one step, either by simple move in the file system, or by a script that install or remove the files. For example, we can put the language file in the farm plugin directory. In this case, no change is needed in the configuration.
farm/ bin/ moin.cgi config # farmconfig plugin/ language/ en/ pages/ # contain system and help pages in en dict # file with python dict, or mo file ... # macros, actions etc. wikis/ wiki_a/ config # wikiconfig pages/ ... wiki_b/ config # wikiconfig pages/ ...
In this setup, you simply drop 'en' directory inside the farm plugin to install everything related to en, and remove the directory to remove the language from the wiki.
The wiki can get its language list by listing the plugin/language directory.