Skip to content

Use translated product descriptions in the backend#855

Merged
lslezak merged 1 commit intomasterfrom
product_translations
Nov 9, 2023
Merged

Use translated product descriptions in the backend#855
lslezak merged 1 commit intomasterfrom
product_translations

Conversation

@lslezak
Copy link
Contributor

@lslezak lslezak commented Nov 9, 2023

Problem

Solution

  • Find the translation matching the current locale
  • When the translation is not available it returns the original (untranslated) description

Notes

  • For some reason when changing the language in the web UI it is not propagated to the Software service. But propagating to the Storage and Manager services works fine. 🤔
  • This need some more debugging 🐞

Testing

  • Added a new unit test
  • Tested manually (with a manually patched Software service switched explicitly to the Czech language, see the note above)

def available_base_products
backend.products.map do |id, data|
[id, data["name"], { "description" => data["description"] }].freeze
[id, data["name"], { "description" => localized_description(data) }].freeze
Copy link
Contributor

Choose a reason for hiding this comment

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

my wild guess here is that it won't raise signal when localization changes. So if UI cache list of base products, it will use it with old locale.

@coveralls
Copy link

Coverage Status

coverage: 75.08% (+0.04%) from 75.039%
when pulling 62ed31c on product_translations
into 0f420c3 on master.

@lslezak lslezak merged commit ef91b81 into master Nov 9, 2023
@lslezak lslezak deleted the product_translations branch November 9, 2023 12:14
@imobachgs imobachgs mentioned this pull request Dec 2, 2023
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.

3 participants

Comments