For fields, translation is specified in /app/lang/{lang}.json
How can I set a translation for a content group?
In the app/lang/{lang}.json file:
{
"Updated news": "Lang lang"
}
I tried that - it doesn’t work.
This would work if in the getEntryTypeOptions method of the EntryBlueprint class (modules/tailor/classes/blueprint/EntryBlueprint.php)
the translation function was specified, now it looks like this:
public function getEntryTypeOptions(): array
{
if (!is_array($this->groups)) {
return [];
}
$options = [];
foreach ($this->groups as $handle => $entry) {
$options[$handle] = $entry['name'] ?? $handle;
}
return $options;
}
and a working solution would be like this:
public function getEntryTypeOptions(): array
{
if (!is_array($this->groups)) {
return [];
}
$options = [];
foreach ($this->groups as $handle => $entry) {
$options[$handle] = trans($entry['name'] ?? $handle);
}
return $options;
}
A year ago I opened: — the issue still persists on current 4.x: the “Entry Type” dropdown shows raw groups.*.name
values when they are translation keys, while other blueprint strings translate fine. Confirmed reproducible. Any status or plans to fix?
Looks like an easy fix. For v4: Just pop it up on GitHub as a Pull Request. Do you know how to do this?
Opened a v4 PR: translates content group names in the “Entry Type” dropdown. Tailor: translate content group names in Entry Type dropdown by burzuy · Pull Request #5955 · octobercms/october · GitHub
Great! Thanks. Most PRs are merged within a week.
Best regards