Skip to content

Fix fallback mechanism for ICU translations #17057

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

Merged

Conversation

dolmit-tanel-paaro
Copy link
Contributor

@dolmit-tanel-paaro dolmit-tanel-paaro commented May 16, 2024

Changes in this pull request

Fixes the fallback mechanism for ICU translations.

Steps to reproduce

  1. Define fallback language for one of the locales, for example de fallbacks to en
  2. Create ICU translation; set value for the fallback language (en) and leave empty for the language having the fallback (de)
    • example CSV:
    "key";"de";"en"
    "someKey";"";"{count, plural, one {One} other {Other} }"
    
  3. Execute this Twig code
<div>{{ 'someKey'|trans({count: 1}, null, 'en') }}</div> // output: "One"
<div>{{ 'someKey'|trans({count: 1}, null, 'de') }}</div> // output: "{1, plural, one {One} other {Other} }"

The fallback mechanism works but partially.
The displayed string is unformatted - that's why we have to use Symfony's translator to return correctly formatted string.

Steps to reproduce

I discovered this issue on Pimcore v10.6.9.
Tested this issue on the latest Pimcore Demo docker image.

Copy link

github-actions bot commented May 16, 2024

Review Checklist

  • Target branch (11.2 for bug fixes, others 11.x)
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@ghost ghost added the Pimcore:ToDo label May 16, 2024
@herbertroth herbertroth changed the base branch from 11.2 to 11.3 July 2, 2024 12:23
@kingjia90 kingjia90 changed the base branch from 11.3 to 11.4 October 1, 2024 08:56
@martineiber martineiber added this to the 11.4.1 milestone Oct 4, 2024
@martineiber martineiber added the Bug label Oct 4, 2024
Copy link
Contributor

@martineiber martineiber left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Thank you for your contribution.

@martineiber martineiber merged commit 84d9f9f into pimcore:11.4 Oct 4, 2024
17 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2024
@dolmit-tanel-paaro dolmit-tanel-paaro deleted the fix-icu-translations-fallback branch October 4, 2024 07:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants