TsiLang and Resource Strings
-
- Posts: 5
- Joined: Mon Mar 22, 2010 11:54 am
TsiLang and Resource Strings
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
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
Best regards
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.
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.
Best regards,
Igor Siticov.
Igor Siticov.
-
- Posts: 5
- Joined: Mon Mar 22, 2010 11:54 am
Helloisiticov wrote:Hope this helps.
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/viewt ... =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?
Best regards
Actually, this case is a little bit different that just anI found you old post about BSF problem
http://www.sicomponents.com/forum/viewt ... =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?
![Wink :wink:](./images/smilies/icon_wink.gif)
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.
Best regards,
Igor Siticov.
Igor Siticov.
-
- Posts: 5
- Joined: Mon Mar 22, 2010 11:54 am
Yes, now I understand - what was the problem:isiticov wrote:authors of that VCL used code like this:
Caption := 'Warning'; for their dialogs and didn't mind about localization.
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 :evil:](./images/smilies/icon_evil.gif)
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
Best regards
Resource strings don't load to Strings Translations
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.
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.
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.
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.
Best regards,
Igor Siticov.
Igor Siticov.
Clearly. Maybe it was something wrong with installation of TsiLang?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.
It failed on three projects I have created: Code Gear Builder, Code Gear Delphi, Builder C++ 6.0.isiticov wrote: Can this be reproduced on any simple project on your side or it fails only on some particular unit?
Also I loaded the example http://www.sicomponents.com/soft/demos/ ... ources.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.
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.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.
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.
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.
- 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.
Best regards,
Igor Siticov.
Igor Siticov.
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?
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?
The version of TsiLang at run-time is 6.5.4 (what should be expected). Translation still doesn't work.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.
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?
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.
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.
Best regards,
Igor Siticov.
Igor Siticov.