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 ELSE ( IF (substr(browser.locale, 1, 2) = 'fr' and not 'French name'n Missing ) RETURN 'French name'n ELSE ( IF (substr(browser.locale, 1, 2) = 'de' and not 'German name'n Missing ) RETURN 'German name'n ELSE ( IF ( not 'Dutch name'n Missing ) RETURN 'Dutch name'n ELSE ( 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')
I considered sending all the languages to the browser and using java script to select one in this style
but SAS does not send the data in standard html tags, so that is impossible
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.
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.)
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.
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.