<?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 Widget language not updating after applying `intl.setLocale(&amp;quot;es-MX&amp;quot;);` in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/widget-language-not-updating-after-applying-intl/m-p/1572953#M86334</link>
    <description>&lt;P&gt;I am developing a React app using the following:&lt;/P&gt;&lt;P&gt;- ArcGIS JS Maps SDK&lt;/P&gt;&lt;P&gt;- Calcite&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Survey123 web app API&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;When a user changes the language (default en-US to es-MX) in the embedded survey, I need to change the language of the map's widgets, as well.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bradMaps_0-1736199975549.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122805iD8026FD3DF261269/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bradMaps_0-1736199975549.png" alt="bradMaps_0-1736199975549.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I created a simple codepen that should change the map/widget's language on button click, but I'm not seeing the language in the search widget, for example, update.&amp;nbsp; Any ideas?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;intl.setLocale("es-MX")&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://codepen.io/bsnide/pen/gbYoxwE" target="_blank"&gt;https://codepen.io/bsnide/pen/gbYoxwE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jan 2025 21:50:54 GMT</pubDate>
    <dc:creator>bradMaps</dc:creator>
    <dc:date>2025-01-06T21:50:54Z</dc:date>
    <item>
      <title>Widget language not updating after applying `intl.setLocale("es-MX");`</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/widget-language-not-updating-after-applying-intl/m-p/1572953#M86334</link>
      <description>&lt;P&gt;I am developing a React app using the following:&lt;/P&gt;&lt;P&gt;- ArcGIS JS Maps SDK&lt;/P&gt;&lt;P&gt;- Calcite&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Survey123 web app API&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;When a user changes the language (default en-US to es-MX) in the embedded survey, I need to change the language of the map's widgets, as well.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bradMaps_0-1736199975549.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122805iD8026FD3DF261269/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bradMaps_0-1736199975549.png" alt="bradMaps_0-1736199975549.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I created a simple codepen that should change the map/widget's language on button click, but I'm not seeing the language in the search widget, for example, update.&amp;nbsp; Any ideas?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;intl.setLocale("es-MX")&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://codepen.io/bsnide/pen/gbYoxwE" target="_blank"&gt;https://codepen.io/bsnide/pen/gbYoxwE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 21:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/widget-language-not-updating-after-applying-intl/m-p/1572953#M86334</guid>
      <dc:creator>bradMaps</dc:creator>
      <dc:date>2025-01-06T21:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Widget language not updating after applying `intl.setLocale("es-MX");`</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/widget-language-not-updating-after-applying-intl/m-p/1588470#M86560</link>
      <description>&lt;P&gt;ArcGIS JavaScript API needs the locale data to be properly loaded. The intl.setLocale() method only works if the appropriate locale data is loaded. You need to ensure that the locale is supported and properly initialized in your app. You can set the locale when initializing the map as well.&lt;/P&gt;&lt;P&gt;Here's an example of how to make sure the language settings are applied correctly:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require([
  "esri/Map",
  "esri/views/MapView",
  "esri/widgets/Search",
  "esri/intl",
], function (Map, MapView, Search, intl) {
  // Set the initial locale
  intl.setLocale("es-MX"); // Set default to Spanish

  const map = new Map({
    basemap: "streets-navigation-vector"
  });

  const view = new MapView({
    container: "viewDiv",
    map: map
  });

  const searchWidget = new Search({
    view: view
  });

  view.ui.add(searchWidget, "top-right");

  // Language toggle function
  document.getElementById("langDiv").addEventListener("click", function() {
    const currentLocale = intl.getLocale();
    console.log("prev locale", currentLocale);
    // Toggle between 'en-US' and 'es-MX'
    const newLocale = currentLocale === "en-US" ? "es-MX" : "en-US";
    intl.setLocale(newLocale);
    console.log("current locale", intl.getLocale());
  });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2025 11:33:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/widget-language-not-updating-after-applying-intl/m-p/1588470#M86560</guid>
      <dc:creator>nafizpervez</dc:creator>
      <dc:date>2025-02-24T11:33:30Z</dc:date>
    </item>
  </channel>
</rss>

