Git Product home page Git Product logo

Comments (7)

spohlenz avatar spohlenz commented on May 20, 2024

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.

Leohige avatar Leohige commented on May 20, 2024

If you have any ideas, I could help you implement this :)

from trestle.

spohlenz avatar spohlenz commented on May 20, 2024

This has now been fixed in master (2ffe019). It'd be great if you could test it out.

from trestle.

Leohige avatar Leohige commented on May 20, 2024

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.

spohlenz avatar spohlenz commented on May 20, 2024

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.

Leohige avatar Leohige commented on May 20, 2024

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.

spohlenz avatar spohlenz commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.