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 

TsiLang and Resource Strings
Goto page 1, 2  Next
 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
flashSICOMP



Joined: 22 Mar 2010
Posts: 5

PostPosted: Wed Mar 24, 2010 2:17 pm    Post subject: TsiLang and Resource Strings Reply with quote

Hello, TSI team
I check many posts on forum, try arrive at a solution about right way for resource strings translation...
While, I did't succeed.

Simple question: may be you have a Demo project with MessageDlg resource strings translation?
Or, how (if I can) translate resource strings for project with simple MessageDlg - change for MessageDlg(siLang1.GetTextOrDefault('IDS_0' (* 'Hello' *) ),mtWarning.....
window Caption from Warning to Внимание or Atención! (using TsiLang)?

PS: I try use Wizard for Import resource strings from EXE-file - strings successfully loaded to Srings property, HandleResourceStrings=True; ResourceLanguageIndex set to second language index.
Additional, Check Bad String IDs show all previous resource strings with Type=Not used in source of current module

WindowsXP, TsiLang 6.5

Thank for attention
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu Mar 25, 2010 7:39 am    Post subject: Reply with quote

Hello,

To be able to use multilanguage message dialogs you even don't need to use Resource strings translation. Just change MessageDlg(siLang1.GetTextOrDefault('IDS_0' (* 'Hello' *) ),mtWarning..... to
siLang1.MessageDlg(siLang1.GetTextOrDefault('IDS_0' (* 'Hello' *) ),mtWarning..... and that's all. TsiLang components conatin reimplemented all message dialog methods.
Hope this helps.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu Mar 25, 2010 7:40 am    Post subject: Reply with quote

http://www.tsilang.com/delphiglobalizationtool_faq.html#7 Wink
Back to top
View user's profile Send private message
flashSICOMP



Joined: 22 Mar 2010
Posts: 5

PostPosted: Fri Mar 26, 2010 4:09 pm    Post subject: Reply with quote

isiticov wrote:
Hope this helps.


Hello
Thanks for the quick response, but not all clear, it doesn't matter...
My question is, initially, gave rise from BusinessSkinForm (http://www.almdev.com) dialogs.

As I understand now:
if I have source, and I want use TsiLang in "Translate CONST mode" I must change RESOURCESTRING to CONS declaration
or
use "Import resource string wizard" (only one way, if I don't have a source)

I have source version BSF and strings in bsconst.pas coded as RESOURCESTRING, but,
I can't correct hahdle their via "Import resource string wizard"

I found you old post about BSF problem
http://www.sicomponents.com/forum/viewtopic.php?p=2409#2409

What do you mean "uses hardcoded values" and can I determine in advance: strings can processed by TsiLang or no, if I have only dcu or obj files?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Sat Mar 27, 2010 8:02 am    Post subject: Reply with quote

Quote:

I found you old post about BSF problem
http://www.sicomponents.com/forum/viewtopic.php?p=2409#2409

What do you mean "uses hardcoded values" and can I determine in advance: strings can processed by TsiLang or no, if I have only dcu or obj files?

Actually, this case is a little bit different that just an Wink usual MessageDlg. "Uses hardcoded values" means that authors of that VCL used code like this:
Caption := 'Warning';
for their dialogs and didn't mind about localization. If this is still the case for your sources of BSF then I doubt you can translate this without changing their sources.
Back to top
View user's profile Send private message
flashSICOMP



Joined: 22 Mar 2010
Posts: 5

PostPosted: Sat Mar 27, 2010 4:25 pm    Post subject: Reply with quote

isiticov wrote:
authors of that VCL used code like this:
Caption := 'Warning'; for their dialogs and didn't mind about localization.


Yes, now I understand - what was the problem:
constructor TbsSkinOpenDialog.Create(AOwner: TComponent);
....
FTitle := 'Open file';
FFilter := 'All files|*.*';
.....
etc....

90% strings declare as Resource string and 10% - like above Evil or Very Mad

I'm be back at the bottom of the ladder with BSF - this guys have only e-mail support
IAC, thank you so much for your time
Back to top
View user's profile Send private message
NPhoenix



Joined: 09 Dec 2009
Posts: 7

PostPosted: Fri Apr 20, 2012 1:38 pm    Post subject: Resource strings don't load to Strings Translations Reply with quote

Hello. Could you help me to solve problem with translating resource strings?

In this site I found topics with description how to translate MessageDlg buttons' captions. But there isn't any with my problem - translation of resource strings don't load to String Translations of TsiLang component.

I use CodeGear2009 - C Builder.

My goal is - to translate captions of buttons on MessageDlg.
(Using of TsiLang.MessageDlg don't satisfied me, because MessageDlg places also in simple units without Form component.)

Steps I used to do:
- create two languages.
- close the unit of form with TsiLang component, in which I guess to load translate (let its name would be 'FormA').
- Open Wizard: Tools -> Wizards -> Import resource strings from executable.
- On the first step I select the executable file (it doesn't place with form .dfm - it's in directory near that file); select 'Skip existing strings' and 'Don't check string IDs'.
- On the second step I select form unit file name:
-- file details were filled. There was loaded correct amount of languages which I've created and the correct name of Active Language.
- On the third step I see list of strings which was found in executable file. I select some of them, press the 'Finish' (it is '&Yes' and '&No').
-- Wizard show 'All strings were added successfully'. I press 'Close'. The button 'Finish' is disabled.

- open FormA TsiLang on String Translations:
-- it is empty.

- open FormA TsiLang on Dialogs Translations:
-- there was added some strings which hasn't been there before. And there is not those which I selected on the third step of Wizard.

Hope for any answer.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Fri Apr 27, 2012 10:20 am    Post subject: Reply with quote

Hello,

Sorry for the delay with my reply but we were unable to reproduce this case. On our side all the selected strings were imported just fine. Can this be reproduced on any simple project on your side or it fails only on some particular unit?
Also, I actually don't understand why you don't want to use TsiLang.MessageDlg. You can always place a
"main" TsiLang on some datamodule in your project and use it for displaying translated message boxes.
Back to top
View user's profile Send private message
NPhoenix



Joined: 09 Dec 2009
Posts: 7

PostPosted: Fri Apr 27, 2012 2:18 pm    Post subject: Reply with quote

isiticov wrote:
Hello,
Sorry for the delay with my reply but we were unable to reproduce this case. On our side all the selected strings were imported just fine.


Clearly. Maybe it was something wrong with installation of TsiLang?

isiticov wrote:

Can this be reproduced on any simple project on your side or it fails only on some particular unit?


It failed on three projects I have created: Code Gear Builder, Code Gear Delphi, Builder C++ 6.0.

Also I loaded the example http://www.sicomponents.com/soft/demos/MessageDlg&Resources.zip. The executable file translates buttons' captions. But if I try to load other resource strings, the list in String Translation of TsiLang becomes empty.

isiticov wrote:
Also, I actually don't understand why you don't want to use TsiLang.MessageDlg. You can always place a
"main" TsiLang on some datamodule in your project and use it for displaying translated message boxes.


I have several projects and one library of functions for them. One of this project need to be with translation. I don't want to include one component to that library, because of there is only one project uses it. I try to keep versatility for that library.

Besides the example I have loaded works fine. I saw the translation of resource strings in String Translation of TsiLang. I think I should try to find out the reason of this problem or I will try to find out other way to translate captions of buttons on MessageDlg.

Thank you for your attention.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Sun Apr 29, 2012 4:16 am    Post subject: Reply with quote

It is strange. The wizard performs the following actions:
- Gets strings from EXE
- Adds them to DFM (TsiLang)
- Sets HandleResourceStrings property to True
- Sets ResourceLanguageIndex.

Could you please try the following (make the same actions manually):
1. Open Strings section in Translation Editor
2. Add there some entry, for example "&Yes". And translate it.
3. Close editor saved.
4. Set HandleResourceStrings property to True.
5. Set ResourceLanguageIndex to the needed value if it differs from 1.
6. Rebuild your application and run to check if the "&Yes" translated.
Back to top
View user's profile Send private message
NPhoenix



Joined: 09 Dec 2009
Posts: 7

PostPosted: Tue May 08, 2012 1:52 pm    Post subject: Reply with quote

Ok. My TsiLang version is 6.4. I found that in v 6.5 was fixed the bug with unicode strings. I loaded the trial version 6.5 (I didn't remove the 6.4). And now the resource strings was loaded from executable file and added to dfm. But the captions on MessageDlg stayed not translated.
The property HandleResourceStrings is True.
I rebuilt the project after translating the loaded strings (IDS_RES_...).

Maybe it has some conflicts because of two versions of TsiLang?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Thu May 10, 2012 3:53 pm    Post subject: Reply with quote

If you've built your project with the latest version (you can check Version property of TsiLang at run-time) then it should work. If it still doesn't work please reproduce this on sample project and send it to us for testing.
Back to top
View user's profile Send private message
NPhoenix



Joined: 09 Dec 2009
Posts: 7

PostPosted: Sat May 12, 2012 9:45 am    Post subject: Reply with quote

isiticov wrote:
If you've built your project with the latest version (you can check Version property of TsiLang at run-time) then it should work. If it still doesn't work please reproduce this on sample project and send it to us for testing.


The version of TsiLang at run-time is 6.5.4 (what should be expected). Translation still doesn't work.

I have created three projects. There is readme-file with description of problem in each project directory. There is two projects with C ++ and one with Delphi.

In one C ++ project don't load resource strings from executable file. There is empty list in Resource String Wizard. In other two projects resource strings have been loaded, but the translation of buttons captions in MessageDlg stay without changes.

It is the url with projects archive: http://webfile.ru/5950533

P.S. Don't you mind if I would write the description of projects in Russian?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Mon May 21, 2012 2:24 pm    Post subject: Reply with quote

Hello,

Thank you for sending the samples. The origin of your problem is that you've modified the original resource strings values in your projects. When translating resource strings you shall not modify the imported original values in order to provide TsiLang an ability to identify them. Since TsiLang translates resources "by value". This means that if your resource strings are in English then English values shall be presented in language identified as ResourceLanguageIndex.
We've updated your sample projects and sent them to you (to your email used in this forum). They work just fine.
Back to top
View user's profile Send private message
NPhoenix



Joined: 09 Dec 2009
Posts: 7

PostPosted: Wed May 23, 2012 7:50 am    Post subject: Reply with quote

Thank you so much.
It all works fine.
I am very glad that all was so simple.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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