yes that's possible if the code above is executed before Polylang sets the current language. With your current Polylang settings, the language is set in a function hooked to 'wp', which is quite late.
Try with permalinks enabled and the language code in all urls. Thus, the language will be set before the theme.