Development by Davis

Headlines

viernes, 17 de agosto de 2012

Command Line Configuration of International Settings:


Windows Vista Command Line Configuration of International Settings
A feature new in Windows Vista makes it possible to configure international settings from the command line using an extension of the Regional and Languages Options Control Panel. For example, a network administrator may decide to mandate that all corporate computers in the international branch offices use the ISO standard date format (YYYY-MM-dd). By describing this property in an XML file, the network administrator can create scripts to automate the configuration of the international settings for any Windows Vista installation.
This command-line method of configuring international settings requires Windows Vista. It is bundled into the intl.cpl binary that ships with the operating system.
This article, which is intended for network administrators, explains how to configure international settings from a command line. For information about how to configure international settings during an unattended installation, see the Windows Automated Installation Kit documentation on Microsoft TechNet.

Overview
Using Command Line Configuration of International Settings
XML Entity Descriptions
Logging
Unicode Support
Custom Locale and Custom Culture Support
Definitions
Common Usage Scenarios
Overview
Windows Vista has a new method of configuring international settings from the command line. Using this feature, you can:
  • Change and customize formats of numbers, currency, time, dates, and sorting.
  • Change a display language preference.
  • Change a location preference.
  • Add and remove keyboards.
  • Add and remove input method editors (IMEs).
  • Change the language for non-Unicode programs (system locale).
  • Copy the international settings to Reserved Accounts (local service, network service, local system, and new users).
Using Command Line Configuration of International Settings
To configure international settings, you must first create an XML file. In this file, you specify the settings that you want to configure.
After you have created the XML file, you will use the command line to pass the file to Regional and Language Options for configuration. You can combine all of these XML entities in one XML file.
Accessing the Command Line Configuration
At the command line prompt, use the following command line arguments (where filename.xml is the full path to the XML file):
control intl.cpl,, /f:"filename.xml"
The schema requires that the user list entity be included in all files:
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
 <!--User List-->
 <gs:UserList>
 <gs:User UserID="Current"/>
 </gs:UserList>
</gs:GlobalizationServices>
To check that your XML is well-formed, open it with Internet Explorer. Internet Explorer will flag any syntax errors for you.
Changing the system locale requires the command prompt to be run with administrator privileges, and this action requires a system restart.
Copying the settings to the default user account and to the system accounts requires the script to be run from a command prompt with administrator privileges.
The XML entity descriptions are outlined in the next section of this article.

XML Entity Descriptions
<gs:UserList>
Required
  • List of users who will be affected by the XML file. It is only possible to change settings for the current user.Only the username “Current” is supported in this version.
Optional
  • Two optional attributes may be used — CopySettingsToDefaultUserAcct and CopySettingsToSystemAcct.
  • These two optional attributes allow all international settings to be applied to the default user account and to the system accounts (Local Service, Network Service and Local System).
  • You must be an administrator to apply settings using these two attributes.

<gs:LocationPreferences>
Optional
  • TSupports setting the GeoID for the current user.
  • Set by using a child element <gs:GeoID> , with an attribute containing the GeoID.
  • For a table of supported locations in Windows Vista click here.

<gs:MUILanguagePreferences>
Optional
  • Supports setting the display language and, if appropriate, the display language fallbacks for the system.
  • This is set by using a child element <gs:MUILanguage> with an attribute containing the language string.
  • To set the fallback language (also called base language) of the language set using <gs:MUILanguage>, use the element <gs:MUIFallback>.
  • Using this XML entity does not install the display languages. It should only be used for selecting display languages once they have been installed.
  • For a table of supported language packs in Windows Vista click here.

<gs:SystemLocale>
Optional
  • Changes the language for non-Unicode programs (system locale) for the system.
  • You must be an administrator to change this setting.
  • For a table of supported system locales, click here.
    Any locale in the table where the ANSI code page is equal to 0 and the OEM code page is equal to 1, is not supported.

<gs:InputPreferences>
Optional
  • Allows the user to add or remove keyboards and other input methods to the system without changing the user locale.
  • The default input locale can be selected by using the Default="true" attribute.
  • For a table of supported input locales click here.

<gs:UserLocale>
Optional
  • Supports changing the user locale.
  • Changes the settings for the current user locale.
  • Resets all settings back to their default values.
  • The <gs:UserLocale> entity has a required child element. <gs:Locale>. This child element supports two optional attributes: SetAsCurrent and ResetAllSettings.
  • If the format specified is not the current format (user locale), SetAsCurrent has to be set to true.
  • The <gs:Locale> entity has an optional child element that can be specified as either <gs:Win32> or <gs:Framework>*. These elements contain a list of child elements that represent the list of settings to be changed. One or many may be changed simultaneously.
  • If you are specifying custom properties, you cannot use localized notation. For example, if you are customizing the German long date format in Win32, you must usedddd, MMMM yyyy as the format.
  • For a table of supported user locales, click here.
* Either Win32 or .NET Framework names can be used in the list of options to set, but either one or the other must be chosen. The list of names is outlined in the table below. The schema does not support a mixture of these names.
Win32 Name
.NET Framework Name
NLS Identifier (LCTYPE)
sSort
AlternateSort
* LOCALE_SSORTNAME
sList
ListSeparator
LOCALE_SLIST
sDecimal
NumberDecimalSeparator
LOCALE_SDECIMAL
sThousand
NumberGroupSeparator
LOCALE_STHOUSAND
sGrouping
NumberGroupSizes
LOCALE_SGROUPING
iDigits
NumberDecimalDigits
LOCALE_IDIGITS
iNegNumber
NegativeNumberPattern
LOCALE_INEGNUMBER
sNegativeSign
NegativeSign
LOCALE_SNEGATIVESIGN
sPositiveSign
PositiveSign
LOCALE_SPOSITIVESIGN
sCurrency
CurrencySymbol
LOCALE_SCURRENCY
sMonDecimalSep
CurrencyDecimalSeparator
LOCALE_SMONDECIMALSEP
sMonThousandSep
CurrencyGroupSeparator
LOCALE_SMONTHOUSANDSEP
sMonGrouping
CurrencyGroupSizes
LOCALE_SMONGROUPING
iCurrDigits
CurrencyDecimalDigits
LOCALE_ICURRDIGITS
iCurrency
CurrencyPositivePattern
LOCALE_ICURRENCY
iNegCurr
CurrencyNegativePattern
LOCALE_INEGCURR
iLZero
LeadingZero
LOCALE_ILZERO
sTimeFormat
TimePattern
LOCALE_STIMEFORMAT
s1159
AMDesignator
LOCALE_S1159
s2359
PMDesignator
LOCALE_S2359
sShortDate
ShortDatePattern
LOCALE_SSHORTDATE
sLongDate
LongDatePattern
LOCALE_SLONGDATE
iCalendarType
Calendar
LOCALE_ICALENDARTYPE
iFirstDayOfWeek
FirstDayOfWeek
LOCALE_IFIRSTDAYOFWEEK
iFirstWeekOfYear
CalendarWeekRule
LOCALE_IFIRSTWEEKOFYEAR
sNativeDigits
NativeDigits
LOCALE_SNATIVEDIGITS
iDigitSubstitution
DigitSubstitution
LOCALE_IDIGITSUBSTITUTION
iMeasure
IsMetric
LOCALE_IMEASURE
* Only supported on formats with alternate sort orders, such as German (Germany).
For a full explanation of the terminology used, see LCTYPE Constants.

Logging
Output results are logged in the operational node in the Event Viewer. Output results are not displayed to the screen. This is to facilitate configuration of international settings from a script.
To view entries in the operational log
  1. Click Start, click Control Panel, click System and Maintenance, in the Administrative Tools applet groupclick Viewevent logs.
  2. Click the Applications and Service Logs node.
  3. Click Microsoft, click Windows, click International node, and then click Operational node.
  4. Look for events with the task category of NLS Unattended Regional and Language Options to view the entries associated with this feature.

Unicode Support
Unicode characters may be used where appropriate in the XML configuration file.

Custom Locale and Custom Culture Support
The installation of custom cultures or custom locales is not supported.
If a custom culture or custom locale has been installed using the .NET Framework CARIB (CultureAndRegionInfoBuilder) or by using the installer created by the Custom Locale Builder, you can apply and customize these locales from the command line.

Definitions
Format
Format refers to the currently selected format for the current user on the computer. This is also referred to as user locale. To see a table of user locales, click here.
GeoID
GeoID is an identifier in Windows which represents a geographical location. To see a table of geographical locations, click here.
Keyboard
A list of available keyboards and IMEs is available here.
System Locale
The system locale provides support for programs that do not support Unicode. It enables those programs to display text menus and dialog boxes in the correct language. A table of valid system locales is available here. Any locale in the table where the ANSI code page is equal to 0 and the OEM code page is equal to 1, is not supported as a system locale.

Common Usage Scenarios
The samples below illustrate how specific international settings can be configured from the command line.
Example: Change Format
To change format, you will create an XML file. The following example sets the format to English (United States).
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

 <!--User List-->
 <gs:UserList>
 <gs:User UserID="Current"/>
 </gs:UserList>

 <!--User Locale-->
 <gs:UserLocale>
 <gs:Locale Name="en-US" SetAsCurrent="true"/>
 </gs:UserLocale>

</gs:GlobalizationServices>
Save the XML document, open a Windows Vista command prompt and use the following command line arguments:
control intl.cpl,, /f:"filename.xml"
Where “filename.xml” is the full path to the XML file.
Example: Change and Customize Format (Win32)
To change and customize format, create an XML file. The following example sets the format to English (United States) and configures settings for Win32.
 <gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

   <!--User List-->
   <gs:UserList>
       <gs:User UserID="Current"/>
  </gs:UserList>

   <!-- user locale -->
   <gs:UserLocale>
     <gs:Locale Name="en-US" SetAsCurrent="true" ResetAllSettings="false">
         <gs:Win32>
             <gs:iCalendarType>1</gs:iCalendarType>
              <gs:sList>;</gs:sList>
              <gs:sDecimal>.</gs:sDecimal>
              <gs:sThousand> </gs:sThousand>
              <gs:sGrouping>1</gs:sGrouping>
              <gs:iDigits>3</gs:iDigits>
              <gs:iNegNumber>2</gs:iNegNumber>
              <gs:sNegativeSign>-</gs:sNegativeSign>
              <gs:sPositiveSign>+</gs:sPositiveSign>
              <gs:sCurrency>$</gs:sCurrency>
              <gs:sMonDecimalSep>.</gs:sMonDecimalSep>
              <gs:sMonThousandSep>,</gs:sMonThousandSep>
              <gs:sMonGrouping>3</gs:sMonGrouping>
              <gs:iCurrDigits>1</gs:iCurrDigits>
              <gs:iCurrency>3</gs:iCurrency>
              <gs:iNegCurr>3</gs:iNegCurr>
              <gs:iLZero>0</gs:iLZero>
              <gs:sTimeFormat>:HH:m:s tt</gs:sTimeFormat>
              <gs:s1159>a.m.</gs:s1159>
              <gs:s2359>p.m.</gs:s2359>
              <gs:sShortDate>d/M/yy</gs:sShortDate>
              <gs:sLongDate>dddd, MMMM yyyy</gs:sLongDate>
              <gs:iFirstDayOfWeek>6</gs:iFirstDayOfWeek>
              <gs:iFirstWeekOfYear>2</gs:iFirstWeekOfYear>
              <gs:sNativeDigits>012345789</gs:sNativeDigits>
              <gs:iDigitSubstitution>1</gs:iDigitSubstitution>
              <gs:iMeasure>0</gs:iMeasure>
              <gs:iTwoDigitYearMax>2049</gs:iTwoDigitYearMax>
          </gs:Win32>
      </gs:Locale>
  </gs:UserLocale>

 </gs:GlobalizationServices>
Save the XML document, open a Windows Vista command prompt and use the following command line arguments:
control intl.cpl,, /f:"filename.xml"
Where “filename.xml” is the full path to the XML file.
Example: Change and Customize Format (.NET Framework)
To change and customize format for .NET Framework, create an XML file. The following example sets the format to English (United States) and configures format settings for .NET framework

 <gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

   <!--User List-->
   <gs:UserList>
       <gs:User UserID="Current"/>
  </gs:UserList>

   <!-- user locale -->
   <gs:UserLocale>
     <gs:Locale Name="en-US" SetAsCurrent="true" ResetAllSettings="false">
         <gs:Framework>
             <gs:ListSeparator>;</gs:ListSeparator>
              <gs:NumberDecimalSeparator>.</gs:NumberDecimalSeparator>
              <gs:NumberGroupSeparator> </gs:NumberGroupSeparator>
              <gs:NumberGroupSizes>1</gs:NumberGroupSizes>
              <gs:NumberDecimalDigits>3</gs:NumberDecimalDigits>
              <gs:NegativeNumberPattern>2</gs:NegativeNumberPattern>
              <gs:NegativeSign>-</gs:NegativeSign>
              <gs:PositiveSign>+</gs:PositiveSign>
              <gs:CurrencySymbol>$</gs:CurrencySymbol>
              <gs:CurrencyDecimalSeparator>.</gs:CurrencyDecimalSeparator>
              <gs:CurrencyGroupSeparator> </gs:CurrencyGroupSeparator>
              <gs:CurrencyGroupSizes>1</gs:CurrencyGroupSizes>
              <gs:CurrencyDecimalDigits>3</gs:CurrencyDecimalDigits>
              <gs:CurrencyPositivePattern>3 </gs:CurrencyPositivePattern>
              <gs:CurrencyNegativePattern>3</gs:CurrencyNegativePattern>
              <gs:LeadingZero>0</gs:LeadingZero>
              <gs:LongTimePattern>:HH:m:s tt:</gs:LongTimePattern>
              <gs:AMDesignator>a.m.</gs:AMDesignator>
              <gs:PMDesignator>p.m.</gs:PMDesignator>
              <gs:ShortDatePattern>d/M/yy</gs:ShortDatePattern>
              <gs:LongDatePattern>dddd, MMMM yyyy</gs:LongDatePattern>
              <gs:Calendar>1</gs:Calendar>
              <gs:FirstDayOfWeek>6</gs:FirstDayOfWeek>
              <gs:CalendarWeekRule>2</gs:CalendarWeekRule>
              <gs:NativeDigits>012345789</gs:NativeDigits>
              <gs:DigitSubstitution>1</gs:DigitSubstitution>
              <gs:IsMetric>0</gs:IsMetric>
           </gs:Framework>
      </gs:Locale>
  </gs:UserLocale>

 </gs:GlobalizationServices>
Save the XML document, open a Windows Vista command prompt and use the following command line arguments:
control intl.cpl,, /f:"filename.xml"
Where “filename.xml” is the full path to the XML file.
Example: Change Current User Display Language
To change the current user’s display language, create an XML file. If this setting is not configured, the display language for new accounts will default to the display language of the computer.
The following example sets the display language to Arabic. In this case, the Arabic language is not fully localized and the display language fallback is set to Spanish. This is the language used when Arabic localized resources are not available.
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

 <!--User List-->
 <gs:UserList>
 <gs:User UserID="Current"/>
 </gs:UserList>

 <!—Display Language-->
 <gs:MUILanguagePreferences>
 <gs:MUILanguage Value="ar-DZ" />
 <gs:MUIFallback Value="es-ES" />
</gs:MUILanguagePreferences>

</gs:GlobalizationServices>
Save the XML document, open a Windows Vista command prompt and use the following command line arguments:
control intl.cpl,, /f:"filename.xml"
Where “filename.xml” is the full path to the XML file.
Log off, and then log on to view the changes.
Example: Change Display Language for the User’s Computer
These settings will change the current user’s display language, and then copy these settings to the system accounts. This will also update the display language for the Welcome screen. This becomes the default display language for all user accounts that do have not a display language configured.
To change the computer’s display language, create an XML file. The following example sets the display language to Arabic. In this case, the Arabic language is not fully localized and the display language fallback is set to Spanish. This is the language used when Arabic localized resources are not available.
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

 <!--User List-->
 <gs:UserList>
 <gs:User UserID="Current" CopySettingsToSystemAcct="true" />
 </gs:UserList>

 <!—Display Language-->
 <gs:MUILanguagePreferences>
 <gs:MUILanguage Value="ar-DZ" />
 <gs:MUIFallback Value="es-ES" />
</gs:MUILanguagePreferences>

</gs:GlobalizationServices>
Save the XML document, open an elevated Windows Vista command prompt and use the following command line arguments:
control intl.cpl,, /f:"filename.xml"
Where “filename.xml” is the full path to the XML file.
Example: Change Display Language for New Accounts
These settings will change the current user’s display language, and then copy the settings to the default user account. If this setting is not configured, the display language for new accounts will default to the display language of the computer.
To change the display language for new accounts, create an XML file. The following example sets the display language to Arabic and the display language fallback to Spanish.
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

 <!--User List-->
 <gs:UserList>
 <gs:User UserID="Current" CopySettingsToSystemAcct="true" />
 </gs:UserList>

 <!—Display Language-->
 <gs:MUILanguagePreferences>
 <gs:MUILanguage Value="ar-DZ" />
 <gs:MUIFallback Value="es-ES" />
</gs:MUILanguagePreferences>

</gs:GlobalizationServices>
Save the XML document, open an elevated Windows Vista command prompt and use the following command line arguments:
control intl.cpl,, /f:"filename.xml"
Where “filename.xml” is the full path to the XML file.
Example: Change Keyboards
To change keyboards, create an XML file as shown in the following example.
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

 <!--User List-->
 <gs:UserList>
 <gs:User UserID="Current"/>
 </gs:UserList>

<!--input preferences-->
<gs:InputPreferences>
 <!--en-US-->
 <gs:InputLanguageID Action="add" ID="0409:00000409" Default="true"/>
<!--de-DE-->
<gs:InputLanguageID Action="remove" ID="0407:00000407"/>
<!--bs-BA-Latn-->
<gs:InputLanguageID Action="add" ID="141a:0000041a"/>
<!--cy-GB-->
<gs:InputLanguageID Action="add" ID="0452:00000452"/>
<!--en-GB-->
 <gs:InputLanguageID Action="add" ID="0809:00000809"/>
</gs:InputPreferences>

</gs:GlobalizationServices>
Save the XML document, open a Windows Vista command prompt and use the following command line arguments:
control intl.cpl,, /f:"filename.xml"
Where “filename.xml” is the full path to the XML file.
To update the keyboard settings for the Welcome screen, set the following attribute:
CopySettingsToSystemAcct="true" in <gs:User>
Example: Change System Locale
To change system locale, create an XML file. The following example changes the system locale to German.
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">

 <!--User List-->
 <gs:UserList>
 <gs:User UserID="Current"/>
 </gs:UserList>

 <!--location-->
 <gs:LocationPreferences>
 <gs:GeoID Value="94"/>
 </gs:LocationPreferences>

</gs:GlobalizationServices>
Save the XML document, open a Windows Vista command prompt and use the following command line argument:
CopySettingsToSystemAcct="true" in <gs:User>
Where “filename.xml” is the full path to the XML file.

No hay comentarios:

Publicar un comentario