@kyleschroeder @canistop Thanks Kyle! That’s also what came out from feedback I got on https://twitter.com/meduzen/status/1520000524094955520
Copy-pasting some findings here:
Unfortunately there’s no browser API to provide the direction of a language.
Alternatives:
- a JS package: https://github.com/shadiabuhilal/rtl-detect
- Unicode CDLR data (https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-misc-modern/main/en/layout.json#L12), which I choose to use through a PHP lib named Punic (https://github.com/punic/punic).
So I created an endpoint just for the sake of getting the value of HTML `dir` attribute.
@meduz @canistop The one with the translation underneath the English text is easier to follow. It’s more clear that the two pieces of text are related.