Christopher Lenz wrote:
> Am 20.06.2007 um 17:10 schrieb Christian Boos:
>   
>> Christopher Lenz wrote:
>>     
>>> in the wake of the Babel release today, I'm creating a new branch
>>> where we can start integrating I18n support into Trac. The target
>>> release for merging this work would be >=0.12, i.e. definitely after
>>> 0.11.
>>>       
>> To ease merging between 0.11 and i18n/0.12, would it make sense to
>> introduce the usage of _("...") on trunk as well, at some point,  
>> with a
>> no-op _ function?
>>     
>
> Yeah, that is a good idea.
>
> I would propose:
>
> * add the module "trac.util.translation" (which is where you'd import  
> the gettext functions from on the i18n branch) which defines the  
> functions "gettext(string)" and "ngettext(singular, plural, num)".  
> Those functions would simply return their arguments appropriately.  
> Basically noops as you suggest, plus a tiny bit of logic in ngettext  
> to return the correct english pluralization.
>
> * also make the "_", "gettext", and "ngettext" functions available in  
> the default template context.
>   

ok

> * alias the "gettext" function to "_" and install it in the  
> __builtins__ namespace so that it is available without importing it  
> everywhere. Although I'm not entirely sure we even want that  
> behavior... the question is at what point the function gets installed;  
> on the branch it's done by the RequestDispatcher, which might lead to  
> surprises when using _() without importing it when running outside of  
> the context of a request.
>   

I'd favor the explicit import. That make us safe when used with other 
packages that would also rely on a '_' builtin (I'm sure they are some, 
as we're ourselves considering that option ;-) ), and make us safe when 
our codebase is used in scripts.
It'll also be one headache less for a newcomer to the codebase ("uh, 
where this '_' function defined?").

> * we start marking up any localizable strings in the python code on  
> trunk, and merge those changes to the i18n branch.

That's a great idea, as this would also make it easier to propagate such 
changes to the other sandbox branches.

-- Christian

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to