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

Search

A new extension, "Multilingual" is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

This isn't meant to replace existing multilingual (field) extensions, it's a completely different approach that mostly relies on core functionality and normal fields.

Thanks Jens. It's always nice to see different approaches. The fallback to main lang is something that I've always considered important but never got it working in the other extension. Will be interesting to try it out soon!

I like this simple approach.

this is the exact method I used last year for a site that offered content to 6 different languages.

Each language had a different publish tab, with fields named identically to the default language but with the language appended after it.

For those interested, I made a simple language detection extension based on the browsers settings, and coupled it with a utility for finding nodes with the same name with the browsers language.

this is the exact method I used last year for a site that offered content to 6 different languages.

Yeah, it's nothing new, really. The extension basically just helps a little with that approach.

For those interested, I made a simple language detection extension based on the browsers settings

My extension does this kind of detection as well, but setting the language as part of the URL, not as a GET-parameter. So you have different URLs for different languages which makes it easier to share content in the language you intended. It also has some SEO benefits and allows for parameter localization.

If you take a blog, for example, you have different URLs for the same article:

/en/blog/hello-world/

For the english version.

/de/blog/hallo-welt/

For the german version.

and coupled it with a utility for finding nodes with the same name with the browsers language

Interesting, will have a look at it.

sorry I didn't mean for that first statement to come across as snippy! What I meant by it was, I agree with your approach! The other approaches seem bug ridden and overly complicated whereas your approach is simple and effective.

I like your use of the language code in the url permanently. I didn't take that approach and opted for using sessions instead because we had an icon in the top right of the page letting users know which language was selected :)

I'll try this extension! I recently create a project with "this" approach, using page-handles, frontend localisation and multilingual textbox field extensions!

If there's only one extension to do this, it is very interesting!

sorry I didn't mean for that first statement to come across as snippy!

No worries, didn't take it that way. I've already seen this approach on the forum multiple times. But the datasource problem (especially the filtering) hasn't been solved in a convenient way before, so I gave it a shot. Just wanted to point out a few things to give users a better understanding of what to expect from this extension.

The other approaches seem bug ridden and overly complicated

That's why I wanted to keep it simple. It's definitely more work and not as convenient to set up, but also more flexible (any field can be multilingual) and robust (relies mostly on core functionality and delegates, doesn't change the database).

If there's only one extension to do this, it is very interesting!

You can definitely implement a multilingual site with only this extension, but keep in mind it's not an out of the box solution for everything.

For example, it doesn't take care of multilingual page handles. But depending on what you want to achieve, you can easily combine it with other commonly used extensions like URL Router.

For translating static text in templates, I use a remote datasource that pulls in a simple XML-file filtered by the $language-parameter.

I still have to outline some of these options in the readme, but you would be surprised how much is possible with mostly core functionality.

Dear author, sorry, but how can i filter my DS by page param {$language} ? E.g. i have a navigation section with title _en, title _de and the link text field. So how can i filter it to give me only en when user requests /en url?

Oops...sorry, i've understood the idea :-)

Oops...sorry, i've understood the idea :-)

Glad you figured it out. I'll try to answer your question anyway, just in case other people run into the same difficulties.

Dear author, sorry, but how can i filter my DS by page param {$language} ? E.g. i have a navigation section with title _en, title _de and the link text field. So how can i filter it to give me only en when user requests /en url?

You need to name your fields like title-en, title-de in order for this to work. Datasources are then filtered by title-en (or whatever your first/primary language might be), the extension will switch the filter to the field for the current language automatically.

Thanks for the reply. One more popular question (suppose so) please. You automatically set the initial default language (e.g. opening http://mysite.com redirects visitor to http://mysite.com/en with setting the $language to "en"). What if the user clicks the "de" button to switch the language? Of course i can manually redirect him to /de, but how to replace all other links from /contacts, /about, etc to /de/contacts, /de/about, etc...

What if the user clicks the "de" button to switch the language? Of course i can manually redirect him to /de, but how to replace all other links from /contacts, /about, etc to /de/contacts, /de/about, etc...

First, a general advice, independent from this extension.

You should use the $root-parameter to dynamically create absolute pathes for your links. Makes it easier to run a Symphony site from a subdirectory, for example when you want to preview it to a client or combine it with other systems.

<a href="{$root}/about/">...</a>

Also, this appoach comes in very handy when using the Multilingual-extension.

I usually create a second, multilingual $root-parameter (called $base) in my XSLT.

<xsl:variable name="base" select="concat($root, '/', $language)" />

Example:

<a href="{$base}/about/">...</a>

Btw. currently working on the 1.2 update with bug fixes and a few changes, stay tuned.

Too bad that this page doesn't have "+1" or "like" yet :-) Thanks a lot Jens!

This approach for a multilingual website is great. Other ways usually use a lot of extensions and that implies some bugs to deal with.

But I'm quite new to Symphony and all the coding part (xPath, XSLT). Is there a way to change the title of the page?

Is there a way to change the title of the page?

You could create a meta section for pages where you can store multilingual content like title, description, etc. for each page.

You then include a datasource for this section on every page. The Pages Field extension might come in handy for filtering the datasource and spitting out the correct data for each page.

In your template:

<xsl:variable name="meta" select="/data/meta/entry" />

...

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

Will publish a more in-depth tutorial to cover most of your questions, just give me another day or two.

Hi, Does this extension process every datasources associated to a page? Maybe I'm missing something but I have a page with two DS but only one is filtered by your extension

I've got it. It doesn't work because my DS is grouped by Date. From your extension source it seems you only check first level of "group". In my case 'entry' is under year > month sub-group.

I've got it. It doesn't work because my DS is grouped by Date. From your extension source it seems you only check first level of "group". In my case 'entry' is under year > month sub-group.

Ah thanks, never thought of that. Will fix this.

Still working on better documentation by the way, but takes a little longer than expected.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.1
  • 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