Be able to switch language before page loads?

I see there’s masterPage.js file with

$w.onReady(function () {

But this function runs after initial page has loaded.
I have a code which changes the value of “wixWindow.multilingual.currentLanguage” to change the language setting. But adding the code in this onReady() function in masterPage.js file, the page first needs to load with initial language setting then it changes to the setting that I want to change and reload.

Is there a way to set the “wixWindow.multilingual.currentLanguage” value before the page gets loaded so that when the page loads the first time, it is loaded with the language setting that I set to? (instead of having to reload with different language?)