Closed (fixed)
Project:
Automatic Entity Label
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2019 at 10:22 UTC
Updated:
5 Feb 2026 at 16:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
colanComment #3
mandclu commentedI was able to make some progress on this by editing AutoEntityLabelManager->generateLabel() on line 292, changing:
to:
That does allow the pattern to be translated, but saving in any language seems to save the title as generated in the current language (current language pattern and current language tokens) to all translations. So still needs some work to only save the title for the current language.
Comment #4
mandclu commentedTurns out, the secondary issue was that I had forgotten to configure the title to be translatable. Once I did that, it worked as expected. Here's a patch.
Comment #6
deaom commentedThe t() wants the first argument to be an actual string, not a variable, as it otherwise gives a notice of "Only string literals should be passed to t() where possible". It is working with the $this->t($pattern), so not sure about the notice/warning here.
Did play around with different possibles and finally decided with the committed one, so the @pattern is added as an argument which can then be translated via UI. If I follow the provided example, the source string would be
@patternand then translation string is the actual pattern translated:Este articulo esta [node:field_color:value]Did add an "explanation" to the description part for the pattern. This is like a small workaround, as I think the form or at least the pattern part should probably be made translatable via config translation.
Comment #8
minoroffense commentedI'm not sure this patch is required. If you just copy your auto_entitylabel.settings.*.yml file into config/sync/language/fr for example, update the pattern and import it translates the title properly. Mind you there's no UI to allow you to do this so that may be where the patching effort should go.
Comment #9
igork96 commentedI tested the solution from #6 and MR that is created and can confirm that is working. When you translate the pattern in User interface translation search for @pattern and you need to enter the token there in the translation "Este articulo esta [node:field_color:value]"
Comment #11
vladimirausComment #14
leducdubleuet commentedPardon me for asking here on a closed issue but I do not quite understand how this works...
Let's say I have 10 content types with different automatic entity label for the node title for each, how can I translate each one?
If I search for @pattern on /admin/config/regional/translate, I only have one entry there.
Can somebody help me understand the process for translating my 10 patterns please?
Thank you.
Comment #15
ivnishSame question
Comment #16
danharper commentedLooking for docs on this, It works if you allow title to be translated but that should not be necessary if you're using tokens where the content is already translated?