Search code examples
multilingualpyrocms

PyroCMS - Storing stream data in multiple languages


I have a client who requires me to store the stream data in two different languages. For example, a stream for FAQ with fields: question and answer would have:

English Version:
Question: _Some question in english_
Answer: _Some answer in english_

and then:

Italian Version:
Question: _Some question in italian_
Answer: _Some answer in italian_

I know that PyroCMS support multi-lingual support for backend and front-end labels but how do I make sure that stream data can be store in two different languages?


Solution

  • You must create a field for save the language, for example (lang) and select the Pyro Lang FieldType

    Next, you can looping your stream making a where with the new field as column, for example:

    where lang = 'es'
    

    You can too use the Lang plugin for know the current lang of your site. Use the {{ lang:code }} tag for this.