Awesome ideas!

I agree with Robert with the plural form of translations.

+1

--
JP

Em Qua, 2005-11-02 às 17:08 +0000, Robert Wittams escreveu:
> Totally agree on the first 4.
> 
> > 5. Similarly, I don't like the changes to the template code.  
> > Basically, I don't want to have to explain i18n to template authors 
> > (they shouldn't have to know anything about it) and explaining why 
> > someone needs to do::
> > 
> >     <title>{{ _('Title') }}</title>
> > 
> > instead of just::
> > 
> >     <title>Title</title>
> > 
> > And *I* barely understand what::
> > 
> >     <p>{% i18n ngettext('There is %(count)d file', 'There are % (count)d
> > files', files|count) %}</p>
> > 
> > is doing, and "leaking" %-style string formatting into the template 
> > code seems ugly.  Specifically, I'd like the template language to be  as
> > losely coupled to Python as possible; I'd like implementations of  the
> > template language on other platforms to be possible.
> 
> I also think it may be advisable to extract strings from templates in a
> different way.
> 
> > We've deliberately kept the template language as simple as possible, 
> > and I feel like this damages it.  I'm not sure how to get around it 
> > (again, I understand how you've got to mark the template files for 
> > string collection), but off the top of my head I'd like to see 
> > something like::
> > 
> >     <title>{% translate "Title" %}</title>
> >     <p>{% translate %}Hello, {{ name }}, welcome to {{ site }}!{% 
> > endtranslate %}</p>
> >     <p>{% translate %}There are {{ count }} {% pluralize count  "file"
> > "files" %}{% endtranslate %}</p>
> > 
> > In this sketch, {% translate %} as a non-block tag (when it has 
> > arguments) replaces {{ _('title') }}; as a block tag (when it's got  no
> > arguments) it replaces {% i18n _(...) %}, and {% pluralize %}  within a
> > translate block replaces {% i18n ngettext %}.
> > 
> > Thoughts?
> 
> Issues
> 
> 1. It being a block template tag will lead to people thinking they can
> eg stick a for loop in there. So do we raise a TemplateSyntaxError on
> anything other than a TextNode, VariableNode or PluralizeNode? The only
> other way I can see to deal with this is a new set of delimiters, eg
> {| |}. Not really sure I like that route either. (variable delimiters
> inside that? ugh.)
> 
> 2. Ordering matters, so I think the embedded pluralize is a nono. The
> whole structure of a sentence/phrase can change afaik. Some languages
> have four or more plural forms.
> 
> So my off the top of the head suggestion for the ngettext would be:
> 
> {% translate files|count as count %}
>    There is {{count}} file.
> {% plural %}
>    There are {{count}} files.
> {% endtranslate %}
> 
> Also, maybe we need to find a shorter name than translate, could get
> tedious.
> 

Reply via email to