SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Automatic change of a translation

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
Ioan



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Mon Jul 10, 2006 4:23 pm    Post subject: Automatic change of a translation Reply with quote

Hello again,

We are using siComponents for translating our apps for a half year and everything works fine.

Now we trying to get to another level: we want to allow customizing the interface (and not only) based on an equivalences table (database). That means, every occurence of a word (ex: "user") that have an equivalent ("author") into a specified table to be replaced with this "translation" on the GUI (at run time).

I'm thinking to use the siComponents for this, using the equivalences as a different "language". That would require an "on-the-fly" translation and a way to bring the equivalences into a sib file.

Is there any way to automatically fill a sib file? Something like looking for any occurence of the "user" word in the first column (language) and create the second column (language) string replacing "user" with "author". Then load the sib file at run time and switching to the second "language".

Is this feasible?
Is this the right way to do it?

Sorry for the many questions I have, but I try to find out if is there already a solution for this before I go further.

Thanks,
Ioan
Back to top
View user's profile Send private message Visit poster's website
Haron



Joined: 11 Mar 2004
Posts: 39

PostPosted: Tue Jul 11, 2006 11:44 am    Post subject: Reply with quote

Can you, please, explain original problem? I think it is not possible to create SIB at run-time, but we can try to find work around.
Back to top
View user's profile Send private message
Ioan



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Tue Jul 11, 2006 12:17 pm    Post subject: Reply with quote

I don't want to create the SIB at run time, just modify it.

I have a table where my client can customize some items names. Like the "user" to be called "author".
I want to be able to read this table (at run time) and replace in my SIB file any occurence of "user" with "author", and then load the modified SIB.
Or, not changing the column for "Language1", but editing another "Language3" in SIB with the new name ("author") and then switching to "Language3".
Back to top
View user's profile Send private message Visit poster's website
Haron



Joined: 11 Mar 2004
Posts: 39

PostPosted: Tue Jul 11, 2006 12:32 pm    Post subject: Reply with quote

Modification of SIB file not possible. I think it is best to implement middle-tier which will provide translations from your (custom table) or load from SIB (if not found in custom translations).
Back to top
View user's profile Send private message
Ioan



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Tue Jul 11, 2006 3:58 pm    Post subject: Reply with quote

What about the ReplaceStringValue method? I just find it. It is not good to edit the SIB (SIL) file at run time?
Back to top
View user's profile Send private message Visit poster's website
Haron



Joined: 11 Mar 2004
Posts: 39

PostPosted: Tue Jul 11, 2006 4:07 pm    Post subject: Reply with quote

Hm, this method not known to me...
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Tue Jul 18, 2006 6:44 am    Post subject: Reply with quote

Hello,

Sorry for delay with reply.
ReplaceStringValue will replace the translation for specified language for defined value. So you will need to "know" the identifier of the string and language number.
I guess you don't need to modify a SIB but just translations internally stored in some TsiLang.
So you can use ReplaceStringValue method for this.
Please let me know if this helps.
Back to top
View user's profile Send private message
Ioan



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Tue Jul 18, 2006 12:17 pm    Post subject: Reply with quote

Thank you, Igor.
I will try this, but not right now, I'm going in vacation for the next weeks and I'm waiting for the boss to approuve my estimation.
I will let you know.
Ioan
Back to top
View user's profile Send private message Visit poster's website
Ioan



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Thu Aug 24, 2006 8:59 pm    Post subject: Reply with quote

I start working on this issue. I coded a function where I scan all the TsiLang TStrings properties (Captions, Hints, Strings, etc) and look for the string I want to replace. Then I retrieve the string ID and I call the ReplaceStringValue.
This function gets as input parameter the siLangLinked component of the current form as TsiCustomLang ( procedure CustomizeFields(siLang: TsiCustomLang); ).

After some tests I found out that the function seems to work properly, and I get the Strings values replaced, but not the Captions and other design features (I have only Multilines and Collections). I call the function on OnCreate form event (I also tried on OnShow). I logged into a file all the new and old values of the modified items and all seems to be properly replaced, but nothing changed on screen.

So, I think I miss something, maybe a kind of "refresh". Any idea?

Thanks,
Ioan
Back to top
View user's profile Send private message Visit poster's website
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Fri Aug 25, 2006 2:27 am    Post subject: Reply with quote

Just call ChangeLanguage method after finishing the replacing.
Back to top
View user's profile Send private message
Ioan



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Fri Aug 25, 2006 12:51 pm    Post subject: Reply with quote

It worked. Thanks.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group