Hi

У сб, 2013-09-21 у 09:18 -0700, mcamel пише:
> Ok. I did so and worked fine.
> 
> I supposed words needed to be included in translation file once, but
> in fact, expressions including words has to be included also in the
> dictionary as if they were words itself.

web2py localisation subsystem uses THE WHOLE EXPRESSION not single
words. Also similar sentences can have different translations depending
on substitution parameters in them (or even on context):
"open an account" (BANK), "open an account" (SITE) and "open %s %
%{account[0]}" sentences can be translated in different ways. We do not
need to store "word"->"word" pairs in localization dictionary.

The pluralizaiton subsystem has its own dictionary where "word to word"
pairs are used. Words in pluralizatiоn subsystem MUST be in lower case
only and MOSTLY one word per record (but you can use word pairs or even
sentences in %%{...} templates but it isn't commonly used practice.

> 
> I propose this to be included in the manual:
>      1. expressions including words has to be included also in the
>         dictionary as if they were words itself

see explanation above

>      1. you can use '%%{word(%i)}' or '%%{word(%s)}' if you want to
>         use plural without showing the number that decides the plural
>         form.

%%{world....} pluralization subsystem template is a complex template
which covers many use cases. One of them is what you have described
above :) 
You can learn from the template in docs I have posted recently in this
thread.

> There's also an errata: substitute "rules/plural_rules/*.py" with
> "gluon/contrib/plural_rules/*.py".
> 
> Besides, i propose this to be added to
> "gluon/contrib/plural_rules/es.py":
> 
> # This rule isn't perfect but covers many cases. Complete rules at
> http://www.rae.es/dpd/srv/search?id=Iwao8PGQ8D6QkHPn4i.
> construct_plural_form = lambda word, plural_id: (word +
>                         ('es' if word[-1:] in ('s', 'x', 'ch', 'y',
> 'l', 'r', 'n', 'd', 'z', 'j')
>                          else 's'))
> 

Perfect rule! Thank you! I'll add it to es.py and send a patch.

> 
> 
> By the way, is there a better way to propose modifications to the
> manual?.


Yes, I think correct described "construct_plural_form" rule is a better
way to use plural forms! But I don't know these rules for all languages,
and for some languages (for example for my own Ukrainian language) this
rule is so difficult that manual filling of plural dictionary is the
only way.

With the best regards,
Vlad Kozlovskyy
Chernivtsi, Ukraine


> 
> 
> Thank you very much!.
> 
> 
> El sábado, 21 de septiembre de 2013 01:23:38 UTC+2, dbdeveloper
> escribió:
> 
>         It is not an issue. It's only a small misunderstanding. :)
>         
>         There are correct steps how to create application with working
>         pluralization system:
>         
>         1. Create a simple app
>         2. Replace index() at default.py with return T('%s %
>         %{object}', 2, language='es')
>         3. Insert into administrative interface, click [Reload
>         routers] (in my case it did not appear without this
>         workaround) 
>         4. Click [Manage]->[Edit] beside newly created app
>         5. Go to "Languages" section and click [update all languages]
>         to refresh language files
>         6. Click [Edit] beside "es.py" language file and find string
>         '%s %%{object}'
>         7. Write translation FOR THIS WHOLE STRING '%s %%{objeto}' and
>         click "Save changes", then return to previous window by
>         clicking [Edit] menu item on the top of the screen
>         8. Return to "Languages" section and click [Edit] beside
>         "Plural-Forms: plural-es.py" and add plural form for "objeto"
>         word: "objetos" then click "Update" and leave this screen by
>         clicking [Edit] menu item on the top of the screen.
>         9. Access app/default/index
>         
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to