Skip to content

[Translation] Metadata is being lost when +intl-icu is used #60523

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

Open
pontus-mp opened this issue May 23, 2025 · 0 comments
Open

[Translation] Metadata is being lost when +intl-icu is used #60523

pontus-mp opened this issue May 23, 2025 · 0 comments

Comments

@pontus-mp
Copy link

Symfony version(s) affected

7.2.6

Description

If you fetch messages using MessageCatalogue::all() from a MessageCatalogue, it automatically merges domain and domain+intl-icu messages. However, MessageCatalogue::getMetadata does NOT do this, causing messages to exist but metadata missing.

This gets more serious as ->getDomains() returns the plain domains (without +intl-icu), causing metadata being dropped in most things that loops over messages (such as \Symfony\Component\Translation\Bridge\Crowdin\CrowdinProvider)

How to reproduce

<?php
require_once './vendor/autoload.php';

$catalog = new \Symfony\Component\Translation\MessageCatalogue("en");
$catalog->add(["key" => "The text"], domain: "messages+intl-icu");

$catalog->setMetadata("key", ['notes' => [['content' => "This will disappear"]]], domain: "messages+intl-icu");

foreach ($catalog->getDomains() as $domain) {
    foreach ($catalog->all($domain) as $key => $value) {
        // Shouldn't be null here!
        if($catalog->getMetadata($key, $domain) == null) {
            echo "Woe and despair, my metadata is hiding from me!\n";
        }
    }
}

Possible Solution

No response

Additional Context

No response

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

Successfully merging a pull request may close this issue.

2 participants