Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Support 18n for Braintree error messages #133

Merged
merged 7 commits into from
Dec 4, 2017
Merged

Support 18n for Braintree error messages #133

merged 7 commits into from
Dec 4, 2017

Conversation

vassalloandrea
Copy link
Contributor

With this PR I want to add the localization for Braintree error messages.
For this purpose I add the Braintree error messages in the localization rails file and show it with the corresponding slug returned from the Braintree response.
I also added Italian translation of the messages.

@tvdeyen tvdeyen self-assigned this Nov 10, 2017
@vassalloandrea
Copy link
Contributor Author

It seems the test fails for a timeout error or something else unrelated.

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks! Much better than the current implementation. 👍

@tvdeyen tvdeyen removed their assignment Nov 22, 2017
@@ -6,14 +6,11 @@ SolidusPaypalBraintree = {
clientTokens: Spree.pathFor('solidus_paypal_braintree/client_token'),
transactions: Spree.pathFor('solidus_paypal_braintree/transactions')
},

Copy link
Member

Choose a reason for hiding this comment

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

unnecessary whitespace sneaked into here :)

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

We need to change the js.erb into a html.erb file and render this in the payment form. Otherwise translation changes won't be picked up by next asset compilation.

@@ -0,0 +1,17 @@
BraintreeError = {
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, just saw that this is a js.erb file instead of an html partial. Although not very obviously, but js.erb files are very problematic, because changes to the translations won't trigger this file to be re-compiled on next asset compilation. Please make this is html.erb file that gets rendered inside the payment form.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback.
I changed this behavior and now it should work fine.

By using an html.erb partial we make sure that if you change the locale
files you don’t need a new asset precompile to actually pick up
the changes
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thank you. This is great

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

@Gamabunta94 this seems great, thanks!

@kennyadsl
Copy link
Member

@tvdeyen can we merge this one? I think it's ok but I don't have permissions to merge here.

@tvdeyen tvdeyen merged commit e204e40 into solidusio:master Dec 4, 2017
@tvdeyen
Copy link
Member

tvdeyen commented Dec 4, 2017

@kennyadsl merged

@kennyadsl
Copy link
Member

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants