Multi Language Map Configuration

294
5
Jump to solution
03-21-2024 01:59 PM
Labels (3)
ArielLow2146
Occasional Contributor II

I configured a map with pop-ups that use arcade to detect the locale and return results in either English or Spanish based on this blog https://www.esri.com/arcgis-blog/products/instant-apps/mapping/using-arcade-to-translate-pop-ups-for....

I set the web map locale to Spanish to confirm that the arcade works at the web map level. My StoryMap language is set to Spanish but when I load the map in the StoryMap it returns the English pop-up. 

Does setting the StoryMap language not set the locale for the web map? Is there a way around this other than creating a second map?

0 Kudos
1 Solution

Accepted Solutions
AbbyE_Esri
Esri Contributor

Hi @ArielLow2146 ,

Apologies for the late response. I am also seeing this behavior where the maps within the story aren't using the story's set locale as it should be. I'll continue taking a look at this and see if it isn't something we can address in the product, as it is unexpected behavior.

--Abby

View solution in original post

0 Kudos
5 Replies
AbbyE_Esri
Esri Contributor

Hi @ArielLow2146 ,

The story may be reading your user's locale if it is set to English, if you are viewing this story while logged in. This doc explains, "For signed-in users, the language is determined by the ArcGIS user profile language setting. For users who are not signed in, the language is determined by the browser's language setting."

Can you try changing your ArcGIS user profile language setting to Spanish? Here's another article explaining the language expectation: ArcGIS Storymaps - Configure story settings.

Let me know if setting your user profile changes that behavior for you.

--Abby

0 Kudos
ArielLow2146
Occasional Contributor II

Hi @AbbyE_Esri. I tried sharing the storymap publicly and setting my browser to spanish but the pop-up was still in english. 

Also, with the story language set to spanish I would expect that the browser and profile language wouldn't matter if I'm viewing the storymap outside of the builder. https://doc.arcgis.com/en/arcgis-storymaps/author-and-share/add-analytics-to-a-story.htm

0 Kudos
AbbyE_Esri
Esri Contributor

Hi @ArielLow2146 ,

Apologies for the late response. I am also seeing this behavior where the maps within the story aren't using the story's set locale as it should be. I'll continue taking a look at this and see if it isn't something we can address in the product, as it is unexpected behavior.

--Abby

0 Kudos
ArielLow2146
Occasional Contributor II

@AbbyE_Esri thanks!! happy to provide any additional information you may need as you look into this.

AbbyE_Esri
Esri Contributor

Hi @ArielLow2146 ,

We were able to discern the origin of the issue, and it's actually coming from the way the arcade expression is checking for the locale. The if (locale == 'es') is only successful if locale is set and the culture is not set. We do set the culture for correctly formatting our widgets.

Instead, we can use an expression that is satisfied with just the locale setting: Left(Lower(locale), 2) == 'es'

Let me know if using a variation of this expression works for you: 

 

var env = GetEnvironment(); 
var locale = env['locale'];
var popupText = $feature.Text_EN;
if (Left(Lower(locale), 2) == 'es') {
  popupText = $feature.Text_ES;
}

return { 
type : 'text', 
text : `Locale: ${locale}<br /><br />Translated Popup Text: ${popupText}`
}

 

 
--Abby
0 Kudos