MODX Globalization Using Lingua

February 20, 2017

MODX is a PHP based, open-source CMS. It has built-in support for backend localization, but doesn't offer frontend localization out of the box. Lingua is a package known for displaying a lexicon switcher on the frontend. It was made to support multilingual websites.

 

In this blog, I will illustrate how Lingua works.

Lingua's Background

 

There are several extras, or packages, that were developed to provide localization for MODX, the most popular one is Babel. The problem with Babel, is that it requires a context for each language where resources can be duplicated for each.

 

While this process might be helpful in some cases, it's lengthy and unmaintainable for large CMSs with many resources and multiple language implementations. In order to estimate how much work is needed to implement translation using contexts, multiply the number of translatable resources in your CMS (resources and Template Variables) by the number of target languages.

 

Lingua avoids contexts by implementing its own tables for translations. Lingua was based on the translation package, but since translation is still in beta, Lingua has headed in a different direction.

How Lingua Works

 

If you implement multiple translations of your resources then you will need a language switcher on the frontend.

 

To be able to use Lingua, you need to:

 

  1. Add one setting to your context setting:

    1. modRequest.class => LinguaRequest

  2. Lingua custom manager page is provided for you to select which languages (translations) will be used.

 

MODX Globalization Using Lingua - 1

 

 

Lingua has its own set of predefined languages, but you can add any language as needed.

 

  1. For the switcher to show up on the frontend, the Lingua.selector has to be used to show lexicon switcher.

 

MODX Globalization Using Lingua - 2

 

  1. Lingua clones resource content and all defined Template Variables (TVs), but doesn't support custom TVs created out of the MODX TV database as mentioned in this documentation. So the process is down to providing translation of each resource from CMP.

 

MODX Globalization Using Lingua - 3

 

  1. Apart from mix ups with contexts, Lingua saves translations in its own Lingua tables, where site content and template variables are translated into targeted languages.

 

MODX Globalization Using Lingua - 4

 

The outlined parts of the illustration above hold the translated values of site content and template variables, so it is very important not to embed translatable elements into chunks or hard code strings in snippets because they will not be translated. Lingua doesn't support translatable chunks at this time.

Conclusion

 

MODX globalization and localization can be implemented in several ways, which one best suits you is based on your needs. Lingua comes in handy when it comes to medium to large CMSs that adopt MODX official development best practices.

Further GPI Resources on Translation Connectors:

 

You may also find some of the following blogs useful:

 

 

Please feel free to contact GPI at info@globalizationpartners.com with any questions about our language and technology services. Also let us know if you have any interesting blog topics you would like us to cover in our future blogs.

Category:
Content Management Systems
Tags:
MODX

WordPress 4.7 Vaughan ReleaseNews: Globalization Partners International to Sponsor Episerver's Ascend 2017

Comments

Currently, there are no comments. Be the first to post one!

Add a comment

Only comments with valid email addresses will be posted. Thanks!

Contact Us FREE Globalization eBooks Request Demo Request Quote


Rabab is a native Arabic speaker from Cairo, Egypt. She has over 12 years’ experience in software and websites architecture and implementation using open source programming tools including PHP, MySQL as well as jQuery, JSON and Ajax. She has served with various companies including Pyramid Technologies, Link-Dot-Net and InTouch Communications as a Programmer, Systems Engineer – Developer and Lead Web Developer. She earned her B.Sc. Degree in Economics with a minor in Computer Science from Cairo University. She completed a SSDP Diploma from the Information Technology Institute (IDSC), The Cabinet and is a certified Cloud Business Associate and a Microsoft Certified Professional (MCP, MCAD and MCSD.NET) Over the years she has designed and implemented a range of localized web-based business applications and portals for clients in the finance, hospitality, telecommunications and e-commerce sectors. In her free time she enjoys, traveling, reading, swimming, tennis and outdoor activities.