<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Getting locale in Javascript and gettext() in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Getting-locale-in-Javascript-and-gettext/m-p/410282#M26949</link>
    <description>&lt;P&gt;I am trying to either (or maybe I need both) get the locale setting of the client in Javascript to replace some tokens in my search string, as well as trying to find if the gettext function is available in Javascript for localization.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jun 2018 17:11:03 GMT</pubDate>
    <dc:creator>derekf</dc:creator>
    <dc:date>2018-06-26T17:11:03Z</dc:date>
    <item>
      <title>Getting locale in Javascript and gettext()</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Getting-locale-in-Javascript-and-gettext/m-p/410282#M26949</link>
      <description>&lt;P&gt;I am trying to either (or maybe I need both) get the locale setting of the client in Javascript to replace some tokens in my search string, as well as trying to find if the gettext function is available in Javascript for localization.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 17:11:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Getting-locale-in-Javascript-and-gettext/m-p/410282#M26949</guid>
      <dc:creator>derekf</dc:creator>
      <dc:date>2018-06-26T17:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Getting locale in Javascript and gettext()</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Getting-locale-in-Javascript-and-gettext/m-p/410283#M26950</link>
      <description>&lt;P&gt;Hello @derekf,&lt;/P&gt;

&lt;P&gt;Did you have a look at this?&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.1/Viz/tokens"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.1/Viz/tokens&lt;/A&gt;&lt;BR /&gt;
and more precisely at the &lt;STRONG&gt;Use global tokens to access environment information&lt;/STRONG&gt; section?&lt;BR /&gt;
I think &lt;EM&gt;$env:locale$&lt;/EM&gt; is a good place to start.&lt;/P&gt;

&lt;P&gt;Please also have a look at the following js code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require(['splunkjs/mvc','jquery', 'splunkjs/mvc/simplexml/ready!'], function (mvc,$) {
    var utils = require("splunkjs/mvc/utils");
    $(document).ready(function () {
        // Retrieve the default token model
        var defaultTokenModel = mvc.Components.get("default");
        // Listen for a change to the token value
        defaultTokenModel.on("change:token", function(newToken, token, options){
            var x = document.getElementById("someTag");
            if (token==="True"){
                x.style.stroke="red";
            }
            else{
                x.style.stroke="lightblue";
            }
        });
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From there, you should be able to get started&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 07:13:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Getting-locale-in-Javascript-and-gettext/m-p/410283#M26950</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-07-02T07:13:39Z</dc:date>
    </item>
  </channel>
</rss>

