Skip to content

Allow a function to be passed in the messages property #1

@rxaviers

Description

@rxaviers

On globalizejs/globalize#481, @sompylasar has raised a different use case that requires a custom function to return Globalize messages. So, the goal of this issue make the messages option to either accept the string (as documented above) or a function that passes locale as its first argument. For example:

new globalizePlugin({
    production: options.production, // true: production, false: development
    developmentLocale: "en", // locale to be used for development.
    supportedLocales: [ "en", "es", "zh" ], // locales that should be built support for.
    messages: function( locale ) {
        // Messages in the JSON format for requested locale.
        return getMessagesFor( locale );
    }
    output: "globalize-compiled-[locale].[hash].js" // build output.
});

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