Internationalization

How the MATLAB® Process Uses Locale Settings

A locale is part of the user environment definition. It defines language, territory, and codeset, which is a coded character set. The MATLAB® process uses the user-specified locale name on all platforms. MATLAB also reads the user-specified UI language name, and uses it to select localized resources in the specified language. By using this feature, a user can select localized resources in US-English. The user-specified UI language setting also controls language and country settings of the Sun™ Java™ Virtual Machine (JVM™) software.

Consider the following when choosing your locale settings. To see what settings you are using, use the instructions in Setting the Locale.

Calculating Dates in Programs

To ensure the correct calculation of functions using date values, replace datenum function calls with the use of the dir function datenum field.

For example, look at the modification date of your MATLAB license.txt file:

cd(matlabroot)
f=dir('license.txt')

MATLAB displays information similar to:

f = 
       name: 'license.txt'
       date: '10-May-2007 17:48:22'
      bytes: 5124
      isdir: 0
    datenum: 7.3317e+005

If your code uses a command similar to:

n=datenum(f.date);

you must replace it with:

n=f.datenum;

Numeric Format Uses C Locale

MATLAB reads the user locale for all categories except for the LC_NUMERIC category. This category controls numeric data formatting and parsing. MATLAB always sets LC_NUMERIC to the C locale.

For example, some users expect a comma in a number while other users expect a decimal. The value of pi can be displayed as 3.1415 or 3,1415, depending on the format used by a locale. MATLAB always uses 3.1415, regardless of the format specified by the user locale.

Setting the Locale

This topic describes how to set locale values on various platforms.

Locale Settings on Windows® Platforms

MATLAB uses the system locale and user locale on Windows platforms.

Setting User Locale.   This topic describes how to set the user locale on each Windows platform.

Windows Vista™ Platforms.  

  1. Select Start -> Control Panel -> Regional and Language Options

  2. Open Formats tab

  3. Select an item from the drop-down list

Windows® XP Platforms.  

  1. Select Start -> Control Panel -> Regional and Language Options

  2. Open Regional Options tab

  3. Select an item from the drop-down list

Setting System Locale.   This topic describes how to set the system locale on each Windows platform.

Windows Vista™ Platforms.  

  1. Select Start -> Control Panel -> Regional and Language Options

  2. Open Administrative tab

  3. Click Change system locale... button

  4. Select an item from the drop-down list

  5. Reboot the system

Windows® XP Platforms.  

  1. Select Start -> Control Panel -> Regional and Language Options

  2. Open Advanced tab

  3. Select an item from the drop-down list

  4. Reboot the system

Locale and UI Language Settings on Linux® and Solaris™ Platforms

Linux®[1] and Sun Solaris™ platforms manage locale settings with six locale categories. These are the same categories used by C standard library functions.

The following locale categories are available:

Setting User Locale and User UI Language.   Use the LANG environment variable to specify a single locale for all locale categories. The locale specified with this variable may be partially or entirely over-written by other environment variables.

Use the environment variables LC_CTYPE, LC_COLLATE, LC_TIME, LC_NUMERIC, and LC_MONETARY to specify a locale for a particular category.

Use the LC_ALL environment variable to over-write all locales specified with other environment variables. If a single locale has to be set to all locale categories, use LANG instead of LC_ALL.

Locale and UI Language Settings on Macintosh® Platforms

The Macintosh OS X platform manages the user locale setting and the user UI language setting.

Setting User Locale.  

  1. Select System Preferences ->International

  2. Open Formats tab

  3. Select an item from the Region pop-up menu

Setting UI Language.  

  1. Select System Preferences ->International

  2. Open Language tab

  3. Drag an item to the top of the Languages list

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS