I have a ListView created by CreateWindowExW()
with WC_LISTVIEWW
. I then create columns using LVCOLUMNW
and set the texts via pszText
. Texts are in Arabic.
I would like the column texts of this list view to be displayed RTL, so I added WS_EX_RTLREADING
to the extended style. However, it has no effect because according to Microsoft, the shell language needs to be Arabic or Hebrew.
I tried using SetThreadUILanguage()
to set the thread language to Arabic, but it did not help.
What exactly is this "shell language"? Is it the language of the shell that's running my Win32 app? If yes, would that just be the language of cmd.exe
, or the OS language? Is there a way to dynamically change this shell language at application runtime, and change it back?
No, "shell language" is not the language of cmd.exe
. I believe that this applies to the Explorer. Here is another answer that agrees on that: is the Windows Explorer a shell, and provides very good reasons for such interpretation.
The Microsoft doc you linked explicitly says that WS_EX_RTLREADING
has no effect when the shell language is not RTL. In addition to Hebrew and Arabic, this also includes Persian, Urdu, and other languages. Unfortunately, some of these language packs don't define the full Windows Explorer UI, and therefore don't count as "shell languages".
Please note that WS_EX_RTLREADING
(or LAYOUT_RTL
) may not be necessary for your use case; worse, it may cause undesired effects, like bitmap mirroring, as explained here.
Texts in Arabic should be displayed perfectly even without LAYOUT flags. There may be some glitches when you deal with mixed text, where occasional English words appear inside an Arabic paragraph, but it may be hard to track and fix without help from somebody who knows the language well enough.
As for LISTVIEW, generic mirroring is not a very good idea. This control accepts ILC_MIRROR
and ILC_PERITEMMIRRORS
flags. See more in the Microsoft Localization guide.