CNPack - MultiLang ԷԪ淶˵ By Riceball<riceball@cq118.com>
ƽ̨D34567, C456, K123 ϰ汾
ҪĿģͨԪ򵥵ķʽɵĽӦóһԷΪһԣڳڲҿʵʱлҪı̴ֻҪԪŵģϣֻǼоڷϼɡ

ܣ
һԪ
MultiLang ԷԪҪֺԪ: ؿԪ, ԹԪ, ԷԪ



1ؿԪLanguage DataStorage Components

ڶؿԪб淭ַͨѡͬĶؿԪ࣬ԽԱ浽 Ini
ļXML ļݿڲ Exe ļС

ע[riceball]

I.ڵһ׶εĿǽֻʵ TIniLanguageFileStorage
ؿԪԱ浽IniļС⣬ȻҲԿԼĶؿԪӭ뿪Ķ顣

II.(ļ)ı棬ѡԣҲļĹʵʵҲҪڴˡ



ЧĶԣѷģͨ TCustomLanguageStorage.Languages 
TCustomLanguageStorage.LanguageCount ʡǰʹõԿͨ
TCustomLanguageStorage.CurrentLanguage Էʻá

Ԫб
    *   TCustomLanguageStorage (Ԫֻûá)
    *   TCustomLanguageFileStorage(Ԫֻûá)
    *   TIniLanguageFileStorage (ûá)
    *   TCnIniLanguageFileStorage (ԪϹһûʹá)

2ԹԪLanguage Manager Components

ԹԪǶԷ뿪ĺԪԪԣԵʵʱлԼԶĬʾӦó

ע: һӦóֻӵһԹԪ! 仰˵һӦֻһ TCustomLanguageManager  ʵ, ͨGLanguageManagerΨһʵ.

Ԫб
    *   TCustomLanguageManager (ûá)
    *   TCnLanguageManager (ԪϹһûʹá)
    *   TCustomLanguageFormManager(ûá)
    *   TCnLanguageFormManager (ԪϹһûʹá)

3ԷԪTranslator Component

ԷԪǶԷ뿪ĸԪ˵ģһڴϣÿֻһԪڸ߷ôҪ롣ͬʱ
Delphi IDE ɻµĸ루紴ôָԵķļ༭ķļȵȣ

Ԫб
    *   TCustomTranslator (ûá)
    *   TCnTranslator (ԪϹһûʹá)


ʹָ
ʹò£
1).ģ飨ģ顢õģϷһʵؿԪԼҪ TIniLanguageFileStorage Ԫúʵԣ<TODO Ҫչ>

2).ȻһʵĶԹԪͨԪԹԷԪʹģ DataStorage ΪһĶؿԪؿԪҲͬһģϣԹԪԶøԣʹҵĵһؿԪûԲزġ
ڶԹԪ˫ɵԹӦãڶ׶ε[riceball]ͬԪϰҼѡԹ˵

3).÷Ԫ뷭ĴϡȻҪԪҲɷ룬ֻҪҪĴ FormCreate ¼дһ䣺
    aLanguageManager.Translate(Self);
ɡ

ǽʹôģ壬ֻҪʹã̳УôģģԶ÷ôģԷŵĿֿУ
  TCustomTranslationForm = class(TForm)
  private
  protected
    procedure DoCreate; override;
  public
    procedure Translate; virtual;
  end;

procedure TCustomTranslationForm.DoCreate;
begin
  inherited;
  Translate;
end;

procedure TCustomTranslationForm.Translate;
begin
  if Assigned(GLanguageManager)then 
    GLanguageManager.Translate(Self);
end;

ڽһǴĿ򵼣ǵڶ׶οǵˣĿ

ڷԪ˫巭(Form Translation Manager)ôǵһд巭гôϵԪԼӦҪʾѡЩҪ롣ֱӿʼ巭롣
ڷԪϵҼ²˵
  [&C]ļ
      еԪԣָļļûǷ񸲸ǻ߸¡
      ڵһ׶ݲʵִ巭Ըò˵дڵıҪ
  [&U]ļ
      ڴԪʹãָļ
  [&T]巭
