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 fallback mechanism for ICU translations #17057

Open
wants to merge 1 commit into
base: 11.2
Choose a base branch
from

Conversation

dolmit-tanel-paaro
Copy link

@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

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

sonarcloud bot commented May 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants