Website Globalization in Node.js

July 25, 2017 Juan Fausd

Website globalization can be defined as the process of designing a website so that it can potentially be adapted to various languages and regions. While reading that definition, we may think that it’s a simple topic, but from my personal experience, it is not something that is easy to achieve.

Website globalization is not just translating content into different languages. It also includes adjusting other aspects like number formatting and how dates should be displayed. When it comes to numbers, for example, some countries use a comma and others use a dot as a decimal separator. For dates, some regions have different ways to display the month, day and year. Globalization gives users the ability to input numbers and dates in the format they are accustomed to.

In this blog, I will cover some of the resources that are available to globalize your Node.js web applications. Why Node.js? Mainly because it’s an environment that is broadly used. It helps developers easily build apps from scratch and has a helpful community with a lot of documentation and libraries available.

Globalize

Globalize is a JavaScript library for internationalization and localization. It provides number formatting and parsing, currency formatting, date and time formatting and parsing, message formatting and plural support. The main benefits of this library include:

  • It is not tied to any framework and works both in the browser and in Node.js.

  • It uses Unicode CLR, which is the largest and most extensive standard repository of locale data.

  • It handles date and number formatting very well.

  • It is supported in desktop and mobile browsers and Node.js.

  • It is very user-friendly.

Ember-i18n

Ember-i18n is a JavaScript library for internationalization for Ember.js. It has good support to define translations and import them into the system. It has support for handling missing translations, language fallback and pluralization. Also, it has features for testing: acceptance, integration and unit tests.

Vue-i18n

Vue-i18n is an internationalization plugin for Vue.js. It has support for text formatting, handles text with html tags pretty well and includes support for custom formatting. It also supports number, date and time localization, language fallback and component-based localization.

ECMA-402

There is a standard called ECMA-402, which defines an internationalization API for ECMAScript objects and has many interesting features. Although ECMA-402 support is improving among modern browsers and even Node.js, the functionality and locale coverage level varies between different environments. In the following picture you can see the results of running unit tests for ECMA support in different browsers. For a better reference, please see this link.

Node.js includes internationalization APIs from release 0.12.0. By default, only the English (U.S.) locale is included. To enable the internationalization APIs to work in other languages and locales, you need to include the optional locale data that comes from the International Components for Unicode Project. For a better reference about how to include that optional locale data, please see this link.

The main strengths include:

  • Speed: it is native compiled code, which runs faster than interpreted JavaScript code from libraries.

  • Size: it is native compiled code, which requires no extra JavaScript or resource loading to be executed.

Summary

There are many resources available to globalize your Node.js app, including libraries that better integrate with some existing frameworks. It’s up to you when selecting the technology that best fits your use case. Always consider using technologies that allow you to structure the content in a way that can be easily exported for translation and imported back. Also, it’s good to consider technologies that allow you to add support for new languages in a simple way.

Further GPI Resources on Connectors and Website Development

GPI offers custom CMS Translation Connectors to a variety of web content management systems in order to streamline localization workflows and access to translation project information across your enterprise. 

You may also find some of the following articles and links 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. 

About the Author

Juan Fausd

Juan Alejandro Fausd is a native Spanish speaker from La Paz, Entre Ríos, Argentina. He graduated from university with a degree in Information Systems Engineering. While a student, he was active in several open source interest groups and has conducted seminars on a range of topics including version control tools, object-relational mapping and coding. He has extensive experience with different technologies like C#, ASP.NET, JavaScript, PHP, Symfony2, NodeJS, Unity, WCF, SQL Server, MongoDB and Cassandra. When he is not working, he enjoys outdoor activities and spending time with family and friends. He also enjoys learning and reading about new technologies, mostly related to software development and software architecture.

More Content by Juan Fausd
Previous Flipbook
GPI Adds Auto Export/Import Features to HubSpot Connector
GPI Adds Auto Export/Import Features to HubSpot Connector

Next Flipbook
Website Globalization and E-Business Iraq
Website Globalization and E-Business Iraq

Ready to translate your documents, software or website?

Request a Quote!