[i18n] Compatibles for XE3

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

[i18n] Compatibles for XE3

Postby arhangelsoft » January 4th, 2013, 7:37 pm

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/
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk

Re: [i18n] Compatibles for XE3

Postby Kambiz » January 5th, 2013, 11:48 pm

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.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: [i18n] Compatibles for XE3

Postby PhilCorleone » January 14th, 2013, 7:42 pm

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
PhilCorleone
Member
Member
 
Posts: 2
Joined: January 14th, 2013, 7:27 pm
Location: Boston, MA


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron