Skip to content

Implicit language setting (similar to RequireJS i18n plugin) #25

Closed
@pilifs

Description

@pilifs

The RequireJS i18n plugin will set the language implicitly if none is provided in config based on user's browser setting. See this code:

                    if (!locale) {
                        locale = masterConfig.locale =
                            typeof navigator === 'undefined' ? 'root' :
                            ((navigator.languages && navigator.languages[0]) ||
                             navigator.language ||
                             navigator.userLanguage || 'root').toLowerCase();
                    }

Copied from here: https://github.com/requirejs/i18n/blob/master/i18n.js (line 124)

I noticed this functionality is missing from this loader. It only sets language based on global variable or HTML element lang attribute. Have you considered porting it over? If not, I can understand why. It's pretty easy to add this functionality yourself. In this case, I would suggest updating the description or FAQ. I'd imagine most people using this loader are coming over from RequireJS. This is a pretty big difference in behaviour.

Apologies if I missed any previous discussion -- tried a quick search. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions