Keeping up with Kibana: This week in Kibana for April 16, 2018
What do internationalization and localization mean? Why are we localizing Kibana? What are the popular JavaScript localization frameworks in the market? How did we choose a localization framework?
Recently we evaluated various JavaScript localization frameworks and would like to share our experience with you. We'll answer the above questions and hopefully give you insight for your own localization project.
Internationalization
Internationalization is the design and development of a product, application, or service that enables easy localization for audiences that vary in culture, region, or language. Internationalization is often written as i18n, where 18 is the number of letters between i and n in the English word.
Localization
Localization is the adaptation of your product, application, or service to the cultural, legal, and other requirements of a specific language, country, or population. Localization is more than just translation of the user interface—it also includes customization related to:
- Number formats, including date and time, phone numbers, duration, currency, and units of measure
- Bi-directional display
- Symbols, icons, and colors
- Text and graphics
- Local regulations
- Legal requirements
Like internationalization, localization has a short form. It's often written as l10n, where 10 is the number of letters between l and n.
What is the difference between i18n and l10n?
Internationalization lays the foundation for easy localization. In other words, internationalization is the architecture and platform and localization is the data.
Why are we localizing Kibana?
As Elastic continues to grow, we have more and more customers who are not native English speakers. Localizing Kibana helps us better serve our users in countries such as China and Germany.
Challenges of localization
Localizing an application requires a tremendous amount of information, consideration, and effort. Every language has different rules and conventions, and adapting to them can be tricky.
In the JavaScript world, there is no standard way to implement localization. A lot of frameworks and tools exist—some are simple and address a limited set of use cases, some are big, complicated, or hard to extend, and some work only in a specific environment or UI framework. Sometimes developers must write a customized component to address specific needs.
Localizing Kibana is even more challenging because it relies on several UI frameworks (React and Angular) and requires localization in different environments (browser and NodeJS).
Popular i18n and i10n frameworks
Below are six popular frameworks that provide solutions to localizing a JavaScript application.
- Angular-translate. This JavaScript translation library for AngularJS 1.x applications provides a set of filters and directives for client-side localization. It supports asynchronous loading of i18n data, full pluralization through MessageFormat, and more.
- React-intl. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations. It's an open-source project from Yahoo, and part of Format.js.
- i18next. This internationalization framework works in browser and NodeJS, providing plugins for many UI frameworks, including React and Angular.
- MessageFormat.js. This lightweight and framework-agnostic JavaScript library is based on ICU message format.
- Format.js. This modular collection of JavaScript libraries for internationalization focuses on formatting numbers, dates, and strings.
- Fluent.js. This modern internationalization framework is built around the latest web platform technologies and custom FTL message format that work in browser and NodeJS.
Deciding which framework to use
In addition to common localization considerations such as default message support, easy message extraction, rich pluralization format, and good syntax ergonomic, we also took into account these aspects specific to Kibana.
- The localization framework must be UI framework agnostic and easily consumable in all parts of Kibana because Angular and React co-live in Kibana.
- The localization framework must support Node.js server-side generated content.
The following table shows the evaluation of the six frameworks against our requirements.
Conclusion
There is no perfect framework that meets all requirements. In deciding which framework to use, we had to balance the out-of-the-box features with the stability, flexibility, and priority of the requirements. We also had to consider our users and contributors to make sure they are continuously supported,
As a result, we decided to move forward with the solution based on the FormatJS core libs. We based our decision on the following:
- It has a relatively small code base and good documentation
- It uses well-known ICU message syntax
- It can be used on the server side (Node.JS), in React (react-intl) and AngularJS (a custom component that we'll build).
You can implement localization in almost any framework. We encourage you to analyze your business scenarios, and then search and find the best option for your application.