{"id":27237,"date":"2021-03-09T11:02:08","date_gmt":"2021-03-09T11:02:08","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=27237"},"modified":"2021-12-30T14:12:13","modified_gmt":"2021-12-30T08:42:13","slug":"isrtl-property-of-usersettings-api-in-pcf-control-to-determine-language-within-dynamics-365-crm","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2021\/03\/isrtl-property-of-usersettings-api-in-pcf-control-to-determine-language-within-dynamics-365-crm\/","title":{"rendered":"isRTL property of UserSettings API in PCF Control to Determine Language within Dynamics 365 CRM"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>As we know, PCF control can be run in multiple languages. Each language has a script to be written and it will be written with a direction. Some languages are written in the left-to-right direction, whereas some are written in the right-to-left. For example, English language script is written left-to-right, whereas Arabic language script is written in the right-to-left direction.<\/p>\n<p>In PCF control, when the user interface language is set to Arabic, then the direction of the user interface will be switched in the right-to-left direction. To handle this situation in PCF control, we can use userSettings API of Power Apps. This API helps us to identify whether the user interface language is written in right-to-left or not and makes it easy to change the user interface on the basis of the language.<\/p>\n<p>Please find the code below:<\/p>\n<p>\/\/function that returns the value of isRTL property<br \/>\nisRTL(context: ComponentFramework.Context&lt;IInputs&gt;) {<br \/>\nreturn context.userSettings.isRTL;<br \/>\n}<\/p>\n<p>For example, we have field type PCF control in which the field returns the value of isRTL property. We have set the user interface language is English, that\u2019s why isRTL returns false as seen in the screenshot below.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/1-isRTL-property-of-UserSettings-API-in-PCF-Control.jpeg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-27235 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/1-isRTL-property-of-UserSettings-API-in-PCF-Control.jpeg\" alt=\"isRTL property of UserSettings API in PCF Control\" width=\"861\" height=\"911\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/1-isRTL-property-of-UserSettings-API-in-PCF-Control.jpeg 861w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/1-isRTL-property-of-UserSettings-API-in-PCF-Control-284x300.jpeg 284w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/1-isRTL-property-of-UserSettings-API-in-PCF-Control-768x813.jpeg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/1-isRTL-property-of-UserSettings-API-in-PCF-Control-660x698.jpeg 660w\" sizes=\"(max-width: 861px) 100vw, 861px\" \/><\/a><\/p>\n<p>In the below example, we have set the Arabic language as a user interface language, hence isRTL shows true.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/2-isRTL-property-of-UserSettings-API-in-PCF-Control.jpeg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-27236 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/2-isRTL-property-of-UserSettings-API-in-PCF-Control.jpeg\" alt=\"isRTL property of UserSettings API in PCF Control\" width=\"764\" height=\"828\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/2-isRTL-property-of-UserSettings-API-in-PCF-Control.jpeg 764w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/2-isRTL-property-of-UserSettings-API-in-PCF-Control-277x300.jpeg 277w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/2-isRTL-property-of-UserSettings-API-in-PCF-Control-660x715.jpeg 660w\" sizes=\"(max-width: 764px) 100vw, 764px\" \/><\/a><\/p>\n<h2>Conclusion<\/h2>\n<p>By using UserSettings API, we can easily get the direction in which the language is to be written and make the required changes in the user interface.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/map-my-relationships-dynamics-365-crm\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-27239 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/mmr.jpg\" alt=\"\" width=\"800\" height=\"200\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/mmr.jpg 800w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/mmr-300x75.jpg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/mmr-768x192.jpg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/03\/mmr-660x165.jpg 660w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction As we know, PCF control can be run in multiple languages. Each language has a script to be written and it will be written with a direction. Some languages are written in the left-to-right direction, whereas some are written in the right-to-left. For example, English language script is written left-to-right, whereas Arabic language script\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2021\/03\/isrtl-property-of-usersettings-api-in-pcf-control-to-determine-language-within-dynamics-365-crm\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[16,19,1929],"tags":[545,592,2199,1941,2200],"class_list":["post-27237","post","type-post","status-publish","format-standard","hentry","category-dynamics-365","category-dynamics-crm","category-pcf","tag-dynamics-365-crm","tag-dynamics-crm","tag-isrtl-property","tag-pcf-control","tag-usersettings-api"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/27237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=27237"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/27237\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=27237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=27237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=27237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}