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 

Question from New User

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



Joined: 13 Jul 2004
Posts: 3

PostPosted: Tue Jul 13, 2004 3:01 pm    Post subject: Question from New User Reply with quote

Hi,

I've downloaded TsiLang for testing in order to internationalize a project on which I'm working. One thing that is appealing is that endusers can make translations themselves when needed rather than having to pay a translator to add a language that may only be used by a small number of people.

One important question I have that isn't clear to me..here's the scenario: I define a couple of languages that I'm already familiar with (English and German) in my project. Can an enduser define a new language (say, Spanish) even though it has not yet been defined at design time? Would this eventuality be anticipated in code or is there another way that it is done?

Thanks!
Back to top
View user's profile Send private message AIM Address
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Tue Jul 13, 2004 3:40 pm    Post subject: Reply with quote

Actually, in order to provide functionality to automatically add new language you will need to make some coding.
I would suggest you the following scenario:
1. You ship the SIL or SIB file among with your application and use loading translations at run-time.
2. In your code you add something like the following:
Code:

procedure TForm1.LangMenuClick(Sender: TObject);
begin
  siLangDispatcher1.ActiveLanguage := TMenuItem(Sender).Tag;
end;

procedure TForm1.FormShow(Sender: TObject);
var
  MI: TMenuItem;
  I: Integer;
begin
  // this code shall be executed when dispatcher already loaded
  // translations and amount of languages is defined
  for I := 1 to siLangDispatcher1.NumOfLanguages do
  begin
    MI := TMenuItem.Create(Self);
    MI.Caption := siLangDispatcher.Langnames[I - 1];
    MI.Tag := I;
    MI.OnClick := LangMenuClick;
    // LangaugeMenu is the menu item that holds languages
    LanguageMenu.Add(MI);
  end;
end;

3. You may also distribute the SIL Editor or just URL to it and your end-users may download it and use to edit translations.
4. In SIL Editor there is possible to add/delete/midify languages so users may use it for this.
5. After new language added it will be automatically recognized use 2.
Hope this helps.
Back to top
View user's profile Send private message
mhtrozzo



Joined: 13 Jul 2004
Posts: 3

PostPosted: Wed Jul 14, 2004 6:03 am    Post subject: Reply with quote

Thanks for responding.

I'm still trying to work this out. I created a form with 2 combo boxes, 2 labels, siLangDispatcher, and siLangRTSE (so I could use the SIL editor). I set it up to change the language of these items when changing the value in ComboBox2, which worked successfully. I then added a menu to the form, and used your code. The menu looked like this:
Languages
English
German

The original items I had put on the form translated correctly, but the dynamically created ones never changed.

I went into SIL Editor, and created a new language (Spanish).

When I set LoadOnCreate to true, the labels change, but now the items in the combo boxes do not change. In addition, the new language I entered does not appear either.

Is there something I'm missing?
Back to top
View user's profile Send private message AIM Address
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Thu Jul 15, 2004 11:18 am    Post subject: Reply with quote

http://www.sicomponents.com/soft/demos/DynamicLanguages.zip
Here is the demo that performs needed task.
Back to top
View user's profile Send private message
mhtrozzo



Joined: 13 Jul 2004
Posts: 3

PostPosted: Mon Aug 02, 2004 9:45 pm    Post subject: Reply with quote

Hi,

Thanks for the demo...I have a much better understanding of it now. I just have one more question as I'm testing:

I put in another button to open a message box. In the Dialog section, I added a row called TForm1.dlg1.

I added this code to the OnClick event:

Code:
procedure TForm1.Button2Click(Sender: TObject);
var
s:string;
begin
//ShowMessage('test');
siLangDispatcher1.LoadAllFromFile(siLangRTSE1.SILFile);
//s := silangrtse1.GetText('dlg1');
s := silangrtse1.GetTextOrDefault('dlg1');
showmessage(s);
end;


However, when I click the button, I just get a blank message box. Am I doing something wrong?

Thanks.
Back to top
View user's profile Send private message AIM Address
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Tue Aug 03, 2004 3:50 am    Post subject: Reply with quote

mhtrozzo wrote:
In the Dialog section, I added a row called TForm1.dlg1.

You shall add it into Strings Exclamation section not Dialogs.
Dialogs section contains captions from dialog boxes, like MessageDlg(), InpuBox() and so on.
Strings section contains user defined strings and strings that were translated from source code (hard-coded strings).
Hope this helps.
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
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