Customizing Date Format
For the customization of the date layout, the Common.xml
locale file is used. This file contains the following entries:
<entry> <keyword>DATE_FORMAT.LONG.VALUE</keyword> <phrase>MMMM dd, yyyy</phrase> </entry> <entry> <keyword>DATE_FORMAT.MEDIUM.VALUE</keyword> <phrase>MMM-dd-yyyy</phrase> </entry> <entry> <keyword>DATE_FORMAT.SHORT.VALUE</keyword> <phrase>MM/dd/yyyy</phrase> </entry>
To customize the date format, you need to change the <phrase> values using the following elements:
Element | Description | Example |
---|---|---|
yyyy |
full year value |
"2021" |
yy |
short year value |
"21" |
MMMM |
full month value |
"February" |
MMM |
medium month value |
"Feb" |
MM |
short month value |
"02" |
dd |
day value |
"28" |
That is, the short date format for the Japanese date layout ("2021-02-28") looks as follows: yyyy-MM-dd.
The following instructions show two alternative ways to enable a customized date layout. Here, the example of the Japanese date layout is used, however, the instructions may be applied to any locale.
I
In this method, the date layout is customized with the help of L10N, a web tool that is used to create localization files.
- In the L10N localization web tool, set the required date format, and upload the changed parameters into the
Common.xml
file. - Go to System > Settings > Locales in the Core group.
- Select the Japanese locale (click the ja Language Code, or on the Japan language).
- Open the Customized Locale Files tab.
- Click Add.
- Select the updated
Common.xml
file, using Browse. - Click Submit.
II
In this method, the date layout is customized by editing the existing Common.xml
file.
- Go to System > Settings > Locales in the Core group.
- Select the default locale (en_US).
- Open the Source Locale Files tab.
- Click the Download link opposite the
Common.xml
file. - In the Common.xml file, configure the date format in the related file sections.
- Go to System > Settings > Locales in the Core group.
- Select the Japanese locale (click the ja Language Code, or on the Japan language).
- Open the Customized Locale Files tab.
- Click Add.
- Select the updated
Common.xml
file, using Browse. - Click Submit.
After completing the above actions, log out from CloudBlue Commerce, and log in to CloudBlue Commerce (under any valid account) selecting the Japan language on the log-in screen. Go to any screen that contains date fields. You will see that all dates are displayed in the Japanese date format.