{"id":39349,"date":"2020-05-23T09:00:59","date_gmt":"2020-05-23T16:00:59","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/premier-developer\/?p=39349"},"modified":"2020-05-07T11:08:17","modified_gmt":"2020-05-07T18:08:17","slug":"using-localization-in-the-microsoft-healthcare-bot","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/using-localization-in-the-microsoft-healthcare-bot\/","title":{"rendered":"Using Localization in the Microsoft Healthcare Bot"},"content":{"rendered":"<p>App Dev Manager <a href=\"https:\/\/www.linkedin.com\/in\/jonathanpleitner\/\">Jon Leitner<\/a> spotlights the Healthcare Bot and how it handles localization.<\/p>\n<hr \/>\n<p>Microsoft\u2019s <a href=\"https:\/\/www.microsoft.com\/en-us\/research\/project\/health-bot\/\">Healthcare Bot Service<\/a> is an extendable SaaS solution to build a powerful industry aware conversational bots that can be leveraged from the PC, Mobile or chat clients like Microsoft Teams. Today, we will take a look at enabling localization from within Web Channel.<\/p>\n<p>Prerequisites:<\/p>\n<ol>\n<li><strong>Instance of the Healthcare Bot<\/strong>. Instructions to create one can be found <a href=\"https:\/\/docs.microsoft.com\/en-us\/healthbot\/quickstart-createyourhealthcarebot\">here<\/a>.<\/li>\n<li><strong>Partner Application Service<\/strong>. This is a node.js application running in an App Service that carries messages between the Healthcare Bot and a web client. To better understand what is happening with this service, you can read about integrating the Health Bot <a href=\"https:\/\/docs.microsoft.com\/en-us\/healthbot\/embed\">here<\/a>, or you can deploy one from this <a href=\"https:\/\/github.com\/Microsoft\/HealthBotContainerSample\">GitHub Repo<\/a> in around 5 minutes.<\/li>\n<li><strong>A Scenario with translated strings<\/strong>. For our purposes, you can easily <a href=\"https:\/\/docs.microsoft.com\/en-us\/healthbot\/bot_docs\/scenario-templates\">import one<\/a> from a template in the Healthcare Bot Admin Portal.<\/li>\n<\/ol>\n<p>First, let\u2019s take a second to understand what the Healthcare Bot is doing with localization. Log into the Healthcare Bot <a href=\"https:\/\/admin.healthbot.microsoft.com\/\">Admin Portal<\/a>, select the Localization blade under Language. Make sure to enable the localization switch in the upper right hand corner.<\/p>\n<p>With localization enabled, we see a list of String ID\u2019s and their corresponding message in the default English ( EN-US ).<\/p>\n<p><img decoding=\"async\" width=\"1630\" height=\"377\" class=\"wp-image-39350\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-26.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-26.png 1630w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-26-300x69.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-26-1024x237.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-26-768x178.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-26-1536x355.png 1536w\" sizes=\"(max-width: 1630px) 100vw, 1630px\" \/><\/p>\n<p>Selecting German will show us the same String ID\u2019s, the English message, and the related German (DE-DE) message.<\/p>\n<p><img decoding=\"async\" width=\"1653\" height=\"402\" class=\"wp-image-39351\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-27.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-27.png 1653w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-27-300x73.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-27-1024x249.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-27-768x187.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-27-1536x374.png 1536w\" sizes=\"(max-width: 1653px) 100vw, 1653px\" \/><\/p>\n<p>When a scenario is executed, the Healthbot calls the String ID and knows which language to display based on the Locale set for the session. This allows for us to manage a single patch of execution, regardless of the language by simply translating messages into additional locales.<\/p>\n<p>Locale can be set from the location setting of the browser, but there are many instances where location shouldn\u2019t determine the language being used in the Healthcare Bot. For instance, a healthcare provider may have a completely separate site for each language localized. In this instance, we wouldn\u2019t want geo-location to determine the locale of the Healthcare Bot, but we would want to always call the corresponding locale for the given language of a site. This can be accomplished by passing a querystring parameter into the Partner Application Service.<\/p>\n<p>The function below is from index.js in the HealthBotContainerSample. Line 7 looks for a parameter \u201clocale\u201d passed into the query string and is sent to the server side with a POST.<\/p>\n<p><img decoding=\"async\" width=\"543\" height=\"362\" class=\"wp-image-39352\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-28.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-28.png 543w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-28-300x200.png 300w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><\/p>\n<p>Here we see the same Scenario being called with a different query string yielding the result of the localized translations:<\/p>\n<p><img decoding=\"async\" width=\"1886\" height=\"700\" class=\"wp-image-39353\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-29.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-29.png 1886w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-29-300x111.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-29-1024x380.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-29-768x285.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2020\/05\/word-image-29-1536x570.png 1536w\" sizes=\"(max-width: 1886px) 100vw, 1886px\" \/><\/p>\n<p>Since the client can be easily embedded into any website using an iframe, this allows for language specific sites to specifically call the desired locale, regardless of geo-location.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft\u2019s Healthcare Bot Service is an extendable SaaS solution to build a powerful industry aware conversational bots that can be leveraged from the PC, Mobile or chat clients like Microsoft Teams.<\/p>\n","protected":false},"author":582,"featured_media":39357,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[25],"tags":[115,234,10106,3],"class_list":["post-39349","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","tag-bot-framework","tag-healthcare","tag-localization","tag-team"],"acf":[],"blog_post_summary":"<p>Microsoft\u2019s Healthcare Bot Service is an extendable SaaS solution to build a powerful industry aware conversational bots that can be leveraged from the PC, Mobile or chat clients like Microsoft Teams.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/39349","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=39349"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/39349\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/39357"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=39349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=39349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=39349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}