_____________________________________________________________________________

China Pack - MultiLanguage Translation Component Packadge Requirement Specification
By Riceball<riceball@cq118.com>
Platform: D34567, C456, K123 above
introduction:
Main Purpose:
the most simplify the translation of an application from one language to another without a great deal of programming(just put the MultiLanguage Translation Components on the form or DataModule, no extra programming needed), and switch between the languages instantly.

1. Kernel Components
MultiLanguage Translation core Components are made up of the Language DataStorage Component, the Language Manager Component, the Translator Component.

1). Language DataStorage Components
  the Language DataStorage Components use to hold language strings which can be stored in Ini file , XML file, database, or internal EXE file.
 NOTE[riceball]: 
   I. In the first phase we will implement the TIniLanguageFileStorage to hold language strings in Ini files. Of cause, u can develope ur own Language DataStorage Components(welcome to join us).
   II. Create New Language , Save Language, Set Current Language(Languages Files Manage) are here.
The valid languages(translated) are accessible via the Languages and LanguageCount properties. The current language is accessible by the CurrentLanguage property.

Components:
    *   TCustomLanguageStorage (Abstract Class for the component developers.)
    *   TCustomLanguageFileStorage(Abstract Class for the component developers.)
    *   TIniLanguageFileStorage (for the component developers.)
    *   TCnIniLanguageFileStorage (the Component on the Palette for users.)

2). Language Manager Components
  The Language Manager are the core components of the translation suite. This component has the ability to manage multiple languages.
  Double click on the Language Manager Component to show Language Manager application. Or right click on it , choose the Language Manager menu item.
Note: One App must have one and only one TCustomLanguageManager instance!
      You can visit this instance via the GLanguageManager function.
  
Components:
    *   TCustomLanguageManager (Abstract Class for the component developers.)
    *   TCnLanguageManager  (the Component on the Palette for users.)
    *   TCustomLanguageFormManager(for the component developers.)
    *   TCnLanguageFormManager  (the Component on the Palette for users.)

3). Translator Component
  This is the helper component of the translation suite to make translated language easy in Delphi IDE(for lazy men). U should put a translator component to the form u wanna translated(Only one translator per form).

Components:
    *   TCustomTranslator(for the component developers.)
    *   TCnTranslator (the Component on the Palette for users.)

2. Usage: 
1). put a proper Language DataStorage on the main form or a DataModule. And set the proper properties. <TODO Need Expand: How to set proper properties>
2). then put a proper Language Manager(we use the Component Language Manager generally , this can translate the Components and Forms) on the main form or a DataModule, assign the DataStorage property(if the Language DataStorage component is on the same Form or DataModule, it can automatically assign the DataStorage component to itself). 
3). Put a translator component to the form u wanna translated.  Or don't put the translator component , write the following code on the FormCreate Event instead:
    aLanguageManager.Translate(Self);
[Suggestion] create a tranlation form template, u can inherit the form to get the translation ability:
  TCustomTranslationForm = class(TForm)
  private
  protected
    procedure DoCreate; override;
  public
    procedure Translate; virtual;
  end;

procedure TCustomTranslationForm.DoCreate;
begin
  inherited;
  Translate;
end;

procedure TCustomTranslationForm.Translate;
begin
  if Assigned(GLanguageManager)then 
    GLanguageManager.Translate(Self);
end;

Of cause u can create a translation Project wizards. this would be done on second phase.

Double click on the translator component to active the Form Translation Manager.
the Form Translation Manager let u choose which properties of these components on the form need be translated(first run). Or begin to translate online.
Right click on the translator component to popup the menu :
 &Create Language files
   Create ur specified Language files. U can choose whether override the exists files.
 &Update Language files
   Update ur specified Language files when u add some new components on it. 
  Form &Translation Manager
