Inspired by termbox ([inlanguage.ts](https://gerrit.wikimedia.org/r/plugins/gitiles/wikibase/termbox/+/master/src/client/directives/inlanguage.ts)), but gets the direction from $.uls.data.getDir(), not from the store.
Additionally, language codes need to be mapped to their bcp47-compatible equivalents - this knowledge was only recently (re)gained in T231476: Termbox (v2) does not map nonstandard language codes to standard ones for HTML/T231475
Notes
- mediaWiki.language.bcp47() seems to be an option for language code mapping in client implementations