Re: bc_include_once() chicken & egg problem

Manuel Holtgrewe <[email protected]> Fri, 25 Mar 2005 00:15:47 +0100
Newsgroups gmane.comp.lib.binarycloud.devel
Message-ID <[email protected]>
Jean-Christophe Michel schrieb:
> Manuel Holtgrewe wrote:
> 
>> Hi
>>
>> I have a problem with the translating and caching bc_include_once() 
>> function. The dependency tree for bc_include_once() is as follows:
>>
>>  * I18n (to get the currently active locale)
>>    * Log
>>    * Conf
>>    * Session
>>    * Timer
>>  * Translation XML parser class
>>  * Translation XML cache
>>
>> This means that we cannot have translation in any of the classes named 
>> above.
> 
> 
> Anyway, what would there be to translate in these ? Exceptions and Log 
> messages ?
> 
> Maybe a better design on how services are started would be:
> 
>   Page is requested (uri)
>      1. $uri_lang passed through GET is retrieved, if any

Not required since a language change must be followed by a redirect. 
Something like this should go into a custom Project, though.

>      2. $client_lang from Client preferences (browser) is retrieved 
> together with $preferred_locales
>      3. Translation service can receive a first default lang from these 
> two values
>      4. Conf is started, tries to read files
>      5. Translation service receives the default i18n lang if it had none
>      6. Log is configured
>      7. Session is retrieved
>      8. Timer is launched
>      9. Perm/User
>     10. i18n initiates the lang from either User+session or $uri_lang 
> or  $client_lang
>     11. Translation service receives the definitive lang value.
> 
> So we would have more chances to present to the user messages in the 
> "right" lang:
> 1. Request depends on nothing; there is one Log::entry call, a test 
> could avoid a warning here
> 2. this would be done by a function in functions.php
> 4. if Conf has an exception to raise, Translation service has a first 
> default lang to use; it can try to read in cached values in this lang, 
> default with 'en', and if nothing, print the string.id.
> Once Conf is launched, Translation can load its preferences and know how 
> to retrieve all values, even if not in cache
> 6. if Log has an exception to raise, Translation now knows the i18n conf 
> value for default locale & lang.

OK, seems good.

-- 
GPG key: http://www.ggnore.net/~mholtgrewe/personal/files/public_key.asc
_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev