Skip to content
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

Use attribute translations for customer return forms #764

Conversation

Murph33
Copy link
Contributor

@Murph33 Murph33 commented Jan 29, 2016

This is to better utilize I18n with more verbosity to make it clear and easier to translate. By using attributes from the model it will be much more clear what is happening instead of taking the translation from "some place" in the dictionary.

This is cherry picked from #549 and is part of an ongoing chain of PRs as discussed in #735 to improve the I18n implementation.

The only changes from the commit is not erasing things in the dictionary and adding item_received? to the ReturnItem section.

@cbrunsdon
Copy link
Contributor

👍

@@ -33,7 +33,7 @@
</fieldset>

<%= f.field_container :stock_location do %>
<%= f.label :stock_location, Spree.t(:stock_location) %>
<%= f.label :stock_location_id %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should use Spree::StockLocation.model_name.human here. This avoids duplicated translations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly state a different model's attribute to avoid adding a translation for the attribute to the model? This just seems kind of what the opposite of what I thought we were going for.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its the name of the other model. Its referencing what StockLocation it belongs_to, so referencing what a StockLocation is by the way of that table is perfectly reasonable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though an added benefit besides eliminating the code would be this stops the select2 label bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, sounds good to me I'll make the change. Just wanted a little clarification.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be more clear about this:

<%= f.label :stock_location, Spree::StockLocation.model_name.human %>

If this also fixes the select2 label problem, great

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just made it <%= f.label Spree::StockLocation.model_name.human %> and it's working fine. Everyone happy with that? Or go for the more verbose option?

@Murph33 Murph33 force-pushed the use_attribute_translations_customer_return_forms branch from 65c5580 to fa5d342 Compare January 29, 2016 22:56
total: Total
created_at: "Date/Time"
reimbursement_status: Reimbursement status
stock_location_id: Stock Location
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed anymore. See comments above

@tvdeyen
Copy link
Member

tvdeyen commented Jan 29, 2016

@Murph33 sorry about the confusion.

@Murph33 Murph33 force-pushed the use_attribute_translations_customer_return_forms branch from fa5d342 to c6feb74 Compare January 29, 2016 23:08
@tvdeyen
Copy link
Member

tvdeyen commented Jan 29, 2016

@Murph33 #764 (comment)

@Murph33 Murph33 force-pushed the use_attribute_translations_customer_return_forms branch 4 times, most recently from cb0cfa6 to a4025f3 Compare February 12, 2016 21:50
Change-Id: I2b41ae32237622edef509809457efaea0f9b7529
@Murph33 Murph33 force-pushed the use_attribute_translations_customer_return_forms branch from a4025f3 to 38de18e Compare February 16, 2016 18:17
Required to pass tests as there was a missing translation before.
@Murph33 Murph33 force-pushed the use_attribute_translations_customer_return_forms branch from 38de18e to 8d5d825 Compare February 16, 2016 19:16
@jhawthorn jhawthorn added i18n and removed i18n labels Feb 17, 2016
@cbrunsdon
Copy link
Contributor

I'm 👍 on this, and my understanding is the feedback here is resolved as well.

@jhawthorn
Copy link
Contributor

👍

jhawthorn added a commit that referenced this pull request Feb 18, 2016
…mer_return_forms

Use attribute translations for customer return forms
@jhawthorn jhawthorn merged commit 7d63bb6 into solidusio:master Feb 18, 2016
@Murph33 Murph33 deleted the use_attribute_translations_customer_return_forms branch February 18, 2016 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants