-
Notifications
You must be signed in to change notification settings - Fork 966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localize Pluralize/Singularize (WAS: Localizable InflectorExtensions) #197
Comments
I think by inflector methods you only mean This is a great idea. We can extract the localizable logic out of the class, implement a default pluralizer/singularizer/inflector class with the current logic (excluding the rules) and provide hooks for injecting the rules etc; kinda like how What does the localisation committee think? /cc @harouny, @JonasJensen, @mexx, @mnowacki, @hazzik, @thunsaker, @henriksen, @ekblom, @akamud, @ignorkulman, @Borzoo, @onovotny |
Yes, I'm talking about the Pluralize and Singularize feature.
I think that the Spanish language has similar rules than the english language regarding singularity and plurality (It has uncountable, singular only, plural only and irregular words) so the behavior could be the same. I have my doubts if IInflector, DefaultInflector, EnglishInflector, etc should have some sufix (Provider? Engine?) |
Before going too far, I'd like to confirm that it is actually possible to implement this logic in other languages too, either through changing the rules or implementation from scratch. Depending on the complexities of other languages we may have to choose a different design or think harder about this. Sometimes language rules get way too complex (#64)! I have considered creating a new FWIW the English implementation is relatively buggy too. See #142 for more details. |
After looking at the For example, there's a rule that says that words that end with "ão" will have "ões" in its plural form:
But there are some words that don't follow that rule:
In some cases this rule changes because the accentuated syllable is not the last one. But some words won't even follow this rule (and as far as I know, there is no rule for these kind of words):
To ensure a more accurate translation we will indeed need a dictionary. Probably something similar happens in English and Spanish. |
Spanish rules are similar, I tried to explain some of these with regard to the ordinals #212 On Mon, Apr 14, 2014 at 6:29 PM, Mahmoud Ali notifications@github.com
|
My concern with dictionaries is the impact they could have in terms of the "weight" of the library (I think it could be solved with resources) and performance (I should also be worried about the performance with so many regex the lib is evaluating right now). Another think with dictionary is maintenance, where will we easily get a list of singular and plurals? I don't know if it easy to get, at least for the Spanish language. |
BTW @thunsaker I have this link with rules for plurals (spanish) |
For Russian there is an extra grammatical number present. In the current implementation it is named In German it would be possible to go with the injection of the rules, as German as English also have only two grammatical numbers. |
@mexx, paucal is usually not a number, but a genitive case in Russian. |
I think we need to properly implement |
I'm thinking about interface |
Has any progress been made on this issue? |
I'd like to implement an Spanish implementation for the InflectorExtensions. I don't know if there is an ongoing work on this topic (the issue #132 is quite related to this)
I think we should have a culture specific provider responsible of filling the rules list and then simply (?) write regex rules for each language.
What do you think @MehdiK ?
The text was updated successfully, but these errors were encountered: