{"id":2333,"date":"2013-12-18T07:00:00","date_gmt":"2013-12-18T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/12\/18\/whether-your-application-should-display-its-content-in-rtl-should-be-based-on-the-content\/"},"modified":"2013-12-18T07:00:00","modified_gmt":"2013-12-18T07:00:00","slug":"whether-your-application-should-display-its-content-in-rtl-should-be-based-on-the-content","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20131218-00\/?p=2333","title":{"rendered":"Whether your application should display its content in RTL should be based on the content"},"content":{"rendered":"<p>\nA customer had the following puzzle:\n<\/p>\n<blockquote CLASS=\"q\"><p>\nWe have a small bootstrapper application that consists of a dialog box\nand a few message boxes.\nThe problem is that we want our application to work properly\non Arabic and Hebrew systems,\nand we can&#8217;t come up with a good way to determine text direction\nof the underlying system.\nWe found\n<a HREF=\"http:\/\/blogs.msdn.com\/b\/michkap\/archive\/2006\/03\/03\/542963.aspx\">\nthis article by Michael Kaplan<\/a> that tells us how not to do it,\nwhich is great, but what&#8217;s the recommended way of actually doing it?\n<\/p><\/blockquote>\n<p>\nYou already know whether you should be displaying your application&#8217;s\nUI in LTR or RTL:\nIf this is the Arabic-localized or Hebrew-localized version of your\napplication, then display it as RTL.\nIf this is the English-localized or French-localized version,\nthen display it as LTR.\n<\/p>\n<p>\nThere&#8217;s no point in trying to display your English-language strings in\nRTL just because the underlying operating system is Arabic.\nIf your strings are in English, then display them in the way they\nshould look to an English speaker.\nA dialog box like this helps nobody:\n<\/p>\n<table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" TITLE='A dialog box with RTL layout of LTR text, which ends up right-justified and with punctuation marks in the wrong place.' STYLE=\"color: black;background-color: #d4d0c8;border-width: 2px;border-style: outset;font-size: 9pt;font-family: Segoe UI, Tahoma, MS Sans Serif, Arial, sans-serif\">\n<tr BGCOLOR=\"#0a246a\" STYLE=\"padding: 2px;font-size: 8pt;font-family: Tahoma, MS Sans Serif, Arial, sans-serif\">\n<td ALIGN=\"left\" STYLE=\"padding: 4px 2px 4px 4px\">\n    <b STYLE=\"float: right;color: white\">&#8230;Please wait<\/b>\n    <span STYLE=\"background-color: #d4d0c8;border: solid 1px white;border-bottom-color: #404040;border-right-color: #404040\">\n      <span STYLE=\"border: solid 1px transparent;border-right-color: #808080;border-bottom-color: #808080\">\n        <b>&times;<\/b>\n      <\/span>\n    <\/span>\n  <\/td>\n<\/tr>\n<tr>\n<td NOWRAP STYLE=\"padding: 25px;text-align: right\">\n,(Preparing setup (50% complete<br \/>\n.your patience is appreciated\n  <\/td>\n<\/tr>\n<\/table>\n<p>\nWhen your localization team translates the application into Arabic,\nthey can\n<a HREF=\"http:\/\/msdn.microsoft.com\/en-us\/goglobal\/bb688119.aspx#EDC\">\ninsert two copies of U+200E (LEFT-TO-RIGHT MARK)\nat the start of the\n<i>File&shy;Description<\/i> in the version resource<\/a>.\nThat is the signal to Windows that the application\nshould have RTL as its default layout direction.\n<\/p>\n<p>\nIf you want your application to choose a language dynamically\n(say, to use English strings if running on an English system\nbut Arabic strings if running on an Arabic system),\nthen you can add a flag in your resources so that the localizers\ncan indicate whether a particular language pack expects text to\nrun left-to-right or right-to-left.\n<\/p>\n<pre>\nIDS_LANGUAGE_DIRECTION \"LTR\" \/\/ change to RTL if localized in Arabic, etc.\n<\/pre>\n<p>\nYour application could then check the direction\nand call\n<code>Set&shy;Process&shy;Default&shy;Layout<\/code> based on the result.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer had the following puzzle: We have a small bootstrapper application that consists of a dialog box and a few message boxes. The problem is that we want our application to work properly on Arabic and Hebrew systems, and we can&#8217;t come up with a good way to determine text direction of the underlying [&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":[26],"class_list":["post-2333","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>A customer had the following puzzle: We have a small bootstrapper application that consists of a dialog box and a few message boxes. The problem is that we want our application to work properly on Arabic and Hebrew systems, and we can&#8217;t come up with a good way to determine text direction of the underlying [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2333","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=2333"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2333\/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=2333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=2333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=2333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}