In the Dojo Toolkit, the locale (language) has to be defined in the configuration used at loading time.
E.g.
<script data-dojo-config="async: 1, isDebug: 1, locale: 'es'" src="dojo/dojo.js"></script>
I want to specify the locale by an URL-Parameter like this:
../myapp/index.html?lang=es
I use the boilerplate for Dojo: Dojo Boilerplate
One idea was to load the dojo.js this way:
<script data-dojo-config="async: 1, isDebug: 1, locale: function(){//Code returning the value of the language URL-Parameter}" src="dojo/dojo.js"></script>
But this is not working.
Thank you!
PS: A solution is presented in Custom language variants. But this works only, if you have only one URL-Parameter.
This seems to work: URL-Parameters with JS.
Resulting in
<script data-dojo-config="async: 1, isDebug: 1, locale: decodeURIComponent((new RegExp('[?|&]' + 'lang' + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,''])[1].replace(/\+/g, '%20'))||null" src="dojo/dojo.js"></script>
Where 'lang' is the name of my Language URL-Parameter.