[Lazarus] Translations unit and impact on executable filesize
Bart
bartjunk64 at gmail.com
Sun Jul 17 16:48:24 CEST 2011
Hi all,
If you use the translations unit to translate unit resources strings,
then (even after stripping all debug info and using smart linking etc)
this will add about 1 Mb to the executable size.
This seems due to the fact that the
function ConvertEncoding(const s, FromEncoding, ToEncoding: string): string;
from lconvencoding unit is linked in.
It is used to translate the contents of po-files that are not utf-8 into utf-8.
A quick scan in the FreePascal and Lazarus source directories shows
that there are no .po files specifying non-utf8 encoding.
There are some files that do not specify an encoding, but
ConvertEncoding leaves them untouched.
I found these files without encoding (in the first 25 lines of text):
($FpcSource)\packages\fcl-base\examples\intl\restest.fr.po
($FpcSource)\packages\fcl-base\examples\intl\resttest.po
($FpcSource)\packages\fcl-base\examples\intl\restest.pb.po
($FpcSource)\packages\fcl-base\examples\intl\restest.de.po
($FpcSource)\packages\fcl-base\examples\intl\restest.nl.po
($FpcSource)\utils\fpdoc\intl\dwriter.de.po
($FpcSource)\utils\fpdoc\intl\makeskel.de.po
($FpcSource)\utils\fpdoc\intl\dglobals.de.po
($FpcSource)\utils\fpdoc\intl\fpdoc.de.po
(B.t.w. there is no sanity check in ConvertEncoding for empty
FromEncoding or ToEncoding parameter)
If we would specify that all fpc and lazarus .po files _must_ be in
utf-8, we can drop the lconvencoding unit from translations.pas, and
strip 1 Mb from the executable filesize.
(Tested on Windows platform only)
I know there have been lots of discussions about executable filesize
and 1 Mb doesn't seem much. But if you are short on webspace (where
you offer the executables for download) then it does matter.
Your opnions please?
Bart
More information about the Lazarus
mailing list