?
avatar sanek4life
sanek4life
21 Aug 2020

Is your feature request related to a problem? Please describe.

I recently read an article on how to correctly translate the menu for @jomsocial, and I was shocked that this is possible in @joomla.

I just inserted a language constant in the Title field for the name of the menu item and now I see on my site (frontend) that, depending on the language of the site, the name of this menu item changes. This is fantastic!

I tried the same thing with regular menu items in Joomla, and instead of automatically displaying the Title (example: Profile), I saw a language constant (example: COM_COMMUNITY_TOOLBAR_PROFILE) on my site (frontend).

Describe the solution you'd like

I propose to allow the use of language constants for the titles of any menu items on the site, for the titles of any modules on the site. This is very handy, but currently it works on my site only for the JomSocial component.

изображение

Additional context

First of all, it will help to translate such standard menu items as Login, User Menu and the like. I think this would be a very nice feature in the CMS to help translate menu items faster for multilingual sites.

avatar sanek4life sanek4life - open - 21 Aug 2020
avatar joomla-cms-bot joomla-cms-bot - change - 21 Aug 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Aug 2020
avatar infograf768
infograf768 - comment - 22 Aug 2020

It is easy to implement, but that means that for every title and every language one would have to create its own lang string override.

avatar sanek4life
sanek4life - comment - 22 Aug 2020

It is easy to implement, but that means that for every title and every language one would have to create its own lang string override.

изображение

This is now working for the Breadcrumbs module. If you do not write the Text for Home Entry of the Home page there, then the default name from language file mod_breadcrumbs.ini will be displayed.

I would like to be able to do this with the Title of any menu item. I mean that such standard pages as Login, User Profile, and the like, could be translated through language constants (without re-creating these pages for each version of the site language). It would be very convenient. Now this only works for the JomSocial menu and for the Breadcrumbs module.

avatar sanek4life
sanek4life - comment - 22 Aug 2020

I think that such an option will make it easy to translate the standard menu items for many components, such as the @Kunena forum for example. @810 Kunena/Kunena-Forum#6889

Now I cannot translate the standard menu items for the Kunena forum using language constants, and in order for users to see the standard menu items in another language, I will have to re-create each item with a translation in another language, I think this is not the right way. Menu items such as Login, User Profile (and the like) are not content pages (like Articles), these Items can be translated using language constants, but currently this are not working in @joomla.

avatar infograf768
infograf768 - comment - 23 Aug 2020

I am not sure you are conscious about what your demand implies.

Menu titles and aliases (or modules titles) are entirely different from what we get for breadcrumbs where it is not the module name at stake but a specific parameter used in the module helper.
$item->name = htmlspecialchars($params->get('homeText', Text::_('MOD_BREADCRUMBS_HOME')), ENT_COMPAT, 'UTF-8');

Creating a default title per language would be extremely complex.

As I said it is easy to use constants in a site menu item title:
Example here:
https://github.com/joomla/joomla-cms/blob/staging/modules/mod_menu/tmpl/default_component.php#L29
You just have to change that line to $linktype = Text::_($item->title); (and add use Joomla\CMS\Language\Text;)
You can do it with an override...

Evidently, when creating a menu item with a constant as title, the automatic alias would be weird (for SEO) and have to be manually modified and would be the same whatever the language.

Screen Shot 2020-08-23 at 09 33 23

Anyway it would be useless on a Multilingual site except for items tagged to all languages.

And, as I said above, you would have to create new strings for each menu item for each language.

For modules title, it's different and a bit easier.
Just modify your chromes in your template with a Text::_
`$header = '<' . $headerTag . ' ' . ArrayHelper::toString($headerAttribs) . '>' . Text::_($module->title) . '</' . $headerTag . '>';

Then something like this could be done, #30231
That only IF the string already exists and is recognized as such...

Same issue for strings. Same remark for Multilingual sites.

Hope this helps.

avatar sanek4life
sanek4life - comment - 23 Aug 2020

@infograf768 now it looks like this (without changing files)

изображение

but in the menu of the JomSocial component everything works fine (and the menu title and title in the breadcrumbs module are displayed correctly):

изображение

I believe that it should be in the core of the CMS, the ability to make menu titles in the format of language constants. This would be very helpful for technical pages such as Login, Profile and the like, which are often found in third-party extensions, such as a forum, gallery, online store, etc.

For this to work now, some files need to be edited, but this should work without editing CMS files.

avatar infograf768
infograf768 - comment - 23 Aug 2020

Read above. Thanks.

avatar rdeutz rdeutz - change - 23 Aug 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-08-23 11:39:18
Closed_By rdeutz
avatar rdeutz rdeutz - close - 23 Aug 2020
avatar rdeutz
rdeutz - comment - 23 Aug 2020

This doesn't makes sense, on a multi lang site menus are language specific. You will also get strange results when you install a new language and this language hasn't translations for the menu items.

avatar sanek4life
sanek4life - comment - 23 Aug 2020

This doesn't makes sense, on a multi lang site menus are language specific. You will also get strange results when you install a new language and this language hasn't translations for the menu items.

It makes sense so as not to create 2 menu items each for technical pages (not articles), and there are a lot of such pages on the site, especially if you use third-party extensions.

Tell me, what's the point of creating 2 times a page for registering users on the site (if the site has 2 languages)? The only thing that is translated in this case is the Title of the menu item, and all other fields are translated automatically through the language file.

I just want to be able to insert a language constant for this instead of re-creating the menu item to register users on the site. This is how pages are translated on social networks - social networks automatically translate the registration page Titles.

This principle works in the @joomla Control Panel. When the control panel has 2 languages, menu items are not automatically created for each language. Why can't you do the same for the front end?

avatar rdeutz
rdeutz - comment - 23 Aug 2020

We explained why this doesn't makes sense, there is no value and repeating the same over and over again

avatar sanek4life
sanek4life - comment - 23 Aug 2020

@rdeutz Ok, let's go back then to look at the Breadcrumbs module.

In field Text for Home Entry, I can specify a Title for the Home page of the site and then this name will always be displayed on the site, for any version of the site, even if I create 2 menu items for 2 languages ​​on the site, the value that will always be displayed there that i will write in this field.

But if I do not write anything there, if I leave this field Text for Home Entry blank, then I will see that the Title of the Home page of the site will be taken from the language file. The Title for the Home page in this case will never be displayed from the name of the menu item for the Home page, the title will always be displayed from the language file.

изображение

So why can't I do the same for the Login Form page on the site? All fields and all data for this page are shown from the language file, except for the Title field. Why not do the same for the Login Form page?

изображение
изображение

I see that this works already in @joomla, but only for the Home page (Breadcrumbs module). Why not extend this feature to other pages as well? If, for example, there is no translation, then you can show the Title from the default en-gb language file.

I understand that for pages with content (Articles, Topics etc.) it is necessary to make different language pages. But why do this for a page with Registration, User Preferences and similar pages? In these technical pages, all the translation is already taken from the language file, so why should I create another menu item just to translate the Title?

I used the JomSocial menu and realized that i don't have to create each menu item 2 times to see the translation of the Title. It is very convenient. It's user friendly. I think this is the right way.

avatar rdeutz
rdeutz - comment - 23 Aug 2020

We explained why this doesn't makes sense, there is no value and repeating the same over and over again

Add a Comment

Login with GitHub to post a comment