Fix positioning of the language change popup when sidebar is on the right
This fixes the same issue as 1d395d49660e340df6ecd120b91bbb55947c4419,
but for the little language change popup (shown after you change the
language) instead of the main interface.
Also fixed a minor bug for the main interface - we were measuring the
wrong $window, which happened to work right most of the time but