Compound name in template does not generate plural in table name

Asked

Viewed 203 times

1

I would like to ask a question further to this post: How to program in Portuguese in Ruby on Rails?

I started studying Rails has little time and I’m going through a problem with pluralization. When I create the Product model, it generates a Migration with the create table product product product product product product product product product category. Should I see product categories not? If so, how do I correct this? The only change I made was in infletions.Rb:

ActiveSupport::Inflector.inflections do |inflect|
  inflect.irregular 'produtocategoria', 'produtocategorias'  
end

But it didn’t solve the problem. You can help me?

  • In my experience, I’m going to recommend: don’t program with Rails in English, you’ll basically be fighting against the framework just to make it work properly, you will spend a lot of time fixing framework issues to be Portuguese-compatible and lose all the agility you would gain with Rails. I am speaking from experience, I have tried and it is simple to suffer things worked (mainly because Portuguese is a much more complicated language to pluralize words than English).

  • And you don’t need to be fluent in English to write code in English, with common sense and using google right you can write code in English with a few gaffes, common sense dictates everything. I myself write code in English in Rails and am not fluent.

  • I got it, Gabriel. I’m really wasting my time trying to figure this stuff out. But I thought it was easy to solve, I didn’t know how yet. But by the way develop is the ideal even. You’re the second person I see to say this here on the forum. I’ll try to adapt my code to English. Do the columns of the tables of the bank also need to be named in English? I don’t know if there is any pluralization involved in this case.

  • As I recall, i18n may have a problem with the fields, I’m not sure. But as I said, do it in English, do "EVERYTHING" in English if possible, and it’s ideal to open your API to the outside world, you won’t suffer any more problems like this question. Today in the system I work there is only one model that is written in Portuguese, called "Nfe", but that Rails pluralized for "Nfes", so we had no problems, but it was the only case we evaluated and worth leaving the term in Portuguese and not in English.

  • But this is a very specific case, because the system already has other models that correspond with "Invoice" in English, so you can not translate this term "Nfe (Invoice)" to something like "Invoice", "Receipt", "Taxinvoice", "Taxreceipt"... only that I repeat, this is a very specific case, in all other systems in Rails that I moved/looked, there was no need for a term in English.

  • What about the error messages. Those standard Rails messages with red letters and such. Nor does that usually translate?

  • Only the encoding is in English, but the return to the client should have Portuguese support, but in this case you can use i18n to translate the problems that occur in the API.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.