There are three types of regional setting that are of relevance to an Excel user and developer.
Most versions of Excel are fixed to a particular language. If you buy the English version of Excel, the menus will always be displayed in English, and the function names of built-in worksheet functions will always be displayed in their English form. If the user changes their regional settings using the Control Panel, it may change many aspects of how Excel displays spreadsheets, including numeric and date formats etc, but the menus will still be in the language of the Excel version.
When interrogated as to its country settings, Excel returns a single numeric country code (usually the international telephone dialling code). The XLL+ run-time libraries take care of translating this into an appropriate language identifier.
The following functions provide support for using the Excel version language:
XllGetExcelCountryCode | Returns the Excel country code. |
XllGetExcelLanguageID | Returns the best available language contained in the add-in's resource files, for the Excel country code. |
XllLoadStringForExcelLanguage | Loads a string resource in the best available language to match the Excel version language. |
XllTranslateString | Takes a string that contains string resource IDs (e.g. "#123") and replaces the IDs with the appropriate strings from the resource file. |
If a user uses the Control Panel to set their Windows preferences to German (Austria), and uses an English language version of Excel, they will see dates and currencies in cells, formatted in Austrian convention. However, their menus and dialogs will still be in English (the Excel version language).
The following functions provide support for using the language of the regional settings:
XllGetStringLanguageID | Returns the language currently preferred by the user. The default value for this is the language selected in the Control Panel's Regional Settings applet. |
XllLoadString | Loads a string resource in the best available language to match the current language. |
XllTranslateString | Takes a string that contains string resource IDs (e.g. "#123") and replaces the IDs with the appropriate strings from the resource file. |
Finally, you may wish to allow the user to specify the language for the add-in's supporting text. A German speaker will wish to make their own decision as to whether to see text in English or in French, if those are the only two languages available for a particular add-in.
You may choose to provide a facility for the user to make a decision at run-time as to which language they will use, for example by providing a menu which lists all the laguages available for the add-in.
The following functions provide support for using a language selected by the user:
XllGetStringLanguageID | Returns the language currently preferred by the user. The default value for this is the language selected in the Control Panel's Regional Settings applet. |
XllSetStringLanguageID | Sets the preferred language for this add-in. This language will be used by all calls to XllLoadString, XllTranslateString etc. |
ResListLanguages | Gets a list of all the languages supported by the add-in. |