Search

Hello,

What’re the best practices for developing a multilingual website?

Thanks in advance!

Depends on the use case, really… Can you be more specific?

Suppose I want to build a blog and an author can publish content in different idioms (i.e. english and spanish). The question is how I should build my sections, which extensions are recommended.

I’m also thinking of creating a XML file for keeping the translation of some static content. Are there any specific schema that I should use?

What do you think?

I found an interesting article about XML-based localization pack.

Localization based on human translation or machine translation?

While I don’t have any best practices it seems like you should consider both and choose the one that fits best with your audience. Has machine translation improved drastically in recent years?

I was just looking for a standard XML format that’s common to use for translations. I think it’s better to use a Static XML for localization strings, Don’t you?

I believe there is some emerging standard for storing translations in static XML, but I forget.

For a recent project we went with a Section and Static XML hybrid. There is a Languages section:

  • Name (e.g. English)
  • Abbreviation (e.g. en)

This is used to create a language-switcher dropdown, and for use in the URL. An .htaccess rule looks for the /en/ at the start of the URL and passes this to all pages as a GET parameter language which can then be accessed in the XSLT using {$url-language}.

Large chunks of text that needed to be content-managed (and use Markdown) are stored in their own section with a Select Box of the language abbreviation. This content is pulled into pages using a DS filtering on the language variable above.

Static content such as anchor labels, navigation/menu items and so on and stored in an XML file, something like:

<labels>
    <label handle="strapline">Our Campaign to Save Children's Lives</label>
</labels>

Each language has its own XML file, such as labels.en.xml. These are pulled into the XSLT using the document() function:

<xsl:variable name="labels" select="document(concat('labels.', $url-language, '.xml'))/labels/label"/>

And to write the value of a label:

<xsl:value-of select="$labels[@handle='strapline']"/>

Hope that helps a little.

Thanks, it helps a lot!

Cool. XLIFF was the schema I was thinking of. Looks bloated.

nickdunn - I checked out your site, and clicked “Go” in the translation section and it gave an XSLT error…

D’oh! Could you pop the error into an email to nick.dunn [at] airlock [dot] com and I’ll pass it on to the production team. Ta!

what i have started doing is creating static sections and creating input fields or textareas (depending on the case) to be used in different sections and putting that under a “copy” menu item. that way i can just use symphony to manage my “translations” and not have the copy/text hardcoded into a template file. My method, however, only handles one set of translations.

Instead of using the static sections, you can create different language translations per section that will allow for multiple entries and then, depending on who’s looking at your site, serve up the correct translation.

For example, say you have an about page with a bunch of different copy in it. You can then create different fields for an about copy section that will map to all translatable copy on that page. Then you can create an entry for english and one for spanish with all the copy translated.

upsides:

  • translations can be handled by just an author
  • you can get extremely granular in what is translated

downsides:

  • requires manual input for translations
  • three step process to get the translated copy onto the page: this needs to be added to the section, then selected in the data source, then the output xml needs to be added to the template

wtdtan:

I have used part of Nickdunns suggested method for a project where we have a section for languages and all entries that need translating are kept in here. Even Page titles can be translated like this.. as long as the page-title.xsl file is altered to accept pagetitle translations you can have as many langauges as needed. As you have mentioned.. the downsides are apparent:

  • manual input
  • once a new translation entry is added, you do need to select it in the languages DS and output xml would need to be altered to place the new translation in the template.

If anyone else has other ways they are doing this, would be good to know. Biggest thing for me is if an author is to ad a new page.. it’s a long winded way to translate the page title. Could Localisation Manager be used for front and back end translation at all?

i don’t know if there really is any real automated way for translations. If new translations are added, that means they were unknowns when the original programming took place which means they still have to be added into the templates. i use a similar method for work, but it’s usually in flat xml documents that I personally modify - something that could obviously be handled by someone else that has basic xml knowledge.

I’ve used another CMS (CMS Made Simple the MLE(multi-language edition)) which is php based and liked the way it ads an extra column in the DB for translations of strings and sections content.. so if I had english and spannish I would have en_html and es_html as entries and a param would switch to look at the resulting language entry this way. Probably a bloated way of doing it but it works really well for fast track page and content in multi-lingual form.

Even a drop down for each language in the sections entry page would be sweet. But this is way off and I think too much of a bespoke request for mainstream agreement.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

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