Multi-lingual sites Sep 23, 2010 / Updated: May 18, 2013
Zenphoto is fully capable of running multilingual sites if you want to provide your content in more than one language. "Content" means data stored in your database such as image and album descriptions.
The multi-lingual mode option
For these to have multiple languages you will need to have the multi-lingual check box checked in your gallery configuration.
Once this option is enabled, each edit field in the back-end will have multiple inputs, one for each configured language. You then just fill in the translation for each language you wish to support manually. This also works for plugins that provide text options if they are setup for multilingual use.
Note: The contents of each language still share the same database field (e.g. title or description) but it is divided and technicall stored as a serialized string. So if you once use the multi-lingual mode and then disable it you will loose all the other languages strings as they will be replaced by the one then used language.
If you enabled the language selector plugin dynamic_locale visitors of your site will be able to select their preferred language. You also may set that the language is set automatically by the visitor's browser language setting.
If no language content exists if you for example have set English and French but didn't add specific French content yet, visitors will get the next avaiable text shown - English in this case.
If there is only one description that will be what is shown to all visitors. If there is for example an English and other translations and the visitor's preference is none of the languages he will still get the English text.
Disabling unneeded languages / adding languages
Languages are installed in zp-core/locale/ and refer to the gettext translation for non content literal strings on the backend and theme. Please read the translation tutorial for more info about this.
You may not need all of the translations, then you can just remove those unneeded language folders. With Zenphoto 1.4 on you can disable unneeded languages via the backend as well.
Note: To use several languages locale support for those languages needs to be installed on your server. Contact your host if unsure.
It might also happen that you want to provide content in a language Zenphoto does not have a language file for. In that case just create an empty locale folder of your language like zp-core/locale/de_DE. Then you will be able to switch to that language even if the backend and such will not be translated.
On theme side there are several plugins to let visitors switch their preferred language. There are two officially included plugins for this:
How to have translations for the literal strings on your site please review the translation tutorial.
Zenphoto provides two strategies for language specific URLs.
The prefered mechanism is to use subdomains to indicate the language of the site. Your should set the language option to your primary language. The main domain then will render in this language. The alternative languages will be in the form language.domain where language is the two letter language code, e.g. fr for French. (If you support more than one variant of a language you will need to use the full locale, e.g. zh_cn, zh_tw.)
This requires that you have created the appropriate subdomains pointing to your Zenphoto installation. That is fr.mydomain.com/zenphoto/ must point to the same location as mydomain.com/zenphoto/. (Some providers will automatically redirect undefined subdomains to the main domain. If your provider does this, no subdomain creation is needed.)
Using the seo_locale plugin
The alternate strategy is to use the seo_locale plugin.This plugin requires that mod_rewrite be set. It provides for interpreting URLs of the form mydomain.com/rootfolder/language/... to set the viewer's language cookie and redirect to the URL without the language node.
To make search engines aware of different language versions of your site you need to do the following:
- Disable all languages you don't provide any content for
- Enable your selected strategy:
- For subdomain locales check the Use subdomains option (dynamic_locale or sitemap-extended plugins, Zenphoto version 1.4.3 and later..
- For URL locales enable the seo_locale plugin which provides language change via URL.
This work by www.zenphoto.org is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.