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

Correctly cache Contao translations that only exist as Symfony translations #6889

Merged
merged 3 commits into from Feb 14, 2024

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Feb 13, 2024

Fixes #6741

ausi
ausi previously approved these changes Feb 13, 2024
Copy link
Member

@ausi ausi left a comment

Choose a reason for hiding this comment

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

Do we also need to create an empty cache file so that we do not search for language files here?

// Try to load from cache
if (file_exists($strCacheDir . '/contao/languages/' . $strCreateLang . '/' . $strName . '.php'))
{
include $strCacheDir . '/contao/languages/' . $strCreateLang . '/' . $strName . '.php';
}
else
{

@fritzmg
Copy link
Contributor Author

fritzmg commented Feb 13, 2024

True. I think we can change the logic of the ContaoCacheWarmer a bit in general. We already retrieve the catalogue for a locale in the lines above and I think we can set the $processed state to true there instead.

@fritzmg fritzmg marked this pull request as draft February 13, 2024 15:35
@fritzmg fritzmg marked this pull request as ready for review February 13, 2024 16:06
@fritzmg fritzmg requested a review from ausi February 13, 2024 16:06
@fritzmg
Copy link
Contributor Author

fritzmg commented Feb 13, 2024

The addition of

if (!str_starts_with($domain, 'contao_')) {
    continue;
}

is actually another bugfix. There was no check previously and thus bogus Contao language cache files were created.

Copy link
Member

@aschempp aschempp left a comment

Choose a reason for hiding this comment

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

Manually tested this in my project, seems to do the job 👍

@leofeyer leofeyer changed the title Also add Symfony only Contao translations to cached available language files Correctly cache Contao translations that only exist as Symfony translations Feb 14, 2024
@leofeyer leofeyer merged commit e8f7d62 into contao:5.3 Feb 14, 2024
17 checks passed
@leofeyer
Copy link
Member

Thank you @fritzmg.

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

Successfully merging this pull request may close these issues.

Symfony translations are not loaded if no Contao language file exists
4 participants