jQuery/JS Common - utils - localization
formatDate(value, format)
import { formatDate } from "devextreme/localization"
Parameters:
Return Value:
formatMessage(key, value)
import { formatMessage } from "devextreme/localization"
Parameters:
Return Value:
JavaScript
- // Load the "greeting" message for the "en" and "es" locales
- DevExpress.localization.loadMessages({
- "en": {
- "greeting": "Hello, {0} {1}!",
- },
- "es": {
- "greeting": "Hola, {0} {1}!",
- }
- });
- // Set the current locale to "en"
- DevExpress.localization.locale("en");
- console.log(DevExpress.localization.formatMessage("greeting", ["John", "Smith"])); // logs "Hello, John Smith!"
- // Set the current locale to "es"
- DevExpress.localization.locale("es");
- console.log(DevExpress.localization.formatMessage("greeting", ["John", "Smith"])); // logs "Hola, John Smith!"
formatNumber(value, format)
import { formatNumber } from "devextreme/localization"
Parameters:
Return Value:
locale(locale)
import { locale } from "devextreme/localization"
Parameters:
locale:
NOTE
This method should be called only once - at the application's launch. It is necessary to reload the page each time you need to set new locale.
See Also
parseDate(text, format)
import { parseDate } from "devextreme/localization"
Parameters:
Return Value:
parseNumber(text, format)
import { parseNumber } from "devextreme/localization"
Parameters:
Return Value:
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.