Talk:Internationalization/translation function
Globality
That's a possible structure of the whole thing:
SHARED_TRANSLATOR => TRANSLATOR => ARCHIVE => MO_PARSER
- |
CLASS_TO_LOCALIZE
The CLASS_TO_LOCALIZE simply inherits from out 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.
SHARED_TRANSLATOR
- translator: TRANSLATOR
- t(string): STRING
- tn(string, args): STRING (or what you want)
t and tn are interfaces to the translator
TRANSLATOR
- archive: ARCHIVE
- ask(string): STRING (simple interface to ask the ARCHIVE)
- solve_template(string, args): STRING (function that compose a string from template+arguments)
ARCHIVE
- mo_parser: MO_PARSER
- load(n) (interface to the parser)
- get(n): STRING
- data_structure: HASH|ARRAY (where the strings are effectively stored)
MO_PARSER
- open(file): FILE
- load(n): STRING
- load_t(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)