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

Fix i18n translation for Store link in admin header for fr #2649

Conversation

kristinalim
Copy link
Member

Use more specific translation key for the "Store" link in the admin header

What? Why?

Closes #2632

We use the spree_i18n for base Spree translations.

Its language translations for the "store" key is sometimes like "shop" and sometimes like "save". It's possible there is a clash in usage between Spree add-ons, so websites have been using it in different ways.

To make this more specific and to allow custom translation, I changed the "Store" link in the admin section to use the new translation key "admin.header.store".

What should we test?

Go to admin section and check the "Store" (en) link in header.

This should be properly translated in non-English instances, especially for France for which the correct translation will not match the one used before this PR.

Release notes

  • Fix translation for "Store" link in admin header for some languages

Changelog Category: Fixed

@kristinalim kristinalim added the bug-s4 The bug is annoying, but doesn't prevent from using the platform. Not so many users are impacted. label Sep 6, 2018
@kristinalim kristinalim self-assigned this Sep 6, 2018
@@ -11,4 +11,4 @@
= link_to t(:logout), spree.logout_path
%li{"data-hook" => "store-frontend-link"}
%i.icon-external-link
= link_to t(:store), spree.root_path, :target => '_blank'
= link_to t("admin.header.store"), spree.root_path, target: "_blank"
Copy link
Contributor

Choose a reason for hiding this comment

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

could you check if Rails' lazy lookup would work with t('.header.store') here? Using lazy lookup is one of the conventions we have for i18n. See https://github.com/openfoodfoundation/openfoodnetwork/wiki/Internationalisation-%28i18n%29#development

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, @sauloperez. I updated this, and it's now spree.layouts.admin.header.store (but referencing through .header.store). Right now, I'm questioning whether we should still have spree there, but I find it acceptable.

@kristinalim kristinalim force-pushed the translations-fix_store_link_in_admin_header branch from 9124403 to 0d94b5e Compare September 6, 2018 10:45
spree_i18n translates the "store" key in different ways, sometimes like
"shop" and sometimes like "save". This could be because of a clash in
usage between Spree add-ons.

To be more specific, the "Store" link in the admin section now uses the
"admin.header.store" translation key.
@kristinalim kristinalim force-pushed the translations-fix_store_link_in_admin_header branch from 0d94b5e to d06bccb Compare September 6, 2018 14:04
@sstead
Copy link

sstead commented Sep 14, 2018

Testing Notes

  • The links worked for all 3 languages. They all read as 'store' still, but now they should be translatable.

https://docs.google.com/document/d/1-oOc-NcwLtGnlGrrAfAy3vmQ6QvNAb-tP3KevnHEVCE/edit#

@mkllnk mkllnk merged commit da2f278 into openfoodfoundation:master Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s4 The bug is annoying, but doesn't prevent from using the platform. Not so many users are impacted.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants