Page 1 of 1

[i18n] Compatibles for XE3

PostPosted: January 4th, 2013, 7:37 pm
by arhangelsoft
Greetings all!

I was made some changes in the i18n package to make it more compatible with Delphi XE3 during install..

Modified files:
1. DELPHIAREA.INC
Open it, and paste code:
Code: Select all
{$IFDEF VER240} //Delphi XE3
  {$DEFINE DXE3}
{$ENDIF}

{$IFDEF VER230} //Delphi XE2
   {$DEFINE DXE2}
{$ENDIF}

{$IFDEF VER220} //Delphi XE
   {$DEFINE DXE}
{$ENDIF}


after:
Code: Select all
{ Then detect if it is older (.NET versions are ignored) }

Then save it.

2. i18nJSON.pas
Open it.
Find text:
Code: Select all
{ Local Helper Functions

after it you will be see two methods:
Code: Select all
function StrToNumber(const Str: String): Extended;
function NumberToStr(const Value: Extended): String;


replace it by this code:
Code: Select all
function StrToNumber(const Str: String): Extended;
begin
  if {$IFDEF DXE3} FormatSettings.DecimalSeparator {$ELSE} DecimalSeparator {$ENDIF} <> '.' then
    Result := StrToFloat(StringReplace(Str, '.', {$IFDEF DXE3} FormatSettings.DecimalSeparator {$ELSE} DecimalSeparator {$ENDIF}, []))
  else
    Result := StrToFloat(Str)
end;

function NumberToStr(const Value: Extended): String;
begin
  Result := Format('%g', [Value]);
  if {$IFDEF DXE3} FormatSettings.DecimalSeparator {$ELSE} DecimalSeparator {$ENDIF} <> '.' then
    Result := StringReplace(Result, {$IFDEF DXE3} FormatSettings.DecimalSeparator {$ELSE} DecimalSeparator {$ENDIF}, '.', []);
end;


All work's done!

Good luck and happy coding! \:D/

Re: [i18n] Compatibles for XE3

PostPosted: January 5th, 2013, 11:48 pm
by Kambiz
Thank you very much.

Finally I downloaded the trial version of XE3. The installation took a couple of hours! Now the i18n package is officially compatible with Delphi XE3.

I also compiled i18nEditor with XE3. The exe file is more or less one MiB bigger than the exe generated by Delphi 2010. It's kinda wired.

Re: [i18n] Compatibles for XE3

PostPosted: January 14th, 2013, 7:42 pm
by PhilCorleone
Explicitly modify your compiler's directives in Delphi 2010 by the following:

{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
{$WEAKLINKRTTI ON}

and see what is gonna happen to the size of your app Kambiz :p

------------------------------------------------------------------------------

Delphi 2010 has a better handling of UNICODE etc. which are included in the directives as RTTI.

Removing them would make the app smaller but may generate problems on international user's PCs