开发者

Delphi Unicode Determine Culture regardless of user settings

I'm thinking about upgrading our Delphi2006-projects to Delphi XE. the effect of that will be开发者_JAVA百科 that Unicode is used instead of ANSI.

In .net-framework I can use CultureInfo on a Thread in order to determine the formatting of the application regardless to the user setting (the application is not mature enough to support all formattings(legacy, legacy, legacy). Also there is not present intention to do this.). Letting the application/thread determine the formatting is something I would like to be able to do using Delphi too. How can this be acheived?


First of all, please make a distinction (source: wikipedia) between:

  1. Internationalization (i18n) is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes.
  2. Localization (L10) is the process of adapting internationalized software for a specific region or language by adding locale-specific components and translating text.

For i18n, you'll use either Delphi ITE/ETM GetText or other free or paying tool (like ours).

But your point is about L10, i.e. localization. There is some documentation in the EMB site, but it sounded to me like a bit confusing i18n and L10, even if both definition are quoted in the articles.

Since the first version of Delphi, you have dedicated functions and variables in the SysUtils unit:

  • TFormatSettings is a record type which can be used to retrieve the L10 settings (exists only on newer Delphi versions);
  • FormatSettings which is a global variable, which can be used to retrieve (or set) the current default format settings;
  • FormatDateTime which can be used to force another format settings;
  • Format is the main function for formating some data (with currency or decimal to text settings), and there is an overloaded version which support TFormatSettings.
  • You can use TFormatSettings.Create (on newer Delphi) or, the good old (deprecated) GetLocaleFormatSettings which populate some global variables.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