I think the following looks a little bit better:
```
var language = navigator.language || navigator.userLanguage || 'en-US';
PDFJS.locale = formatLocale(language);
```
Do you agree?