Babel works very well for Pylons and TurboGears

http://pylonsbook.com/en/1.1/internationalization-and-localization.html

http://babel.edgewall.org/

What is Babel?

Babel is a collection of Python utilities that assist in
internationalizing and localizing Python applications, with an
emphasis on web-based applications.

What license governs the use of Babel?

Babel is released under the revised BSD license, which is a liberal
open source license that has been  approved by the  Open Source
Initiative (OSI).




2010/7/12 mdipierro <mdipie...@cs.depaul.edu>
>
> How about ## instead? ((...)) looks better but as I tried to implement
> it I realized that it ((opens and closes)) but there is no need to
> close unless we want to allow more than one set of ((..)). Do we?
> moreover it requires nasty regex.
>
>
>
>
>
> On 12 Lug, 17:56, Jonathan Lundell <jlund...@pobox.com> wrote:
> > On Jul 12, 2010, at 3:50 PM, mdipierro wrote:
> >
> > > As a test, I implemented this in trunk
> >
> > >        T(' hello world ') -> ' hello world
> > > '
> > >        T(' hello world # token') -> 'hello
> > > world'
> > >        T('hello # world # token') -> 'hello # world'
> >
> > > I.e. if no # nothing changes. If one '#', everything on its right is
> > > not translated, everything is stripped. More than one '#' is ignored
> > > and this would allow to have '#' in the translated string.
> >
> > That seems about right. I'm a *little* wary of using #, since it's pretty 
> > likely that there are existing T strings with a # in them, and they'll have 
> > to be fixed, no?
> >
> >
> >
> > > What do you think?
> >
> > > On 12 Lug, 17:30, Jonathan Lundell <jlund...@pobox.com> wrote:
> > >> On Jul 12, 2010, at 3:26 PM, mdipierro wrote:
> >
> > >>> I like ((...)). If I understand you suggest stripping the whitespaces
> > >>> ONLY inside ((..)). Did I understand?
> >
> > >> Stripping the main string, too--wasn't that the point of this exercise 
> > >> in the first place? I don't have a strong opinion, though.
> >
> > >>> On 12 Lug, 17:22, Jonathan Lundell <jlund...@pobox.com> wrote:
> > >>>> On Jul 12, 2010, at 3:15 PM, mdipierro wrote:
> >
> > >>>>> Ok but can I propose we use
> >
> > >>>>> T('canto /* my room */') instead of [[...]] to avoid confusion with
> > >>>>> markmin syntax? This would b easy to implement.
> >
> > >>>> Or ((my room)).
> >
> > >>>> Or <<my room>>.
> >
> > >>>> Regardless, you'd want to specify what happens to white space. Strip 
> > >>>> everything, I think, so T(' canto /* my room */') is equivalent to 
> > >>>> T('canto/*my room*/').
> >
> > >>>> (That's why I don't much like /*...*/, though; it's sort of ugly 
> > >>>> without extra spaces.)
> >
> > >>>>> On 12 Lug, 15:39, Jonathan Lundell <jlund...@pobox.com> wrote:
> > >>>>>> On Jul 12, 2010, at 1:32 PM, Álvaro Justen wrote:
> >
> > >>>>>>> On Mon, Jul 12, 2010 at 17:16, Jonathan Lundell 
> > >>>>>>> <jlund...@pobox.com> wrote:
> > >>>>>>>> On Jul 12, 2010, at 12:51 PM, mdipierro wrote:
> >
> > >>>>>>>>> suggestions? :-)
> >
> > >>>>>>>> Ideally (from a usability pov), a variant="something" argument to 
> > >>>>>>>> T(), I suppose. But I can't think of a non-messy way to do it.
> >
> > >>>>>>>> How about something like this:
> >
> > >>>>>>>> T('string to translate [[VARIANT something]]')
> > >>>>>>>> T('string to translate [[VARIANT something else]]')
> >
> > >>>>>>>> If there's no translation in effect, then [[VARIANT .*?]] *$ gets 
> > >>>>>>>> stripped from the string. Otherwise it's part of the lookup. It 
> > >>>>>>>> could just be
> >
> > >>>>>>>> [[something]]
> > >>>>>>>> [[something else]]
> >
> > >>>>>>>> ...keeping in mind that if you really wanted that at the end of a 
> > >>>>>>>> T() string, you could write:
> >
> > >>>>>>>> T('blah blah [[blah]][[]]')
> >
> > >>>>>>>> ...and only the trailing [[]] would be stripped.
> >
> > >>>>>>>> BTW, there's a typo in languages.py:
> >
> > >>>>>>>> # patter for a valid accept_language
> >
> > >>>>>>>> (and the pattern could use a comment or three)
> >
> > >>>>>>> I don't like the idea of changing the string to be translated. We 
> > >>>>>>> can
> > >>>>>>> use a 'context' parameter as I said in other email some time ago,
> > >>>>>>> like:
> > >>>>>>> T('canto', context='my room') #translating from pt-BR to English
> > >>>>>>> should be 'corner'
> > >>>>>>> T('canto', context='music') #translating from pt-BR to English 
> > >>>>>>> should be 'sing'
> >
> > >>>>>> That is, btw, my 'variant=' suggestion, above. If it's practical, 
> > >>>>>> I'd prefer it. But embedding the variant/context into the string 
> > >>>>>> would be (I think) less disruptive.
> >
> > >>>>>> T('canto [[my room]]')
> > >>>>>> T('canto [[music]]')
> >
> > >>>>>> Not as pretty, but almost identical in effect.


--

http://rochacbruno.com.br

Reply via email to