Openfoodnetwork: Calculator's options can't be translated (unrelevant automatic translations)

Created on 20 Dec 2017  路  16Comments  路  Source: openfoodfoundation/openfoodnetwork

Description

Hub managers don't all understand English, and are confused when they see English strings (here only in back office so doesn't affect customers)

Expected Behavior

All text is translated in local language

Actual Behavior

Amonf the calculator options:

  • 2 can be translated in transifex ("weight (per kg)" and "flat percent") > ok
  • 3 are badly automatically translated by Spree (ex: "flat rate (per order)", "flat rate (per item)", "flexible rate") so we need the strings to be able to translate them properly in transifex
  • 1 is not translated ("price sack")

Steps to Reproduce

  1. In menu "entreprise", choose one entreprise and clic on "entreprise fees"
  2. One one line clic on the calculator list options
  3. This is valid also in other places where calculators are used: shipping methods & payment methods.

Gif or screenshot

screenshot from 2017-12-20 14-57-23

Severity

3 (as very confusing for most users)

Your Environment

*Version used: 1.10.1
*Browser name and version: Chrome 53.0.2785.116 (64-bit)
*Operating System and version (desktop or mobile): Ubuntu 16.04 LTS

Possible Fix

bug-s3

All 16 comments

Define & Design

As @myriamboure said, the issue comes from the fact that not all translations are made in locales.

For flat_percent_per_item and weight, the translation path is specified directly in the model, so respectively in flat_percent_per_item.rb and weight.rb by the self.description method. So these two work fine.

I suggest adding a self.description in the existing Spree decorators for the calculators that are not being translated properly (flat_rate_decorator.rb, flexi_rate_decorator.rb, per_item_decorator.rb and price_sack_decorator.rb) specifying the path to locales for these calculators.

We can then add translations to locales.

@sauloperez @enricostano how does it sound to you?

Yes this one works just fine! I suggested doing the same for the four ones not translated properly ("flat rate (per order)", "flat rate (per item)", "flexible rate" and "price sack").

Can you check what happens in Spree 2.0 just to know we're heading to? This must have been fixed in a future commit.

Nothing special happens in Spree 2.0 about this issue. Translations for these calculators are still defined with Spree I18n in models. If we want to follow @myriamboure suggestions and have them translated in our locales, we could overwrite this behavior in our decorators.

OK for me then, just make sure that we also check if and how they solved this issue in latest Spree 3.x

spree_i18n v3.0 brings better translations for these calculators, at least in french. Should we consider upgrading ?

EDIT : Actually some keys in Spree I18n 3.0 vary from those in Spree 2.0, even after Spree upgrade we would have issues.

spree 3.x and spree_i18n 3.x solve this issue, the calculators are properly translated (even Price Sack that was apparently forgotten in previous versions).

Is this something that we should be able to fix when we'll work on upgrading to 3.x?

Maybe we can just add the fix consistently to what we have now and open issues to address it properly in the future.

Well it doesn't really seem to be a bug, spree_i18n v1.x just didn't properly translated some of the keys (like price_sack is set to "Price Sack" in fr.yml). From spree_i18n v2.2 it seems cleaner, so maybe we can fix it temporarily until we upgrade to higher versions. Is it what you meant ?

Yep, just create an issue to capture that before we forget

@myriamboure what translations would you suggest for these options ? Spree_i18n v3.x gives these :

  • "flat rate (per order)" = "Taux net par commande"
  • "flat rate (per item)" = "Pourcent par article"
  • "flexible rate" = "Taux flexible"
  • "Price sack" = "Prix du sac"

What do you think about it ?

Btw, since we are overwritting spree_i18n, we should update all the locales files to fit every new language. Should we concert to decide what is the best translation for each option ?

Actually I think you don't have to translate yourself as usually translations appear in Transifex and we translate them from there so every language manager can do it there. Ask other devs if that is not clear ;-)
Spree translations are really bad even in v3.x !

  • "flat rate (per order)" = "Montant fixe par commande"
  • "flat rate (per item)" = "Montant fixe par article (hors articles au poids/vol)"
  • "flexible rate" = "Montant variable selon nb articles"
  • "Price sack" = "Montant variable selon montant total commande"

@enricostano, @myriamboure said : "Spree translations are really bad even in v3.x !"
That being said, should we still open an issue to keep track of the overwriting ?

@HugsDaniel yes please

Was this page helpful?
0 / 5 - 0 ratings