Page 1 of 1

.sil file problem

Posted: Wed Oct 13, 2004 6:04 am
by kdeberni
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

Posted: Wed Oct 13, 2004 8:49 am
by isiticov
1. TsiLangRT is necessary only! if you need run-time editing of translations by your end-user.
2. Make sure that path to SIL file used is either FULL or correctly detected.

P.S. TsiLang_D7 package is not needed since it is only design-time package.

Posted: Wed Oct 13, 2004 12:17 pm
by kdeberni
The sil file is detected properlly as far as all captions on forms are translated and if I remove sil file nothing is translated. But in both cases function "GetTextOrDefault" is not extracting string returning empty like it does not exists at all but it is in file.

Any other idea?

Posted: Thu Oct 14, 2004 6:06 am
by isiticov
Please try to verify SIL file using some text editor or SIL Editor that it has valid format.

Posted: Thu Oct 14, 2004 7:05 am
by kdeberni
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

Posted: Thu Oct 14, 2004 8:39 am
by isiticov
Nothing, there is just a bug in our source. To fix it just open SICOMP.PAS and find the lines:

Code: Select all

//    AStream.Size := 0;
    AStream.Position := 0;
change them to:

Code: Select all

    AStream.Size := 0;
    AStream.Position := 0;
and re-compile your project and packge.

Posted: Thu Oct 14, 2004 8:39 am
by isiticov
Sorry for this!