Install a new 4.3.4 adding 2 languages fr-FR and es-ES
Then Install multilingual data
Then, while you are in the en-GB admin , install blog sample data.
Swtch language to French and install blog sample data
Switch language to Spanish and install blog sample data : it fails when creating menu type.
The code in blog.php
$menu = [
'id' => 0,
'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_MENU_' . $i . '_TITLE') . $langSuffix,
'description' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_MENU_' . $i . '_DESCRIPTION'),
];
// Calculate menutype. The number of characters allowed is 24.
$type = HTMLHelper::_('string.truncate', $menu['title'], 23, true, false);
In English no problem because the title is short, but it breaks in French and Spanish as Spanish tries to save the same menu type as French, i.e. "menu-principal-blog" (without the lang suffix).
Ini string for French is
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_MENU_0_TITLE="Menu principal blog"
Ini string in Spanish is
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_MENU_0_TITLE="MenĂº principal - Blog"
Therefore we get:
0main-menu-blog-en-gb = 21 characters
0menu-principal-blog-fr-fr = 26 characters
0menu-principal-blog-es-es = 26 characters
The Title of the Menu Type is limited to 24 characters in sql, therefore the bug.
CREATE TABLE IF NOT EXISTS #__menu_types (
id int unsigned NOT NULL AUTO_INCREMENT,
asset_id int unsigned NOT NULL DEFAULT 0,
menutype varchar(24) NOT NULL,
title varchar(48) NOT NULL,
description varchar(255) NOT NULL DEFAULT '',
client_id int NOT NULL DEFAULT 0,
PRIMARY KEY (id),
UNIQUE KEY idx_menutype (menutype)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
and then for menu items
menutype varchar(24) NOT NULL COMMENT 'The type of menu this item belongs to. FK to #__menu_types.menutype',
`
No idea why the title is limited.
Possible solutions:
Labels |
Added:
No Code Attached Yet
|
The limitation to 24 characters is there since 2009. So that is nothing new.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-09-20 16:54:21 |
Closed_By | ⇒ | alikon |
How nice to see you, @infograf768 :)
I ask myself since ever why we have the menu title as a string and the user must enter it by himself.
It is nothing else that a identifier.
Removing the field and using the ID would be the best but could be a b/c break and is a larger action. Couldn't we insert the id automatically, for example 05-en-gb instead of 0-main-menu-blog-en-gb?