Comments (7)
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.
from trestle.
If you have any ideas, I could help you implement this :)
from trestle.
This has now been fixed in master (2ffe019). It'd be great if you could test it out.
from trestle.
It's working fine, but if some model does not have an 'other' key in translations, an error like this will occur:
translation data {:one=>"Perfil"} can not be used with :count => many. key 'other' is missing.
from trestle.
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?
from trestle.
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.
from trestle.
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.
from trestle.
Related Issues (20)
- adding maps HOT 3
- Saving seems to not provide a notice of saving but saves anyways HOT 1
- select empty if no relation? HOT 2
- How to add icons in sidebar buttons? HOT 4
- How to fix "to_param called on non-resourceful admin. You may need to explicitly specify the admin." HOT 1
- Listing dates per page HOT 1
- uninitialized constant custom field rails 7 HOT 3
- Changing date format HOT 3
- Option to disable form as "show" view? HOT 1
- My custom helper not is recognized HOT 2
- How i use concerns at trestle? HOT 1
- Remove Multiple Records From MODEL Page
- WebSockets / action_cable support? HOT 2
- Pagination for a custom index View
- Fix typo for Vietnamese locale HOT 1
- Direct upload or chunked file upload support? HOT 2
- Fails without sassc-rails
- Unable to locate favicon.ico in public folder HOT 1
- Best Way To Provide a Select Dropdown for belongs_to that is optional HOT 2
- Filter with a select list
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trestle.