Search code examples
angularjsinternationalizationangular-translate

angular-translate - Using determinePreferredLanguage with user language setting?


Our web app's user account has language setting. It is vital for having some email contents sent from the server side to be translated based on that setting.

However we would like to use Angular Translate's in-built determinePreferredLanguage feature (sniffing browser's locale/language) for the login page when the logged in user's account details are not yet available for the front-end app.

Anyone has a code snippet for this?


Solution

  • Using determinePreferredLanguage() method was indeed the solution for this issue, but my confusion was caused by a bug in the feature itself when used in combination with fallbackLanguage() method.

    This bug has been fixed: https://github.com/angular-translate/angular-translate/issues/1368