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

Messages in ICU format not dumped #312

Open
sweedheart opened this issue Jan 3, 2021 · 7 comments
Open

Messages in ICU format not dumped #312

sweedheart opened this issue Jan 3, 2021 · 7 comments

Comments

@sweedheart
Copy link

I have a "messages+intl-icu.en.yaml" file in default translation folder.
When running the dump command, the messages domain is not dumped at all. When I remove the "+intl-icu" extension from the file-name, the domain ist dumped, but is obviously not working due to the ICU format used inside the file.

Probably caused by a continue in TranslationDumper:
// e.g.: skip "messages+intl-icu" if "messages" exists. They will get merged after.

As there is nothing done afterwards, the skipped domains won´t get dumped. Seems like dumping ICU translations are only working when there are already other translations in the same non-ICU domain.

validators domain ist dumped correctly when using ICU format, as there are already translations in some bundle for that domain.

@aheidelberg
Copy link

I fixed this by adding another empty messages.yaml file without the +intl-icu suffix. Maybe this works for you as well.

@Schyzophrenic
Copy link

I am running into the same issue, is there any way to solve this?

@tpatartmajeur
Copy link

Hi, any update regarding this issue?

@pacproduct
Copy link

pacproduct commented Nov 22, 2021

Upgrading from v3 to v4 broke this as well, on our project.

It seems like the following commit introduced the breaking change: 43a51cf (Especially changes in file Dumper/TranslationDumper.php)

Because it's now the "cleaned" domain that is looked up in "$activeDomains", my configuration entry "mass_updates+intl-icu" (in bazinga_js_translation.yaml::bazinga_js_translation.active_domains) doesn't get picked up anymore.

So I thought maybe the right approach now is to add the "cleaned up" entry in the bazinga_js_translation.yaml configuration file: "mass_updates" only. But if doing so makes the domain to be picked up by TranslationDumper::getTranslations, it still gets removed in the following section by TranslationDumper::dumpTranslationsPerDomain:

                if ($domain !== $cleanedDomain && !in_array($cleanedDomain, $domains, true)) {
                    // e.g.: skip "messages+intl-icu" if "messages" exists. They will get merged after.
                    continue;
                }

Considering what the comment says: "skip "messages+intl-icu" if "messages" exists", I'm wondering if the if test shouldn't be as follows instead (removed !): [deleted code]

EDIT: Turns out $domains does NOT contain domains, but translations as values, and domains as keys. So the test to be done is probably more something like:

if ($domain !== $cleanedDomain && !isset($domains[$cleanedDomain])) {

But I do not really understand why "uncleaned" domains get ignored in the first place, to be honest. So there's more to it.

@pacproduct
Copy link

I fixed this by adding another empty messages.yaml file without the +intl-icu suffix. Maybe this works for you as well.

It does work but in my case I had to:

  • Add an empty file without the suffix next to the suffixed file.
  • Add this new file in bazinga_js_translation.yaml::bazinga_js_translation.active_domains
  • Adapt my Javascript so it loads translations from the file without suffix, as it now gets generated without it.

@NicolasJourdan
Copy link

Any up about this issue ? @stof @monteiro

@PrezentInternet
Copy link

It appears this is still a problem in 6.0

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

No branches or pull requests

7 participants