0 users online. Create an account or sign in to join them.Users

Search

Multi language seems to be something hard for a lot of systems. So it seems with Symphony. I search through the forum and extensions to learn how to do it the right way.

If I got it right we need 4 extensions:

  • Field Multilingual text box for input of the languages
  • Flang detection gTLDs to add language detection to .htacces for redirects
  • Frontend localisation for (also?) redirect and translate static text(?)
  • Page LHandles for translating page url and handles

But to be serious I got not the real clue how all of this magic works together.

I m a designer who likes to challenge himself with technical things to close the gap between design and code. But I m not satisfied if things just work. I love to understand things why they work that.

I hope someone got a little spare time to explain how to set up a multilingual Symphony website the proper way.

Here some rough directions!

First of all—as you already said—you need to install 4 extensions (actually 5):

  • Text Box (it’s required for being able to use Field: Multilingual Text Box)
  • Field: Multilingual Text Box
  • Flang detection gTLDs
  • Frontend Localisation
  • Page LHandles

After having installed all of them, go to System > Preferences: here you should be able to see the Frontend Localisation settings. In the Language codes field specify all the language codes of your website (it -> Italian, en -> English, etc.). After having saved the changes set the Main language and Reference language as well (this latter one will be used as a reference for the translations).

Now if you go to Blueprints > Pages > YourPage you should be able to see 3 new datasources:

  • FL: Languages
  • FL: Translations
  • PLH: Page

After having added all these 3 new datasources to YourPage, go and check its debug panel in the front end. You should be able to see 3 new nodes:

  • fl-languges, which contains all the languages currently used in your website
  • plh-page, which contains the handles of the page you’re in in all the different languages
  • fl-translations, which (for now) contains nothing—you can add some customized nodes going to Translations > Translation in the back end—it’s usefull since it allows you to serve some translations of redundant pieces of information you need in all the pages all at once

You can create a menu to switch from one language to another in the current page by using the data contained in the nodes fl-languages and plh-page.

If you have a datasource pulling the data contained in a section having a Field: Multilingual Text Box attached to YourPage, you should be able to see those data changing when you switch from www.yourwebsite.com/en to www.yourwebsite.com/it (for example).

I hope I’ve not forgotten anything else: some months have passed since the last time I created a multilingual website….

Thanks for the explanation, I get the big picture better now

Well explained, @theBigMandarino. I'll link others to your post when they need some info.

@plenaforma, I’m glad to hear you have better picture now!

When I approached the matter the first time I was a bit confused too: there are several threads on the topic scattered all over the forum but—since some of them refer to old and/or deprecated extensions or old ways of doing—it’s a bit difficult to cream off and make head of them at first.

@vladG, I’m happy to hear the explanation works—I was worried about having forgotten something: there’s still some hope after all ;-).

Thank you for taking care of the multilingual extensions mentioned above: they are indeed very useful ones!

I'm going to be adding languages to a site relatively soon, and this run-through looks like it's going to be very useful. Thanks.

[RESOLVED!]

Hi guys, I can't use the Translations menu, have a explain how to use?

I'm only receive:

<fl-translations>
<error>Nothing here</error>
<error>Nothing here</error>
</fl-translations>

Hi All, I have installed all of the above. I made a simple prototype and everything was working as expected, but now. It just stopped working. The data is not correctly pulled from the multiligual field.

My website is set to en: (url: www.website.com/en)

Fl languages shows:

<fl-languages>
    <current-language handle="en" language="en" region="">English</current-language>
    <supported-languages>
      <item handle="nl" main="yes">Nederlands (Netherlands)</item>
      <item handle="en">English</item>
    </supported-languages>
  </fl-languages>

The fl-translations are correct aswel. But the multiligual textfield data is still set to the default language?

<title mode="formatted" handle="titel-in-het-nl" word-count="4" handle-nl="titel-in-het-nl" handle-en="titel-in-het-en"><![CDATA[Titel in het NL]]></title>

I have no idea what went wrong. Can someone push me in the right direction here? Thanks.

Ok, it was the: "Use value from main language if selected language has empty value" checkbox. Problem fixed with this one: https://github.com/6ui11em/multilingual_field/issues/45.

Now I will have to look for an alternative navigation data source to translate the menu.

I presume you need to install page-lhandles extension to tkae care of the languages for the menu. This will use the 'normal' navigation data-source and fix it up for you. You might need to slightly modify the template.

Hmm, I have installed the page-lhandles extension. But it doens't do anything with the navigation datasource as fas as I can see. I understand it should?

trying to remember I haven't got one just here; it provides an additional datasource; which you could use to get the handles for the same page for different languages. but I think it should do something to your navigation... I'll double check with one of my installs tomorrow.

That would be great!

Installing the Page LHandles extension changes the XML output of a standard navigation datasource—for more details on the new structure have a look at the readme—and it allows you to add a new datasource named “PLH: Page” to each page.

Such a datasource outputs the handle and the title of the current page in all the different languages and you can use it as a base for building the menu to switch from one language to another.

Erm, I think there's a small problem at the moment with PageLHandles. See opened issue. I'll fix it this weekend.

Aha, ok :). That clears things up :D. Thanks vladG

I have successfully got two languages up and running. /en/ and /se/. But how do I write link that picks up my current language?

This is what I have so far:
«a href="{$root}/products/{product-name/@handle}" »The product name«/a»

My guess is that I need to insert variable containing the current language here: «a href="{$root}/$LANGUAGE/products/{product-name/@handle}"»The product name«/a»

But what and how should I write?

depending on which extensions you're using there should be an XML node with a current-language handle somewhere. $LANGUAGE in your example would become {/path/to/current-language/@handle}

I specify a $base-url parameter in my master stylesheet, that uses a choose statement to check whether a language is set, and not default, and appends it to $root or not.

I use a very custom hacky multi-lingual though, so wouldn't translate perfectly, but here's an idea...

<xsl:variable name="base-url">
    <xsl:choose>
        <xsl:when test="">
            <xsl:value-of select="concat($root, '/', /path/to/current-language/@handle)"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="$root"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

My hack uses a rewrite in htaccess, and a custom extension, to force the url param to a GET parameter but leave the url intact.

I then use $base-url in place of $root throughout the site's stylesheets. For JIT I still always use $root though for the rewrite rules to kick in.

@designermonkey Thanks. But is a "hack" really needed?

Doesn't Page LHandles ( or Flang detection gTLDs or Frontend Localisation?) provide a variable that tracks which language is selected?

@s_e how would I use {/path/to/current-language/@handle} ? Tried this, but didn't work:

"{$root}/{/path/to/current-language/@handle}/products/{product-name/@handle}"

also tried this:

"{/path/to/current-language/@handle}/products/{product-name/@handle}"

And I just realised that I need /products/ to be "dynamic" as well...

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3, 5.4, 5.5 or 5.6
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details