-
Notifications
You must be signed in to change notification settings - Fork 172
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
Translate and pluralize by default locale #41
Comments
I noticed this issue in your PR yesterday, so have begun doing a minor overhaul on how model names are used throughout the codebase. Should hopefully have something very soon. |
If you have any ideas, I could help you implement this :) |
This has now been fixed in master (2ffe019). It'd be great if you could test it out. |
It's working fine, but if some model does not have an 'other' key in translations, an error like this will occur:
|
As I dive deeper into the i18n aspects of this, I'm finding it more and more difficulty to ascertain what the 'correct' way of pluralizing model names that works when a) there is no entry in the locale file, b) there is a single string entry in the locale file, c) there is a multiple-form entry in the locale file, and d) there is a multiple-form entry in the locale file with some entries missing. I'd be curious to know why you don't have an 'other' key in this case -- is this because the plural form is the same as the singular, or are you expecting the plural form to be inferred from the Rails inflector rules for your locale? |
I removed the 'other' key just as a way to simulate a specific situation, such as using the Rails inflector rules or not having the model translation. I think default pluralization should be done if the 'other' key does not exist. You may also be able to check if there are any Inflector Rails rules for the default location (I don't know how to do it), and if not, default pluralization in English will be used. |
Further improvements have now been made in 370d01f. It will pluralize the singular form if only the singular is specified in the i18n file, and rescue and fallback as appropriate when other forms are missing. I think that using English inflections if they are not provided for the current locale is possibly getting a little too smart (I like magic but I think this crosses a line that might cause too much confusion). In that case, either the singular and plural forms should be provided in the i18n file, or the inflections for that locale should be specified. |
I think it would be a good idea to use the translation of the models (if available) by default, for the menu and titles of each resource. Because pluralization only works well with English words.
Example, the plural of the word "Perfil" should be "Profis", but it will look like "Perfils". If this is implemented, the translations and pluralizations would be done by default, getting the translations correctly.
The text was updated successfully, but these errors were encountered: