1.2.1releasedMultilingual

Provides basic helpers for multilingual projects.

Clone URLhttps://github.com/twiro/multilingual.git

Add as a submodulegit submodule add https://github.com/twiro/multilingual.git extensions/multilingual --recursive

Compatibility

2.x.x2.1.x2.2.x2.3.x2.4.x2.5.x2.6.x2.7.0
NoNoNoNo1.2.11.2.11.2.11.2.1

Readme

Multilingual

Multilingual extension for Symphony.

Configuration

Go to System › Preferences and provide a comma-separated list of ISO 639-1 language codes in the "Multilingual"-section of your preferences screen.

Preferences

The first language in your list is considered the default language.

The $languages and $language parameters will be added to your XML output.

<params>
    <languages>
        <item handle="en">en</item>
        <item handle="de">de</item>
    </languages>
    <language>en</language>
</params>

Sections: Fields

The very special approach of this extension (reduce reliance on too many third party extensions, leave as much to core functionality as possible) doesn't require special multilingual field types.

Use whatever (non-multilingual) field type you like by adding a dedicated field for each of your supported languages.

Sections: Fields

You just need to make sure that each translation of field shares the same field handle, followed by a dash and the language code as specified in your settings.

In most cases, it's recommended to mark at least all fields for the default language as required.

Translations for a field can always be optional.

Sections: UI

To provide your clients with a clean and simple user interface, you should use an additional UI extensions like Parenthesis Tabs.

Sections: UI

Data Sources: Filters

You only have to add the fields by which you want to filter your data sources in the default language.

Data Sources: Filters

The extension takes care of filtering your entries in the current language and falls back to the default language for a specific filter, if no translation is provided.

Data Sources: Output

Make sure to select all languages for a field in the data source editor's "XML Output"-section.

Data Sources: Output

The extension removes the language segment from the field name and provides lang- and translated-attributes instead.

<entry>
    <title lang="en" translated="yes" handle="the-extremes-of-good-and-evil">
        The Extremes of Good and Evil
    </title>
    <title lang="de" translated="yes" handle="das-hoechste-gut-und-uebel">
        Das höchste Gut und Übel
    </title>
</entry>

In your XSLT, you can now use the $language-parameter to get the translation for the current language.

<xsl:value-of select="title[@lang = $language]"/>

If a translation isn't provided for a specific language, the extension provides a fallback to the default language in your XML output.

<entry>
    <title lang="en" translated="yes" handle="the-extremes-of-good-and-evil">
        The Extremes of Good and Evil
    </title>
    <title lang="de" translated="no" handle="the-extremes-of-good-and-evil">
        The Extremes of Good and Evil
    </title>
</entry>

You can check if a field has actually been translated or uses fallback content by testing the translated-attribute.

<xsl:if test="title[@lang = $language]/@translated = 'yes'">
    <xsl:value-of select="title[@lang = $language]"/>
</xsl:if>

Version history

Symphony 2.3.3 to 2.x.x

        - Fix support for PHP 5.3 ([#16](https://github.com/twiro/multilingual/issues/16))
	        - Mark as compatible with PHP 7.0
	

Symphony 2.3.3 to 2.x.x

        - Added support for "Association Output"
	

Symphony 2.3.3 to 2.x.x

        - Added changes for compatibility with Symphony 2.x.x
	        - Added attribute `translated` to indicate when fields fall back to default language
	        - Fixed issue where conflict with other extensions produced fatal error and nasty side effects
	        - Fixed issue with datasources that are grouped by date field
	

Symphony 2.3.3 to 2.3.x

        - Fixed issue where some field types always showed fallback content (default language) instead of translation
	        - Extension no longer interferes with page routing (language segment is no longer removed from path internally before resolving a page)
	        - Language detection and redirection now happens in the `FrontendPrePageResolve`- instead of the `FrontendParamsResolve`-delegate
	        - Changed XML output for multilingual fields (removed language segment from field names, added `lang`-attribute instead)
	        - Removed `$multilingual`-parameter from XML output
	        - Minor refinements
	

Symphony 2.3.3 to 2.3.x

        - Fixed a critical issue where output parameters weren't passed correctly to chained datasources
	        - Removed `$root-ml`-parameter
	        - Introduced `$multilingual`-parameter
	        - Minor refinements
	

Symphony 2.3.3 to 2.3.x

        - Experimental release