Hi all,
I have a strange problem with translating using .sil file. On my designer computer everything works fine but when I install the application on other computer function "GetTextOrDefault" do not extract strings. I am receiving empty string.
All other strings (like captions on the forms) are OK and translated.
In the application I am using LandDispatcher, one LangRT and everywhere else LangLinked components.
All my applications are build with runtime packages and together with my application I am distributing TsiLang_D7 package.
What could be wrong? Again on my computer all is OK. Application is runing proparlly so I think all packages are delivered, but....??
Thanks
Kristijan Deberni
.sil file problem
Can you please take a llok at my code:
function TdmLanguage.TranslateStr(Str: string): string;
var
s: string;
begin
s := siLangRT.GetTextOrDefault(Str);
if s = '' then begin
if siLangRT.AddString(Str, [Str]) then
siLangRT.SaveStringsToFile(siLangRT.LangDispatcher.FileName, STRING_DELIM);
s := Str;
end;
Result := s;
end;
I am using this function for translating some "dinamically" changing strings. As you can see if the string is not found in the file it will be saved and latter somebody can just translate it.
For tests I have done a new file only with couple strings in [Strings] section. On the begining my file have a look like this:
[Language names - for internal use only!]
Language_1=English
Language_2=Polski
Language_3=Deutsch
[OPTIONS]
DELIMITER=~!@#$
[Strings]
TdmLanguage.&Asset=&Asset~!@#$Środki trwałe~!@#$Inventar~!@#$
TdmLanguage.&Companies=&Companies~!@#$Firmę~!@#$Firmen~!@#$
TdmLanguage.&Configuration=&Configuration~!@#$Konfiguracja~!@#$Konfiguration~!@#$
TdmLanguage.&Help=&Help~!@#$&Pomoc~!@#$&Hilfe~!@#$
TdmLanguage.&Machine base=&Machine base~!@#$Baza sprzętowa~!@#$Grundmaschine~!@#$
TdmLanguage.&Office=&Office~!@#$&Biuro~!@#$Büro~!@#$
TdmLanguage.&Personel=&Personel~!@#$Personel~!@#$Betriebspersonal~!@#$
TdmLanguage.&Repairs=&Repairs~!@#$Naprawy~!@#$Reparaturen~!@#$
TdmLanguage.&Reports=&Reports~!@#$Raporty~!@#$Berichte~!@#$
TdmLanguage.&System=&System~!@#$&System~!@#$&System~!@#$
TdmLanguage.&Tools=&Tools~!@#$Narzędzia~!@#$Werkzeuge~!@#$
TdmLanguage.&Window=&Window~!@#$Okno~!@#$Fenster~!@#$
TdmLanguage.A&sset consumption=A&sset consumption~!@#$Użycie środków trwałych~!@#$Auszehrung des Eigenkapitals~!@#$
TdmLanguage.C&atalogs=C&atalogs~!@#$Katalogi~!@#$Kataloge~!@#$
TdmLanguage.C&onfiguration=C&onfiguration~!@#$Konfiguracja~!@#$Konfiguration~!@#$
TdmLanguage.Creating main form...=Creating main form...~!@#$Tworzenie głównego okna...~!@#$Hauptfensterherstellung...~!@#$
TdmLanguage.Database: =Database: ~!@#$Baza danych:~!@#$Datenbank:~!@#$
TdmLanguage.Internal ordered=Internal ordered~!@#$~!@#$~!@#$
TdmLanguage.Internal unexpected=Internal unexpected~!@#$~!@#$~!@#$
TdmLanguage.Loading packages...=Loading packages...~!@#$Ladowanie pakietów...~!@#$Paket wird geladen...~!@#$
TdmLanguage.Opening connection...=Opening connection...~!@#$Otwieranie połączenia...~!@#$Verbindungsaufbau...~!@#$
TdmLanguage.Please wait...=Please wait...~!@#$Proszę czekać...~!@#$Bitte warten...~!@#$
TdmLanguage.R&epair plans=R&epair plans~!@#$Plany napraw~!@#$Reparaturplan~!@#$
TdmLanguage.Searching...=Searching...~!@#$Wyszukiwanie...~!@#$Suche...~!@#$
TdmLanguage.Starting application...=Starting application...~!@#$Uruchomianie aplikacji...~!@#$Programmstart....~!@#$
TdmLanguage.User: =User: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$
After I start the application none of the strings are found and the file looks like this:
[Language names - for internal use only!]
Language_1=English
Language_2=Polski
Language_3=Deutsch
[OPTIONS]
DELIMITER=~!@#$
[Strings]
r: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$=
r: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$=
r: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$=
r:~!@#$=
TdmLanguage.&Asset=&Asset~!@#$Środki trwałe~!@#$Inventar~!@#$
TdmLanguage.&Companies=&Companies~!@#$Firmę~!@#$Firmen~!@#$
TdmLanguage.&Configuration=&Configuration~!@#$Konfiguracja~!@#$Konfiguration~!@#$
TdmLanguage.&Help=&Help~!@#$&Pomoc~!@#$&Hilfe~!@#$
TdmLanguage.&Machine base=&Machine base~!@#$Baza sprzętowa~!@#$Grundmaschine~!@#$
TdmLanguage.&Office=&Office~!@#$&Biuro~!@#$Büro~!@#$
TdmLanguage.&Personel=&Personel~!@#$Personel~!@#$Betriebspersonal~!@#$
TdmLanguage.&Repairs=&Repairs~!@#$Naprawy~!@#$Reparaturen~!@#$
TdmLanguage.&Reports=&Reports~!@#$Raporty~!@#$Berichte~!@#$
TdmLanguage.&System=&System~!@#$&System~!@#$&System~!@#$
TdmLanguage.&Tools=&Tools~!@#$Narzędzia~!@#$Werkzeuge~!@#$
TdmLanguage.&Window=&Window~!@#$Okno~!@#$Fenster~!@#$
TdmLanguage.A&sset consumption=A&sset consumption~!@#$Użycie środków trwałych~!@#$Auszehrung des Eigenkapitals~!@#$
TdmLanguage.C&atalogs=C&atalogs~!@#$Katalogi~!@#$Kataloge~!@#$
TdmLanguage.C&onfiguration=C&onfiguration~!@#$Konfiguracja~!@#$Konfiguration~!@#$
TdmLanguage.Creating main form...=Creating main form...~!@#$~!@#$~!@#$
TdmLanguage.Database: =Database: ~!@#$Baza danych:~!@#$Datenbank:~!@#$
TdmLanguage.Internal ordered=Internal ordered~!@#$~!@#$~!@#$
TdmLanguage.Internal unexpected=Internal unexpected~!@#$~!@#$~!@#$
TdmLanguage.Loading packages...=Loading packages...~!@#$~!@#$~!@#$
TdmLanguage.Opening connection...=Opening connection...~!@#$~!@#$~!@#$
TdmLanguage.Please wait...=Please wait...~!@#$Proszę czekać...~!@#$Bitte warten...~!@#$
TdmLanguage.R&epair plans=R&epair plans~!@#$Plany napraw~!@#$Reparaturplan~!@#$
TdmLanguage.Searching...=Searching...~!@#$Wyszukiwanie...~!@#$Suche...~!@#$
TdmLanguage.Starting application...=Starting application...~!@#$~!@#$~!@#$
TdmLanguage.User: =User: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$
r: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$
Any idea what I am doing wrong?
Thanks
function TdmLanguage.TranslateStr(Str: string): string;
var
s: string;
begin
s := siLangRT.GetTextOrDefault(Str);
if s = '' then begin
if siLangRT.AddString(Str, [Str]) then
siLangRT.SaveStringsToFile(siLangRT.LangDispatcher.FileName, STRING_DELIM);
s := Str;
end;
Result := s;
end;
I am using this function for translating some "dinamically" changing strings. As you can see if the string is not found in the file it will be saved and latter somebody can just translate it.
For tests I have done a new file only with couple strings in [Strings] section. On the begining my file have a look like this:
[Language names - for internal use only!]
Language_1=English
Language_2=Polski
Language_3=Deutsch
[OPTIONS]
DELIMITER=~!@#$
[Strings]
TdmLanguage.&Asset=&Asset~!@#$Środki trwałe~!@#$Inventar~!@#$
TdmLanguage.&Companies=&Companies~!@#$Firmę~!@#$Firmen~!@#$
TdmLanguage.&Configuration=&Configuration~!@#$Konfiguracja~!@#$Konfiguration~!@#$
TdmLanguage.&Help=&Help~!@#$&Pomoc~!@#$&Hilfe~!@#$
TdmLanguage.&Machine base=&Machine base~!@#$Baza sprzętowa~!@#$Grundmaschine~!@#$
TdmLanguage.&Office=&Office~!@#$&Biuro~!@#$Büro~!@#$
TdmLanguage.&Personel=&Personel~!@#$Personel~!@#$Betriebspersonal~!@#$
TdmLanguage.&Repairs=&Repairs~!@#$Naprawy~!@#$Reparaturen~!@#$
TdmLanguage.&Reports=&Reports~!@#$Raporty~!@#$Berichte~!@#$
TdmLanguage.&System=&System~!@#$&System~!@#$&System~!@#$
TdmLanguage.&Tools=&Tools~!@#$Narzędzia~!@#$Werkzeuge~!@#$
TdmLanguage.&Window=&Window~!@#$Okno~!@#$Fenster~!@#$
TdmLanguage.A&sset consumption=A&sset consumption~!@#$Użycie środków trwałych~!@#$Auszehrung des Eigenkapitals~!@#$
TdmLanguage.C&atalogs=C&atalogs~!@#$Katalogi~!@#$Kataloge~!@#$
TdmLanguage.C&onfiguration=C&onfiguration~!@#$Konfiguracja~!@#$Konfiguration~!@#$
TdmLanguage.Creating main form...=Creating main form...~!@#$Tworzenie głównego okna...~!@#$Hauptfensterherstellung...~!@#$
TdmLanguage.Database: =Database: ~!@#$Baza danych:~!@#$Datenbank:~!@#$
TdmLanguage.Internal ordered=Internal ordered~!@#$~!@#$~!@#$
TdmLanguage.Internal unexpected=Internal unexpected~!@#$~!@#$~!@#$
TdmLanguage.Loading packages...=Loading packages...~!@#$Ladowanie pakietów...~!@#$Paket wird geladen...~!@#$
TdmLanguage.Opening connection...=Opening connection...~!@#$Otwieranie połączenia...~!@#$Verbindungsaufbau...~!@#$
TdmLanguage.Please wait...=Please wait...~!@#$Proszę czekać...~!@#$Bitte warten...~!@#$
TdmLanguage.R&epair plans=R&epair plans~!@#$Plany napraw~!@#$Reparaturplan~!@#$
TdmLanguage.Searching...=Searching...~!@#$Wyszukiwanie...~!@#$Suche...~!@#$
TdmLanguage.Starting application...=Starting application...~!@#$Uruchomianie aplikacji...~!@#$Programmstart....~!@#$
TdmLanguage.User: =User: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$
After I start the application none of the strings are found and the file looks like this:
[Language names - for internal use only!]
Language_1=English
Language_2=Polski
Language_3=Deutsch
[OPTIONS]
DELIMITER=~!@#$
[Strings]
r: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$=
r: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$=
r: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$=
r:~!@#$=
TdmLanguage.&Asset=&Asset~!@#$Środki trwałe~!@#$Inventar~!@#$
TdmLanguage.&Companies=&Companies~!@#$Firmę~!@#$Firmen~!@#$
TdmLanguage.&Configuration=&Configuration~!@#$Konfiguracja~!@#$Konfiguration~!@#$
TdmLanguage.&Help=&Help~!@#$&Pomoc~!@#$&Hilfe~!@#$
TdmLanguage.&Machine base=&Machine base~!@#$Baza sprzętowa~!@#$Grundmaschine~!@#$
TdmLanguage.&Office=&Office~!@#$&Biuro~!@#$Büro~!@#$
TdmLanguage.&Personel=&Personel~!@#$Personel~!@#$Betriebspersonal~!@#$
TdmLanguage.&Repairs=&Repairs~!@#$Naprawy~!@#$Reparaturen~!@#$
TdmLanguage.&Reports=&Reports~!@#$Raporty~!@#$Berichte~!@#$
TdmLanguage.&System=&System~!@#$&System~!@#$&System~!@#$
TdmLanguage.&Tools=&Tools~!@#$Narzędzia~!@#$Werkzeuge~!@#$
TdmLanguage.&Window=&Window~!@#$Okno~!@#$Fenster~!@#$
TdmLanguage.A&sset consumption=A&sset consumption~!@#$Użycie środków trwałych~!@#$Auszehrung des Eigenkapitals~!@#$
TdmLanguage.C&atalogs=C&atalogs~!@#$Katalogi~!@#$Kataloge~!@#$
TdmLanguage.C&onfiguration=C&onfiguration~!@#$Konfiguracja~!@#$Konfiguration~!@#$
TdmLanguage.Creating main form...=Creating main form...~!@#$~!@#$~!@#$
TdmLanguage.Database: =Database: ~!@#$Baza danych:~!@#$Datenbank:~!@#$
TdmLanguage.Internal ordered=Internal ordered~!@#$~!@#$~!@#$
TdmLanguage.Internal unexpected=Internal unexpected~!@#$~!@#$~!@#$
TdmLanguage.Loading packages...=Loading packages...~!@#$~!@#$~!@#$
TdmLanguage.Opening connection...=Opening connection...~!@#$~!@#$~!@#$
TdmLanguage.Please wait...=Please wait...~!@#$Proszę czekać...~!@#$Bitte warten...~!@#$
TdmLanguage.R&epair plans=R&epair plans~!@#$Plany napraw~!@#$Reparaturplan~!@#$
TdmLanguage.Searching...=Searching...~!@#$Wyszukiwanie...~!@#$Suche...~!@#$
TdmLanguage.Starting application...=Starting application...~!@#$~!@#$~!@#$
TdmLanguage.User: =User: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$
r: ~!@#$Użytkownik:~!@#$Benutzer:~!@#$
Any idea what I am doing wrong?
Thanks
Nothing, there is just a bug in our source. To fix it just open SICOMP.PAS and find the lines:
change them to:
and re-compile your project and packge.
Code: Select all
// AStream.Size := 0;
AStream.Position := 0;
Code: Select all
AStream.Size := 0;
AStream.Position := 0;