{"id":22924,"date":"2019-11-26T07:12:38","date_gmt":"2019-11-26T07:12:38","guid":{"rendered":"https:\/\/developer.kore.ai\/v9-1\/?p=22924"},"modified":"2023-06-28T08:47:39","modified_gmt":"2023-06-28T07:47:39","slug":"koreutil-libraries","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v9-1\/docs\/bots\/advanced-topics\/koreutil-libraries\/","title":{"rendered":"koreUtil Libraries"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_boxes valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p><strong>koreUtil libraries<\/strong> provide pre-written JavaScript functions which makes common or complex tasks easy to implement. These libraries often target specific tasks such as setting up recurring rules for calendar, parsing and manipulation of dates, conversion of dates between timezone, tools to simplify programming with strings, numbers, arrays, functions and objects etc.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"How_to_Use\">How to Use<\/span><\/h2>\n<p>koreUtil libraries can be used anywhere in the bot where there is a flexibility to write JavaScript code such as script node, message node, confirmation node, entity node, standard responses, answers to FAQs, small talk, event handlers etc.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"List_of_koreUtil_libraries\">List of koreUtil libraries<\/span><\/h2>\n<p>Below is the list of koreUtil libraries provided by the platform:<\/p>\n<ul>\n<li><a href=\"#koreUtilrrule\">koreUtil.rrule<\/a><\/li>\n<li><a href=\"#koreUtilmoment\">koreUtil.moment<\/a><\/li>\n<li><a href=\"#koreUtilintl\">koreUtil.intl<\/a><\/li>\n<li><a href=\"#koreUtilmomenttz\">koreUtil.momenttz<\/a><\/li>\n<li><a href=\"#koreUtilxml2js\">koreUtil.xml2js<\/a><\/li>\n<li><a href=\"#koreUtilhash\">koreUtil.hash<\/a><\/li>\n<li><a href=\"#koreUtil\">koreUtil._<\/a><\/li>\n<li><a href=\"#koreUtilgetCurrentOptions\">koreUtil.getCurrentOptions<\/a><\/li>\n<li><a href=\"#koreUtilgetSessionId\">koreUtil.getSessionId<\/a><\/li>\n<li><a href=\"#koreUtilclose\">koreUtil.closeConversationSession<\/a><\/li>\n<li><a href=\"#koreautotranslate\">koreUtil.autoTranslate<\/a><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtilrrule\">koreUtil.rrule<\/span><\/h3>\n<p>koreUtil.rrule is platform offered JS library for creating new recurrence rules, interpreting and reading them in human readable format.<\/p>\n<p><b>Usage Example:<\/b><br \/><code>context.rule = new koreUtil.rrule({<br \/>freq: koreUtil.rrule.WEEKLY,<br \/>interval: 5,<br \/>byweekday: [koreUtil.rrule.MO, koreUtil.rrule.FR],<br \/>dtstart: new Date(2012, 1, 1, 10, 30),<br \/>until: new Date(2012, 12, 31)<br \/>});<\/code><br \/><code>context.between=context.rule.between(new Date(2012, 7, 1), new Date(2012, 8, 1));<\/code><br \/><code>context.readableFormat=context.rule.toText();<\/code><\/p>\n<p><b>Output:<\/b><\/p>\n<ul>\n<li>For context.between<br \/><code>[<br \/>\"2012-08-27T10:30:00.000Z\",<br \/>\"2012-08-31T10:30:00.000Z\"<br \/>]<\/code><\/li>\n<li>For context.readableFormat<br \/><code>every 5 weeks on Monday, Friday until January 31, 2013<\/code><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtilmoment\">koreUtil.moment<\/span><\/h3>\n<p>koreUtil.moment is platform offered JS library for validating, manipulating, and formatting dates.<\/p>\n<p><b>Usage Example:<\/b><br \/><code>context.german=koreUtil.moment().locale('de').format('LLLL');<\/code><\/p>\n<p><b>Output:<\/b><br \/>For context.german:<br \/><code>Montag, 18. November 2019 01:43<\/code><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtilintl\">koreUtil.intl<\/span><\/h3>\n<p>koreUtil.intl is platform offered JS library for language specific string comparison, number formatting, and date and time formatting.<\/p>\n<p><b>Usage Example:<\/b><br \/><code>context.formattedNumberUK = koreUtil.intl.NumberFormat('en-GB').format(123456.789);<br \/>var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));<br \/>context.USdate=koreUtil.intl.DateTimeFormat('en-US').format(date);<\/code><\/p>\n<p><b>Output:<\/b><\/p>\n<ul>\n<li>For context.formattedNumberUK:<br \/><code>123,456.789<\/code><\/li>\n<li>For context.USdate<br \/><code>12\/20\/2012<\/code><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtilmomenttz\">koreUtil.momenttz<\/span><\/h3>\n<p>koreUtil.momenttz is platform offered JS library for formatting of dates in any timezone and convert dates between timezones. <\/p>\n<p><b>Usage Example:<\/b><br \/><code>var jun = koreUtil.moment(\"2014-06-01T12:00:00Z\");<br \/>context.newyork= koreUtil.momenttz(jun,'America\/New_York').format('ha z');<br \/>context.tokyo = koreUtil.moment().tz('Asia\/Tokyo').format('ha z');<br \/>context.sydney = koreUtil.moment().tz('Australia\/Sydney').format('ha z');<\/code><\/p>\n<p><b>Output:<\/b><\/p>\n<ul>\n<li>For context.newyork:<br \/><code>5am PDT<\/code><\/li>\n<li>For context.tokyo:<br \/><code>7pm JST<\/code><\/li>\n<li>For context.sydney:<br \/><code>9pm AEDT<\/code><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtilxml2js\">koreUtil.xml2js<\/span><\/h3>\n<p>koreUtil.xml2js is platform offered JS library for parsing xml to json and vice versa.<\/p>\n<p><b>Usage Example:<\/b><br \/><code>var obj = {name: \"John\", Surname: \"Doe\", age: 23};<br \/>var builder = new koreUtil.xml2js.Builder();<br \/>context.xml = builder.buildObject(obj);<\/code><\/p>\n<p><b>Output:<\/b><\/p>\n<ul>\n<li>For context.xml:<br \/><code><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?-->  John Doe 23 <\/code><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtilhash\">koreUtil.hash<\/span><\/h3>\n<p>koreUtil.hash is platform offered JS library that supports SHA on JavaScript.<\/p>\n<p><b>Usage Example:<\/b><br \/><code>context.hashString= koreUtil.hash('sha256').update('42').digest('hex');<\/code><\/p>\n<p><b>Output:<\/b><\/p>\n<ul>\n<li>For context.hashString:<br \/><code>73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049<\/code><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtil\">koreUtil._<\/span><\/h3>\n<p>koreUtil._ is a platform offered JS library which provides utility functions for common programming tasks.<\/p>\n<p><b>Usage Example:<\/b><br \/><code>context.chunkArray = koreUtil._.chunk(['a', 'b', 'c', 'd'], 2);<br \/>var users = [<br \/>{ 'user': 'barney', 'age': 36, 'active': true },<br \/>{ 'user': 'fred',   'age': 40, 'active': false }<br \/>];<br \/>context.filterActive =koreUtil._.pluck(koreUtil._.filter(users, { 'age': 36, 'active': true }), 'user');<\/code><\/p>\n<p><b>Output:<\/b><\/p>\n<ul>\n<li>For context.chunkArray:<br \/><code>[[\"a\",\"b\"],[\"c\",\"d\"]]<\/code><\/li>\n<li>For context.filterActive:<br \/><code>[<br \/>\"barney\"<br \/>]<\/code><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtilgetCurrentOptions\">koreUtil.getCurrentOptions<\/span><\/h3>\n<p>koreUtil.getCurrentOptions is a platform offered JS library which provides utility functions to get the current template for language selection standard response options. This can be used to customize the standard response.<br \/>\nPost the release of v8.1, this function has been enhanced to return the authorization URL used in the standard response when end-user authorization is requested.<\/p>\n<p>Following is the return format for each of the situations:<\/p>\n<ul>\n<li>For the language selection standard response:\n<pre>{\"list_of_languages\": [\r\n   {\"title\": \"English\",\"value\": \"English\"},\r\n   {\"title\": \"Deutsche\",\"value\": \"Deutsche\"},\r\n   {\"title\": \"Espa\u00f1ol\",\"value\": \"Espa\u00f1ol\"}\r\n]}<\/pre>\n<\/li>\n<li>For the language ambiguity standard response:\n<pre>{\"current_language\": \"Espa\u00f1ol\",\r\n      \"list_of_new_languages\": [\r\n         {\"title\": \"English\",\"value\": \"English\"},\r\n         {\"title\": \"Deutsche\",\"value\": \"Deutsche\"},\r\n         {\"title\": \"Espa\u00f1ol\",\"value\": \"Espa\u00f1ol\"}\r\n  ]}<\/pre>\n<\/li>\n<li>For the language switch standard response:\n<pre>{\"new_language\": \"Espa\u00f1ol\",\"current_language\": \"English\"}<\/pre>\n<\/li>\n<li>For User authorization request standard response:\n<pre>{\r\n    \"authorizationURL\": \"https:\/\/\/r\/xxxxxxxxxxxxx\"\r\n}<\/pre>\n<\/li>\n<\/ul>\n<p>Following are the usage examples of how the above utility can be used to render the message in a button template, you can use any template as per your requirements.\u00a0 <a href=\"\/docs\/bots\/sdks\/message-templates\/\" target=\"_blank\" rel=\"noopener noreferrer\">See here for more on message templates<\/a>.<\/p>\n<p><b>Usage Example 1:<\/b> To get the standard response for &#8220;<em>Ask if the user would like to select any of the languages<\/em>&#8220;<\/p>\n<pre>var info = koreUtil.getCurrentOptions();\r\nvar message = {\r\n  \"type\": \"template\",\r\n  \"payload\": {\r\n    \"template_type\": \"button\",\r\n    \"text\": \"please select your laguage\",\r\n    \"subText\": \"Button Template Description\",\r\n    \"buttons\": []\r\n    }\r\n  };\r\nfor (i = 0; i &lt; info.list_of_languages.length; i++) {\r\n  var button = {\r\n    \"type\": \"postback\",\r\n    \"title\": info.list_of_languages[i].title,\r\n    \"payload\": info.list_of_languages[i].value\r\n    };\r\n\r\n  message.payload.buttons.push(button);\r\n }\r\nprint(JSON.stringify(message));\r\n<\/pre>\n<p><b>Usage Example 2:<\/b> To get the standard response for &#8220;<em>Ask if the user would like to switch to any of the new languages detected during a conversation<\/em>&#8220;<\/p>\n<pre>var info = koreUtil.getCurrentOptions();\r\nvar message = {\r\n    \"type\": \"template\",\r\n    \"payload\": {\r\n        \"template_type\": \"button\",\r\n        \"text\": \"language abiguity response for the current language\" + info.current_language,\r\n        \"subText\": \"Button Template Description\",\r\n        \"buttons\": []\r\n    }\r\n};\r\nfor (i = 0; i &lt; info.list_of_new_languages.length; i++) {\r\n    var button = {\r\n        \"type\": \"postback\",\r\n        \"title\": info.list_of_new_languages[i].title,\r\n        \"payload\": info.list_of_new_languages[i].value\r\n    };\r\n\r\n    message.payload.buttons.push(button);\r\n}\r\nprint(JSON.stringify(message));\r\n<\/pre>\n<p><b>Usage Example 3:<\/b> To get the standard response for &#8220;<em>Ask if the user would like to switch to any of the new languages detected during a conversation<\/em>&#8220;<\/p>\n<pre>var info = koreUtil.getCurrentOptions();\r\nvar message = {\r\n    \"type\": \"template\",\r\n    \"payload\": {\r\n        \"template_type\": \"button\",\r\n        \"text\": \"would you like to switch to new language detected: current language \" + info.current_language + \"new language : \" + info.new_language,\r\n        \"subText\": \"Button Template Description\",\r\n        \"buttons\": []\r\n    }\r\n};\r\nvar options = [\"yes\", \"no\"]\r\nfor (i = 0; i &lt; options.length; i++) {\r\n    var button = {\r\n        \"type\": \"postback\",\r\n        \"title\": options[i],\r\n        \"payload\": options[i]\r\n    };\r\n    message.payload.buttons.push(button);\r\n}\r\nprint(JSON.stringify(message));\r\n<\/pre>\n<p><b>Usage Example 4:<\/b> To get the standard response for &#8220;<em>User needs to authorize or re-authorize<\/em>&#8220;<\/p>\n<pre>var info = koreUtil.getCurrentOptions();\r\n\r\nvar message = {\r\n    type: 'template',\r\n    payload: {\r\n        template_type: 'button',\r\n        text: 'Please authorize before we continue...',\r\n        buttons: [\r\n            {\r\n                type: 'url',\r\n                title: 'Click here to authorize',\r\n                url: info.authorizationURL\r\n            }\r\n        ]\r\n    }\r\n};\r\n\r\nprint(JSON.stringify(message));\r\n<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"koreUtilgetSessionId\">koreUtil.getSessionId<\/span><\/h3>\n<p>koreUtil.getSessionId is a platform offered JS library for obtaining the current conversation session Id.<\/p>\n<p><b>Usage Example:<\/b><br \/>\n<code>var sessionId = koreUtil.getSessionId();<\/code><\/p>\n<p><b>Output:<\/b><\/p>\n<ul>\n<li>For sessionId:<br \/>\n<code>5x54321x11xx87654321xx12<\/code><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3 id=\"koreUtilclose\"><span class=\"ez-toc-section\" id=\"koreUtilcloseConversationSession\">koreUtil.closeConversationSession<\/span><\/h3>\n<p>koreUtil.closeConversationSession is a platform function for force closing any active conversation. This function can be invoked from any component that supports JavaScript. When you invoke this function, the platform will discard any ongoing task and the active conversation session\u00a0 will be closed. The platform also presents the session timeout message on the supported channels.<\/p>\n<p><b>Usage Example:<\/b><\/p>\n<p><code>koreUtil.closeConversationSession();<\/code><\/p>\n<p><b>Output:<\/b><\/p>\n<p>No response is returned and session ends.<\/p>\n<p><b>Note<\/b>: The koreUtil.closeConversationSession is supported in the Platform v8.1 and above versions.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3 id=\"koreautotranslate\"><span class=\"ez-toc-section\" id=\"koreUtilautoTranslate\">koreUtil.autoTranslate<\/span><\/h3>\n<p>koreUtil.autotranslate is a platform function that lets you automatically translate the virtual assistant response from a language in which the bot is configured to the language in which the user is interacting or a language of your choice. This function uses a translation engine to translate the bot responses into user input language. For more information on how to configure a translation engine, <a href=\"https:\/\/developer.kore.ai\/v9-1\/docs\/bots\/advanced-topics\/multi-lingual\/building-multi-language-bots\/\">refer here<\/a>.<\/p>\n<p>Please refer below for the translation behavior:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">Response Types<\/th>\n<th style=\"text-align: center;\">Components<\/th>\n<th style=\"text-align: center;\">Translation Behavior<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">Plain Text Responses<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Refers to plain text responses defined anywhere in the virtual assistant. For example, prompts, responses etc.,<\/span><\/td>\n<td>\n<p><span style=\"font-weight: 400;\">Default: Auto-translated<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You can choose to translate only a specific part of the response by using the koreUtil.autoTranslate function only for that part. <\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Advanced \/ JavaScript based Responses<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Refers to responses defined using JavaScript. For example, prompts, responses etc.,<\/span><\/td>\n<td>\n<p><span style=\"font-weight: 400;\">Default: No auto-translation<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You can use the AutoTranslation function inside the JavaScript to define the parts of the responses that need translation.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Auto-formatted Responses<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Refers to the responses that are auto-formatted by the platform as per the channel specifications. For example, confirmations, list of values, ambiguities etc.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Default: Auto-translated<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><b>Usage Example:<\/b><\/p>\n<p><code>koreUtil.autoTranslate();<\/code><\/p>\n<p>Here are a few use case examples for your reference:<\/p>\n<p><b>Use Case-1:<\/b>To translate part of a sentence in the user\u2019s language:<\/p>\n<p><b>Example:<\/b><\/p>\n<p><code>{{koreUtil.autoTranslate('Welcome! I am a virtual assistant powered by ')}} General Insurance<\/code><\/p>\n<p><b>Output in Serbian<\/b><\/p>\n<p><code>\u0414\u043e\u0431\u0440\u0435\u0434\u043e\u0458\u0434\u043e\u0432\u0442\u0435! \u0408\u0430\u0441 \u0441\u0443\u043c \u0432\u0438\u0440\u0442\u0443\u0435\u043b\u0435\u043d \u0430\u0441\u0438\u0441\u0442\u0435\u043d\u0442 \u043d\u0430\u043f\u043e\u0458\u0443\u0432\u0430\u043d \u043e\u0434 General Insurance<\/code><\/p>\n<p><b>Use Case-2:<\/b>To translate the content of a customized JavaScript template, then use koreUtil.autoTranslate as follows:<\/p>\n<p><b>Example:<\/b><\/p>\n<p><code>var accountBalance = getbalance(); <\/br> var message = koreUtil.autoTranslate(\"Your account balance is \");<\/br> var message = message.concat(env.currency, \u2018 \u2019, accountBalance); <\/br>print(message);<\/code><\/p>\n<p><b>Output in Serbian<\/b><\/p>\n<p><code>\u0411\u0430\u043b\u0430\u043d\u0441 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0447\u0435\u0442\u0430 USD 5,278.00<\/code><\/p>\n<p><b>Use Case-3:<\/b> To translate the bot responses in a particular language by passing the language code. An example where the bot will respond only in German even though the user is interacting in any language:<\/p>\n<p><b>Example<\/b><\/p>\n<p><code>var message = koreUtil.autoTranslate(\"This is a sample message\", \"de\");<\/br>print(message);<\/code><\/p>\n<p><b>Output in German<\/b><\/p>\n<p><code>Dies ist eine Beispielnachricht<\/code><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"koreUtil libraries provide pre-written JavaScript functions which makes common or complex tasks easy to implement. These libraries often target specific tasks such as setting up recurring rules for calendar, parsing and manipulation of dates, conversion of dates between timezone, tools to simplify programming with strings, numbers, arrays, functions and objects etc. How to Use koreUtil...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-22924","post","type-post","status-publish","format-standard","hentry","category-advanced-topics"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/posts\/22924","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/comments?post=22924"}],"version-history":[{"count":22,"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/posts\/22924\/revisions"}],"predecessor-version":[{"id":39230,"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/posts\/22924\/revisions\/39230"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/media?parent=22924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/categories?post=22924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-1\/wp-json\/wp\/v2\/tags?post=22924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}