Fix language undo tooltip not showing

Test plan:
* Remove localstorage and cookies for a site
* Go the the site
* Change language and observe the undo tooltip

Change-Id: Ibecb5ea1cd537b2f019e7a9aa67ffac1a4e0923d
This commit is contained in:
Niklas Laxström
2016-04-12 08:22:27 +02:00
parent d964a10c83
commit c0fe2d1a54

View File

@@ -200,6 +200,14 @@
function userHasChangedLanguage() {
var previousLang = mw.uls.getPreviousLanguages().slice( -1 )[ 0 ],
currentLang = mw.config.get( 'wgUserLanguage' );
// Changed language is saved in showUndoTooltip, which is never
// called if previousLang is not defined, which will never be
// defined unless we do it now.
if ( previousLang === undefined ) {
mw.uls.setPreviousLanguages( [ currentLang ] );
}
return previousLang && previousLang !== currentLang;
}