openfoodnetwork icon indicating copy to clipboard operation
openfoodnetwork copied to clipboard

Missing translation in product variant selection upon order creation

Open haseleyi opened this issue 7 years ago • 7 comments

Description

"Please enter 3 or more characters" alert is not translated: missing_translation

Steps to Reproduce

  1. From the back office, create a new order
  2. When adding a product, hit the "Select a variant" dropdown

Severity

S4

Your Environment

  • Version used: v1.22.0

haseleyi avatar Nov 14 '18 01:11 haseleyi

I think we said internatinalisation issues like translation issue would go directly to dev ready, should be solved quickly as quick things and annoying for local users in other instances. So I put it to dev ready :-)

myriamboure avatar Nov 27 '18 00:11 myriamboure

I looked into this one and had some fun pinning it down:

  • I searched the project for "please enter 3 or more characters" and didn't find it
  • I searched our version of spree and didn't find it
  • I searched foundation and didn't find it
  • I googled the phrase and got this: https://github.com/translate/pootle/issues/6461. So the text comes from the gem select2-rails.
  • I searched for select2 in our repo, found its declaration in its gem (.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/select2-rails-3.5.10/vendor/assets/javascripts/select2.js), searched there for the target text, and found it:

image

So that's the text that isn't translating. The gem includes a translation file for French in the same directory, so either select2 isn't receiving our locale properly, or this version of the gem has a bug. I looked through the source history in their repo and determined that they've overhauled their translation system since this version. I wasn't able to simply update the gem, so I investigated and found the following dependencies:

image

I welcome any suggestions at this point!

haseleyi avatar Dec 12 '18 02:12 haseleyi

Where's that file you shared in the screenshot @haseleyi ? I can't find it. I think there's not much more we can do other than providing the translations ourselves like that screenshot.

sauloperez avatar Dec 12 '18 12:12 sauloperez

It's in the select2-rails gem. Mine is here: .rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/select2-rails-3.5.10/vendor/assets/javascripts/select2.js I found this by finding an instance of "select2" in our code (in variant_autocomplete.js.coffee). Visiting its declaration took me to select2.js. Is it possible to translate a string coming from outside OFN and outside Spree?

haseleyi avatar Dec 12 '18 19:12 haseleyi

interesting, the select2 dependency comes with locale files with the translations, for example, select2_locale_fr.js we probably need to activate that in some way. and maybe also add the select2 locale files to our js assets...

luisramos0 avatar May 30 '19 18:05 luisramos0

I'm interesting in resolving this issue! Could someone please assign me?

brittneyhoneycutt avatar Mar 22 '22 16:03 brittneyhoneycutt

Of course! Here you go, @brittneyhoneycutt! Looking forward to your contributions! :partying_face:

drummer83 avatar Mar 22 '22 22:03 drummer83

I can take this up, can someone assign me this issue?

anoosh96 avatar Mar 21 '23 09:03 anoosh96

Thank you @anoosh96 🎉 Welcome!

sigmundpetersen avatar Mar 21 '23 09:03 sigmundpetersen

Hello @anoosh96 I hope this message finds you well. Are you still working on this issue? I'm just checking in, no pressure ;)

RachL avatar Apr 26 '23 14:04 RachL

Dear @anoosh96 I've unassigned you from this issue, feel free to ask us if you want to work on it!

jibees avatar May 29 '23 13:05 jibees