Multi-lingual sites

    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.

    multilingualcheckbox

    Note: To use several languages locale support for those languages you wish to use needs to be installed on your server. Additionally your server requires gettext support. Contact your host if not sure.

    Backend usage

    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.

    multilingualinputs

    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 don't be confused if you see strings like {s:5:"en_US";s:9:"album title";} in your database. Zenphoto stores those contents that way even if you never used the multilingual mode to avoid data loss on enabling/disabling.

    Frontend usage

    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, for example if you 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.

    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:

    On how to have translations for the literal strings on your site please review the translation tutorial.

    SEO/Search engines

    Zenphoto provides two strategies for language specific URLs.

    Using subdomains

    The preferred 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.)

    This is the recommended strategie for multilingual sitesUsing 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 URL's of the form mydomain.com/rootfolder/language/... to set the viewer's language cookie and redirect to the URL without the language node.

    General usage

    To make search engines aware of different language versions of your site you need to do the following:

    1. Disable all languages you don't provide any content for
    2. 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.
    3. Enable the html_meta_tags plugin and its option "canonical url". This also generates <link rel="alternate" hreflang="<locale>" href="" /> type links for content in other languages except the current.
    4. Enable the sitemap-extended plugin
    5. Submit the generated sitemap to Google directly or add the link to it in your robots.txt file for them to auto discover.
    6. See the documentation on details of these plugins.

    Creative Commons LicenseThis text by www.zenphoto.org is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

    Code examples are released under the GPL v2 or later license

    For questions and comments please use the forum or discuss on the social networks.

    Related items