Search

Hello,

I'm building a multilingual site and I'm trying to figure out the best approach for storing text strings/variables that are used for UI elements and buttons? For example a "Contact us" button will reside on multiple pages - but where should I store strings like these in order to make these strings translatable in the admin panel?

Naturally I'd like to create a solution which won't impact performace too much.

Looking forward to your ideas, thanks! /A

I've always implemented a 'Static Content' section, coupled with a SBL to a languages section.

You can pick out strings by key, filtered with a parameter of the language that way.

Thanks! Would you create one entry for all strings, or one entry per string?

I usually do one entry per string. As it's usually a key and string, and language, the overhead on each page is negligible.

For that extra level, you could add a page select box and pick out the pages they will appear on and then filter that in the datasource.

I use this method for all sorts of re-useable small content, like a page paragraph at the top of specific pages for example.

Great, thanks for your advice!

No problem, always available :D

Same thing here, in usual designs I would have a symphony section with keys and translations I tend to use multilingual fields; so no need to write the language of the translation.

Linking to the page is optional; if the translations you want are used everywhere you could just attach the Datasource to all the related pages.

Option B. which I'm exploring is having a content-section which is made up of paragraphs each of those being a translation. Not as clean but works good for page-specific translations.

@gunglien - Yes, something similar to your "Option B" is what is what I will test. Thanks.

just as a quick guide what I have done is the following.

  1. created a multilingual textbox

  2. Input all the phrases each into a separate paragraph Where I opted to use the same field for content / translations I enclosed translations within a section tag which is not output with the ninja technique.

  3. Created an XSLT template to output each paragraph on request

  4. Just touch up my template XSL to include each translation as required. This keeps it simple for our translator who just has to replace the words in paragraph instead of having to look up all the keys.

Below find the sample xsl template

<xsl:template name='page-translation'>
<xsl:param name='pos' select='"1"'/>
<xsl:apply-templates select='/data/page/entry/content/section[@type="translations"]/*[position()=$pos]' mode='html-child'/>
</xsl:template>`

Looks interesting gunglien. I'm just starting to get the grips of Symphony, hopefully I will solve this somehow ;)

Cheers!

Its not too difficult it is all about what works for you; there are multiple ways to solve this problem; at times you might want to use multiple approaches.

What is important for you is to keep it simple; and as much as possible avoid data duplication.

Yep

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