hi folks!!

Thinking in translate aiki and all we have already wrote and discuss about
it, i make a little experiment implementing a aiki dictionary.
Instead of thinking in implementation, i work on interface and rules that
aiki translation system must comply:

rules:
- Aiki (core,libs, apps) is developed in English.
- but a aiki site can developed in german, and can be translate to french.
- aiki site can be translate to any language.
- apps can add their own dictionaries.
- the translate function must be very very short

definitions:
- a dictionary is a object that have 2 static attributes: translate From,
translate To, and one method to translate terms. How is implemented the
dictionary
is irrelevant. We can use (and mixed): gettext files, database or arrays.
- aiki dictionary is a set of dictonaries (called domains).

With this in mind i develop a little library. The core is about 70 lines
longer. The shortcut functions is __ (rule 1, must be used in core
development) and t (rule 2, use it in widget).
,lines 101-120 is a dictionary implemented using array, and the rest a rude
test (sorry, Bryle.. phpunit is better).

In aiki we must:
$Aiki object must load the class and load the 'core' dictionary and 'widget'
dictionary.
Using:
- in core we must use function __ for translating terms. example:  __("File
not found")
- in dynamic apps with their own translations, we must use __(TERM, DOMAIN)
in each call or $aikidicionary->domain(DOMAIN) and then we can use __
without second argument (note, this don't affect the next  __() calls).
Example:  __("No keyword provided", "GoogleExtension")
- in widget we must define a markup (t("translate this")) or
<%t(translate)%> or [t[translate]], that internally calls t function.
Widgets must should not set translateTo, translateFrom or load dictionary.
That is work for aiki bootstrap.

unresolved/doubts:
- use config to set translation language?
- how manage for example en, en_EN, en_US?
- aiki must give the translateTo language as a parameter to dictionaries.
So, they can load only required languages.




Roger

<<attachment: dictionary.php>>

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to