-
Notifications
You must be signed in to change notification settings - Fork 638
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
Queue job descriptions not translated #9696
Comments
They will show whatever language was active at the time the job was added to the queue (unless no insttance-specific description was provided, so it just goes with the job’s default description). Unfortunately it’s not possible to change that, unless we start eager-translating the description into all possible languages up front and storing them all as part of the job’s data, which would take up quite a bit more storage. |
Thanks for the answer, Brandon. Is this something that changed since Craft 3.6.12? We’re running some custom jobs regularly and I’m pretty sure descriptions were translated just fine in the past. |
It’s been this way since 3.0.0. Perhaps the job in question has recently started gaining an instance-specific description though. Which job is it? |
It’s a custom job. I have now reverted to 3.6.12 to test this again, and for some reason both the description (set via After the test I’ve updated to 3.7.9 (no further code changes), and the job descriptions are now output in English again.
How’s the “active language” determined when the queue job is added via a console command? Maybe this is what has changed in Craft 3.7. Language of my primary site is set to German. |
I’ve also noticed that the progress label of the native “Resave elements” job isn’t translated in 3.7 any longer. The progress label shows “x of total“ instead of “x von total” how it was in Craft 3.6.
cms/src/queue/jobs/ResaveElements.php Lines 57 to 60 in befd5fc
|
Ahhh, that explains it. As of 3.7, console requests just stick to the app’s source language (English), per #7747. I changed that because most CLI messages aren’t translatable in the first place (since we don’t have a way of knowing the user’s preferred language from CLI commands).
Same explanation there, if you’re running the queue from a CLI command. I’m going to add a new |
It would be nice if you could make it happen so that the description and progress label are using the same language. Because currently the description shows in the CP user’s language even if the queue is run from console. |
Not sure how we’d do that though. The description is translated at job creation time, and the progress statuses are translated by the job during execution. Jobs could start being configured with the current language at the time it was queued up, and use that language when translating progress messages, but that only makes them consistent with the description language; both would still not necessarily be the right language for every control panel user. If we’re going to solve this correctly, it’s going to be by setting the description and progress messages to an array that includes the message category ( That wouldn’t be too difficult, but it would mess up the translation message scraper feature in the Yii2 Inspections PhpStorm plugin which we rely on, so we’d need to work that out. |
I only wanted to mention what my next complaint will be, before you’re working on a Personally I’m totally fine with job descriptions showing untranslated in English in the CP. I’ve probably only noticed it because I’ve recently added German translations for a couple of custom jobs and wondered why they weren‘t working any longer in 3.7. We have users with language set to English too, so in our case I’ll just remove my translations again and have everyone see descriptions in English. I wouldn’t use that You’ve got me behind you with that other suggestion though. 😄 |
Just resolved this for v4: #9745 |
Beautiful solution. Thanks Brandon! |
Description
Queue job descriptions in the CP sidebar show in the source language instead of being translated to the user’s language.
Steps to reproduce
Start a queue job from the console
Log into the control panel as a user with preferred language set to German
See how the description shows in English
Additional info
The text was updated successfully, but these errors were encountered: