Jump to content
Ian Branch

NormalizedLocaleName??

Recommended Posts

Hi Team,

Win 11, D11.3.1.

I am playing around with TFormatsettings and I am using this Emba code..

procedure Test;
var
   str1, str2: string;
   FS: TFormatSettings;
   strResult, strFormat: TStringBuilder;
begin
   strResult := TStringBuilder.Create;
   strFormat := TStringBuilder.Create;

   FS := TFormatSettings.Create('en-AU');
   strFormat.AppendFormat('%s %s', [FS.LongDateFormat, FS.LongTimeFormat]);
   str1 := FormatDateTime(strFormat.ToString, Now());
   strResult.AppendLine('1.'+str1);
   ShowMessage(FS.NormalizedLocaleName);
   strResult.AppendLine(FS.NormalizedLocaleName);

   //A second instance with a different locale (used for comparison)
   FS := TFormatSettings.Create('ro-RO');
   strFormat.Clear;
   strFormat.AppendFormat('%s %s', [FS.LongDateFormat, FS.LongTimeFormat]);
   str2 := FormatDateTime(strFormat.ToString, Now());
   strResult.AppendLine('2.'+str2);
   strResult.AppendLine(FS.NormalizedLocaleName);

   ShowMessage(strResult.ToString);
   //
end;

What should FS.NormalizedLocaleName return?  Emba Help says a string but I am getting nothing back.  Or maybe I am and it is blank.  Not expected.

 

Regards & TIA,

Ian

Share this post


Link to post

The xmldoc says: 

Quote

This is a candidate to be removed or left to store the Locale that created the FormatSettings.

 

Share this post


Link to post

p2k,

I was just experimenting with Formatsettings and came across this that gave me nothing.

 

Ian

Share this post


Link to post

Hi p2k,

I didn't really know what to expect, although I thought it might be, in my case, Australia.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×