5.20203.748
5.20203.748

Globalizing Wijmo

To globalize your Wijmo application, include a reference to the appropriate culture file after loading Wijmo. Wijmo includes over 45 culture files you can choose from.

<head>
    ...
    <!-- set German culture -->
    <script src="https://cdn.grapecity.com/wijmo/5.latest/controls/cultures/wijmo.culture.de.min.js"></script>
</head>

Formatting

Dates

Dates are formatted using the Globalize.formatDate function. The format strings are described here: Date and Time Format Strings.

In addition to the standard .NET format specifiers, Wijmo supports a few additional specifiers including 'Q/q' for quarter, 'U/u' for fiscal quarter, and 'EEEE/eeee' for fiscal year.

Numbers

Numbers are formatted using the Globalize.formatNumber function. The format strings are described here: Numeric Format Strings.

Wijmo numeric formats allows you to include an explicit currency symbol to be used instead of the current culture's symbol. For example, an English application may need to generate lists with amounts in Dollars, Euros, and Yens.

wijmo.format

Creating strings based on formatted data can be challenging in JavaScript. ES6 addressed that limitation by introducing Template Strings.

Unfortunately, browser support is still limited for that solution, so Wijmo provides a format function that works everywhere. The format function takes a format string with placeholders that contain variable names and format specifiers, and a data object that supplies the variables.

For example:

wijmo.format('Welcome {name}! You have {miles:n0} miles in your account.', {
    name: 'Joe',
    miles: 2332123
});

Another example:

wijmo.format('{name}, thanks for being a customer since {date:D}.', {
    name: 'Joe',
    date: new Date()
});

Parsing

Dates

Dates are parsed using the Globalize.parseDate function. The format strings are the same used to format dates and are described here: Date and Time Format Strings.

Numbers

Numbers are parsed using the Globalize.parseFloat function. The format strings are the same used to format numbers and are described here: Numeric Format Strings.