BookmarkSubscribeRSS Feed
Fluorite | Level 6

I have a lot of tables in which I have fields with Dutch, French and occasionally German names (I work in Belgium, where a majority is Dutch mother tongue, most others French and some German.) Often not all the fields are filled. For instance, communities usually have a name in one language, sometimes in two.

A German mother tongue user would prefer the German name of a community (if it is filled in), else any other name that is filled in. 


The natural solution would be to create a calculated field like this 

IF (substr(browser.locale, 1, 2) = 'nl' and not  'Dutch name'n Missing )
RETURN 'Dutch name'n
IF (substr(browser.locale, 1, 2) = 'fr' and not  'French name'n Missing )
RETURN 'French name'n
IF (substr(browser.locale, 1, 2) = 'de' and not  'German name'n Missing )
RETURN 'German name'n
IF ( not 'Dutch name'n Missing )
RETURN 'Dutch name'n
IF ( not 'French name'n Missing )
RETURN 'French name'n
ELSE 'German name'n ))))

Is something like that possible?

(An improvement would be to take into account the second browser locale too.)

Actually, why does SAS not offer a function that selects the best locale for you and you can use like this?

localizeData('nl', 'Dutch name'n, 'fr' 'French name'n, 'de' 'German name')
Fluorite | Level 6

I considered sending all the languages to the browser and using java script to select one in this style

	<p class=multilingual>{"nl":"Nederlands","fr":"Français","en":"English"}</p>
	<p class=multilingual>{"nl":"Vondel","fr":"Molière","en":"Shakespear"}</p>
	<p class=multilingual>{"nl":"Vlaanderen","fr":"Wallonie"}</p>
	<script type="text/javascript">
		var multiList = document.getElementsByClassName("multilingual");
		var miltiIndex;
		var language = navigator.languages == undefined 
			? navigator.language.split("-")[0] 
			: navigator.languages[0].split("-")[0];
		for (miltiIndex = 0; miltiIndex < multiList.length; miltiIndex++) {
			multiElement = multiList[miltiIndex];
			multiJson = JSON.parse(multiElement.innerHTML);
			multiElement.innerHTML = multiJson[language] == undefined
				? multiJson[Object.keys(multiJson)[0]]
				: multiJson[language];

but SAS does not send the data in standard html tags, so that is impossible

Opal | Level 21

If I understand you correctly you have columns which contain words in multiple languages. The question I have is how do you identify what language is being used in a particular column or row? Please be aware that web browsers don't contain language translators. SAS Viya contains some language capability but it is not something I have looked at yet.


The only way I can think of that might work would be to have your source data repeated for each language that you want - each data row would be repeated for the required languages and each row would have a language column identifying the language used in that row (and only that language). Then changing language would be simply a matter of changing the language column filter (for example LanguageSelect = 'ENG' or 'GER' etc). This of course requires your data to be well organised by language and I don't know if that is possible.  

Fluorite | Level 6

The hard problem is not to organize the data, but to know data in which language to display. You don't address that in your answer.

As SAS already allows localizing fixed text based on the browser locale and since the organization prefers not storing the language preference of the user, we want to select the content based on the browser locale too. 


I am the SAS platform administrator, developing a Proof of Concept (PoC) for our developers. We currently have hundreds of tables in which we have columns with Dutch, French and occasionally German or English descriptions. If I suggest they should reorganize their data and store different languages in different rows, I guess my PoC will not have much success.


(The problem is not typical for my current customer. My previous employer had the same situation and I have seen it before in my career. They too had columns, not rows per language.)

Opal | Level 21

From my (limited) understanding, setting the browser local will change the user interface language but does not deal with the report data - which is what I think you wanted it to handle.


I may be misunderstanding you, but if you are expecting the browser or SAS VA to translate report data on the fly based on a browser language setting then I'm pretty sure that isn't currently possible, although I'd love to be proved wrong. Hence my discussion on having a data source with multiple languages recorded either in different rows or I guess different columns. My point being that you need to store all the translations in the VA data source organised in such a way that it is easy to select.  

Opal | Level 21


The discussion here should give you the pointers and links.

This link found in above discussion specifically addresses how to configure browser local specific languages.

Fluorite | Level 6
This does not contain much new information for me.
Most of your first link and all of your second link is only on translating fixed text, not data.
When it comes to data, your first link does not give a solution to make it depend on the locale.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 3 in conversation