Name of component in admin page isn't equal to translated menu name

Rafael [] Posted in General Discussion 2 years ago

Sorry if this is a foolish question, but this was intriguing to me until finding the file. Looking into Restrict Usernames component, I realized the name of the component is in XML file is used in the administration page and, with use of a language file, the name in menu isn't equal to the component name. Is some function to solve this or this can be a new issue to be solved in next version of OSSN?

Breton Rafael [] Replied 2 years ago

Sorry on late reply. And thanks for this information :-)

I forgot to reply some old posts. Working on that.

German Michael Zülsdorff Replied 2 years ago

Okay, let me try to explain how to get things in line ... having a look at the Textarea Support component...

enter image description here

enter image description here

Both titles are derived from the XML->name entry

Registering the component's configuration page needs to address the component's id instead like

ossn_register_com_panel('TextareaSupport', 'settings');

So this will result in a menu entry like

enter image description here

The 'text' part gets translated in topbar_admin.php

enter image description here

and turned to lowercase by ossn_print (looking for a corresponding key in a language file)
And as long there is no translation available, the key will appear in the configure menu

enter image description here

So the trick is to simply add a translatation which is equal to the name field of the XML

ossn_register_languages('en', array(
    'textareasupport' => 'Textarea Support', // don't translate this line

And you'll finally get what you wanted ...

enter image description here

Breton Rafael [] Replied 2 years ago


As a developer, I think like you. It's not an issue for me or 75% of admins and developers here (maybe even more).

I opened this topic because sometimes, the site owner pays for a developer to install and configure OSSN, and then the owner manages the page. If this owner needs to change anything on site, such as an Ad, the will find in brazillian version of the menu the option "Gerenciador de anúncios" and when he opened it, the title shows "OSSNADS". And this makes non-sense to me.

Maybe putting an ossn_print([xml name tag]) instead of [xml name tag] in that part of the page solve the question, I don't know all implications of a change like this. If the term exists in the language file, it will be shown. If not, OSSN shows [xml name tag] as in the current version.

I will try to make this change and put it on Github.

German Michael Zülsdorff Replied 2 years ago

From my point of view the localization of component names (ids) should be removed completely.

I mean - whatever my native language is - before I'm going to install a component I need to become familiar with it. That is: After reading the description I do know what the component is good for and I decide to install it or not. Thus to me it makes no sense to translate the original name after installing and making the true reference intransparent this way. Even more because in case of any errors my log file would not show the translated name but the original one.