Difference between revisions of "Talk:Internationalization/translation function"

(Globality)
(Globality)
Line 3: Line 3:
  
  
SHARED_TRANSLATOR => TRANSLATOR => ARCHIVE => MO_PARSER
+
SHARED_I18N_LOCALIZATOR => I18N_LOCALIZATOR => I18N_DATASTRUCTURE => I18N_MO_PARSER
 
::|
 
::|
 
CLASS_TO_LOCALIZE
 
CLASS_TO_LOCALIZE
  
  
The CLASS_TO_LOCALIZE simply inherits from our SHARED_TRANSLATOR, which only purpose is to return always the same "translator: TRANSLATOR". This class will in turn ask the archive for the translated strings, and at the end the mo_parser will be used if the string is not already in memory (or for the initial filling of the datastructure).
+
The CLASS_TO_LOCALIZE simply inherits from our SHARED_I18N_LOCALIZATOR, which only purpose is to return always the same "localizator: I18N_LOCALIZATOR".
  
 +
This class will in turn ask the archive for the translated strings, and at the end the mo_parser will be used if the string is not already in memory (actually for the initial filling of the datastructure).
  
SHARED_TRANSLATOR
 
  
* translator: TRANSLATOR
+
SHARED_I18N_LOCALIZATOR
 +
 
 +
* translator: I18N_LOCALIZATOR
 
* t(string): STRING
 
* t(string): STRING
 
* tn(string, args): STRING (or what you want)
 
* tn(string, args): STRING (or what you want)
Line 20: Line 22:
  
  
TRANSLATOR
+
I18N_LOCALIZATOR
* archive: ARCHIVE
+
* archive: I18N_DATASTRUCTURE
* ask(string): STRING (simple interface to ask the ARCHIVE)
+
* ask(string): STRING (simple interface to ask the archive)
 
* solve_template(string, args): STRING (function that compose a string from template+arguments)
 
* solve_template(string, args): STRING (function that compose a string from template+arguments)
  
  
ARCHIVE
+
I18N_DATASCTRUCTURE (already in place)
* mo_parser: MO_PARSER
+
* mo_parser: I18N_MO_PARSER
 
* load(n) (interface to the parser)
 
* load(n) (interface to the parser)
* get(n): STRING
+
* translate(STRING): STRING (interface to the I18N_LOCALIZATOR)
 
* data_structure: HASH|ARRAY (where the strings are effectively stored)
 
* data_structure: HASH|ARRAY (where the strings are effectively stored)
  
  
MO_PARSER
+
I18N_MO_PARSER (already in place)
 
* open(file)
 
* open(file)
 
* load(n): STRING
 
* load(n): STRING
* load_t(n): STRING
+
* load_translated(n): STRING
 
* load_hash_entry(n): STRING
 
* load_hash_entry(n): STRING
  
 
Only few ideas for the moment, review it and make it better and working! [[User:Trosim|Trosim]] 21:51, 9 May 2006 (CEST)
 
Only few ideas for the moment, review it and make it better and working! [[User:Trosim|Trosim]] 21:51, 9 May 2006 (CEST)
 +
:Actually part of this structure is already in place, so take care of it when writing the localizator. [[User:Trosim|Trosim]] 12:25, 24 May 2006 (CEST)

Revision as of 02:25, 24 May 2006

Globality

That's a possible structure of the whole thing:


SHARED_I18N_LOCALIZATOR => I18N_LOCALIZATOR => I18N_DATASTRUCTURE => I18N_MO_PARSER

|

CLASS_TO_LOCALIZE


The CLASS_TO_LOCALIZE simply inherits from our SHARED_I18N_LOCALIZATOR, which only purpose is to return always the same "localizator: I18N_LOCALIZATOR".

This class will in turn ask the archive for the translated strings, and at the end the mo_parser will be used if the string is not already in memory (actually for the initial filling of the datastructure).


SHARED_I18N_LOCALIZATOR

  • translator: I18N_LOCALIZATOR
  • t(string): STRING
  • tn(string, args): STRING (or what you want)

t and tn are interfaces to the translator


I18N_LOCALIZATOR

  • archive: I18N_DATASTRUCTURE
  • ask(string): STRING (simple interface to ask the archive)
  • solve_template(string, args): STRING (function that compose a string from template+arguments)


I18N_DATASCTRUCTURE (already in place)

  • mo_parser: I18N_MO_PARSER
  • load(n) (interface to the parser)
  • translate(STRING): STRING (interface to the I18N_LOCALIZATOR)
  • data_structure: HASH|ARRAY (where the strings are effectively stored)


I18N_MO_PARSER (already in place)

  • open(file)
  • load(n): STRING
  • load_translated(n): STRING
  • load_hash_entry(n): STRING

Only few ideas for the moment, review it and make it better and working! Trosim 21:51, 9 May 2006 (CEST)

Actually part of this structure is already in place, so take care of it when writing the localizator. Trosim 12:25, 24 May 2006 (CEST)