Install any component with <name>com_helloworld</name>
or <name>COM_HELLOWORLD</name>
defined in it's manifest file, which is probably 99.9% of components
For the purposes of this issue I will just use COM_HELLOWORLD
, the same happens for com_helloworld
but this is not the standard for translations.
The <name>COM_HELLOWORLD</name>
should be translated using the strings found in the admin/language/en-GB.com_helloworld.sys.ini
(or it could be en-GB.com_helloworld.ini
). It should also use the Joomla installations default language and then fallback to en-GB as a normal translation.
COM_HELLOWORLD
.<name>
string is fully translated and stored in the database correctly,com_helloworld
and COM_HELLOWORLD
and never their proper name.This is an issue on all versions of Joomla upto and including Joomla 4.
My Test Server Specs just incase.
Setting | Value |
---|---|
PHP Built On | Windows NT E6540 10.0 build 19041 (Windows 10) AMD64 |
Database Type | mysql |
Database Version | 5.5.5-10.4.10-MariaDB |
Database Collation | utf8mb4_unicode_ci |
Database Connection Collation | utf8mb4_general_ci |
PHP Version | 7.3.12 |
Web Server | Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.12 |
WebServer to PHP Interface | apache2handler |
Joomla! Version | Joomla! 3.9.22 Stable [ Amani ] 6-October-2020 15:00 GMT |
Joomla! Platform Version | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT |
User Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0 |
If in my Joomla component I use the following code, the component will install orrectly and use the <name>
tag string for the database column name
in the #__extensions
table. The <element>
tag string is filling into the element
column in the same table.
<name>Chickens Walk Among Us</name>
<element>com_mywalks</element>
This workaround does not allow for multilanguage translation of this <name>
tag but I am guessing it might be the reason for the <element>
tag in the manifest which is only for components.
<element>
– the internal name of the component. If omitted, name will be cleaned and used
My thoughts
<name>
tag in a component's manifest file needs to translatable so COM_HELLOWORLD
format can be used to match how plugins and modules translate this tagTitle |
|
||||||
Labels |
Added:
?
|
The names are not correct in the database as shown in the images.
During the install the string COM_HELLOWORLD
is not translated before it is stored in the #__extensions table, name column. Hence all component names are in the format COM_HELLOWORLD
or com_helloworld
The translation happens correctly for modules and plugins.
Also ignore the typo you noted I will go, and change that now.
The names are not correct in the database as shown in the images.
During the install the string COM_HELLOWORLD is not translated before it is stored in the #__extensions table, name column. Hence all component names are in the format COM_HELLOWORLD or com_helloworld
It should NOT be translated in the database. It should only be translated when it is output.
What you are proposing would mean that it will always be stored as a language value and not a language key. Therefore it can not be translated
Then why is that happening for modules and plugins? I am on about the name
and not element
You can clearly see in the images above this is happening for plugins and modules, it always has. It is just components that this does not work for.
Would you like me to re-upload my example images and add some annotations on them to make it easier to see the issue?
This table might help.
Extention Type | <name> String |
Database name column |
---|---|---|
module | MOD_HELLOWORLD | Helloworld |
plugin | PLG_HELLOWORLD | Helloworld |
Component | COM_HELLOWORLD | COM_HELLOWORLD |
thanks
@brianteeman The image you have sent doesnt really help me. Is it a Joomla dump or a database dump?
If you look at eXtplorer though, you can see it has a translated name
field. You will probably find it is using the <element>
tag in its manifest. This is assuming this ouput matches the database fields.
If you look at the images I posted you can see Translated and non translated name
fields.
compare the function storeExtension() in:
They are different in how they handle the storing of the name.
They are different in how they handle the storing of the name.
The only difference i can see is that the handling of discovery installation happens at different places. But regarding storing the name I see no difference.
I am not an expert but:
module
$this->extension->name = $manifest_details['name'];
component
$this->extension->name = $this->name;
The manifiest has probably already been parsed with the translator code.
$this->extension->name = $manifest_details['name'];
Is only done for the module when a discover installation.
For normal installations it looks the same as for the component, $this->extension->name = $this->name;
.
You should also have a look on the if conditions around the assignment statements.
ok, I will find the code and paste it here as long as this issue doesnt get closed becasue no-one thinks this issue exists
ok, I will find the code and paste it here as long as this issue doesnt get closed becasue no-one thinks this issue exists
😄
Thanks, maybe that could help.
But if the issue exists, then your approach or expectation to save the translated text in database is wrong, as already elaborated. It would never be possible to see the translation changing when changing backend language if we do that.
But if the issue exists, then your approach or expectation to save the translated text in database is wrong, as already elaborated.
It already happens, see my images above which no-one seems to look at
It would never be possible to see the translation changing when changing backend language if we do that.
I never said that. It is upon the intial install, that the component's default
language translation of COM_HELLOWORLD
is used for the name
column. No further updates are done to it, i.e. changing the default language in joomla.
I will find where the name is getting parsed in modules/plugins and why this is not happening with components using my trusty debugger.
I still dont know what the issue that you are trying to resolve is?
I am debugging the code to track what I need down. I think it will be easier if I find the code to help explain.
I have gone back to my orginal post before everyone was saying they could not see the issue.
A component will only install correctly if the name
tag in the manifest is in one of the following formats. It must be the components element name either in lowercase or uppercase, perhaps a mixed version would also work.
<name>com_helloworld</name>
<name>COM_HELLOWORLD</name>
unless you have the following tag which will overrides the name tag for the purposes of installing. in which case you can change the <name>
tag to something else. ie <name>COM_HELLOWORLD_NAME</name>
<element>com_helloworld</element>
If you do not follow the rules above, the component appears to install but the menus are corrupt and they dont work, see below where I changed the name tag to <name>com_chicken</name>
when the name of the component is com_qwdemobar. It should also be noted that the extension installed into administrator/components/com_chicken
Modules and plugins
<name>
translation string you want without affecting the installation.<filename module="mod_helloworld">mod_helloworld.php</filename>
<filename plugin="helloworld">helloworld.php</filename>
so maybe joomla should
Use a string similiar to modules and plugins.
<filename component="helloworld">helloworld.php</filename>
So you cannot use any translation string you want in the <name>
field unless you have the <element>
configured.
The <element>
field is only present in a component, so in the <name>
tag issue is changed/fixed you could potential remove the need for <element>
which no-one seems to use anyway and would bring all of the install types closer together.
I hope I have madew things a little clearer. It certainly helps when you dig into the code.
Thanks JCommunity
So if I understand correctly you want the core of joomla to be changed so that an extension will install that doesnt follow the documentation??
actually what I am asking for is for the documentation to be followed:
see https://docs.joomla.org/Manifest_files
The following elements can be used to insert metadata. None of these elements are required; if they are present, they must be a child of the root element.
Note: The
<name>
and<description>
tags are also translatable fields so that the name and description of the extension can be shown to the user in their native language.
<name>
tag does more that represent the translatable name.<name>COM_HELLOWORLD_NAME</name>
<element>
tag you can then use any translation string you want in the <name>
tag. This is not mentioned in the documentation.<element>
tag, they dont need to and it is component only.<name>
tag should not be involved in the file installation of the component.At the very least the <element>
tag should be made mandatory and the <name>
tag should have nothing to do with the install procedure just like modules and plugins, and the documentation updated to reflect this.
I am sure this would be a small change to the installer code without much repercussion.
Title |
|
||||||
Labels |
Added:
J3 Issue
|
Thank you for raising this issue.
Joomla 3 is now in security only mode with no further bug fixes or new features.
As this issue doesn't relate to Joomla 4 it will now been closed.
If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4.
cc @zero-24
Closing for the reason stated above.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-08-26 19:06:50 |
Closed_By | ⇒ | richard67 | |
Labels |
Added:
No Code Attached Yet
Removed: ? |
I don't understand your problem. Component names are translated correctly.
If the name of your component is com_helloworld then the name of the language file is not en-GB.com_qwhelloworld.sys.ini.