{"id":8833,"date":"2011-12-22T07:00:00","date_gmt":"2011-12-22T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2011\/12\/22\/how-do-i-determine-programmatically-whether-a-particular-language-is-ltr-or-rtl\/"},"modified":"2011-12-22T07:00:00","modified_gmt":"2011-12-22T07:00:00","slug":"how-do-i-determine-programmatically-whether-a-particular-language-is-ltr-or-rtl","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20111222-00\/?p=8833","title":{"rendered":"How do I determine programmatically whether a particular language is LTR or RTL?"},"content":{"rendered":"<p>Given an <code>LCID<\/code>, how does one determine whether the language lays out left-to-right or right-to-left? One suggestion was simply to hard-code the list of known right-to-left languages, and if the language isn&#8217;t on the list, then assume that it is left-to-right. This technique is clearly fragile, because Windows adds support for new languages not infrequently, and if one of those is a right-to-left language, then your table is now out of date. And besides, there are languages whose layout is neither left-to-right nor right-to-left. For example, Chinese and Japanese traditionally lay out top-to-bottom.\n To obtain the text layout direction programmatically, call <code>Get&shy;Locale&shy;Info&shy;Ex<\/code> with <code>LOCALE_IREADINGLAYOUT<\/code>.<\/p>\n<p> And just hope that nobody ever hands you a <a href=\"http:\/\/blogs.msdn.com\/b\/ericlippert\/archive\/2009\/03\/26\/five-dollar-words-for-programmers-part-four-boustrophedonic.aspx\"> boustrophedonic<\/a> language. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Given an LCID, how does one determine whether the language lays out left-to-right or right-to-left? One suggestion was simply to hard-code the list of known right-to-left languages, and if the language isn&#8217;t on the list, then assume that it is left-to-right. This technique is clearly fragile, because Windows adds support for new languages not infrequently, [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-8833","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Given an LCID, how does one determine whether the language lays out left-to-right or right-to-left? One suggestion was simply to hard-code the list of known right-to-left languages, and if the language isn&#8217;t on the list, then assume that it is left-to-right. This technique is clearly fragile, because Windows adds support for new languages not infrequently, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/8833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=8833"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/8833\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=8833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=8833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=8833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}