Skip to content

OSX / Chrome 44 / US English - language preference not properly detected #56

@twanlass

Description

@twanlass
  1. Navigate to: chrome://settings/languages
  2. Add 'Spanish' to the list (or any other language)
  3. Drag 'Spanish' to the top
  4. Restart Chrome
  5. Console: navigator.language
    Result: "en-US"

This looks to be an issue w/ how you're detecting the language:
https://github.com/coderifous/jquery-localize/blob/master/src/jquery.localize.coffee#L20

A simple fix to this line would be:

JS

$.defaultLanguage = normaliseLang(navigator.languages? navigator.languages[0] : (navigator.language || navigator.userLanguage));

CS

$.defaultLanguage = normaliseLang(if navigator.languages then navigator.languages[0] else navigator.language or navigator.userLanguage)

I'll open a pull-request once I've had a chance to test further!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions