Skip to content

BiDi in Fluent

Zibi Braniecki edited this page Feb 24, 2017 · 2 revisions

Bidirectionality is a complex problem in software localization.

Only quite recently Unicode UAX#9 introduces means to reliably handle bidirectional text flow and W3C offered a recommendation for bidi in HTML.

Project Fluent aims to capitalize on those technologies in order to provide the complete solution to bidirectional software localization.

Syntax

Fluent Syntax is handling utf-8 and allows for directional formatting characters to be manually inserted by the translator, but it also follows the W3C recommendations for inline BiDi markup and How to use Unicode controls for bidi text to annotate each embedded string within another string with directional formatting characters.

That means, that any placeable in Fluent Syntax that is a string will be wrapped in FSI/PDI marks in order to instruct the layout that the placeable may have different directionality.

Variable formatting

Project Fluent uses ECMA402, or ECMA402-like APIs to format numbers, dates and other units into the appropriate script and format. That means that any numbers passed to a Fluent Message will be formatter to use the correct format, following ECMA402 Intl.NumberFormat API, and the same will happen with dates and Intl.DateTimeFormat.

In case of strings, as we previously indicated, Fluent will insert directional formatting characters to allow for unknown directionality mixes between the original string and embedded placeables.

Language negotiation

One of the aspects of language negotiation in Fluent is that we'll try to match user requested locale using the script of choice for the user. It means that locales that can potentially have multiple scripts like sr-Cyrl and sr-Latn or zh-Hans and zh-Hant will have their script part be used to inform us on what fallback languages to look for.

Our aim here is to maximize the chance that all text, dates, units, numbers and other elements stay in the same script.

HTML bindings

Our DOM bindings will be closely following HTML BiDi recommendations for structural markup.