I try to create a very simple module in Joomla. While my whole code is correct, and the module working properly, I cannot make it support the I18n feature.
More specific, my module directory is like that:
mod_mymodname:
languages:
en-GB.mod_mymodname.ini
mod_mymodname.php
mod_mymodname.xml
and then in my mod_mymodname.xml I have that code :
<?xml version="1.1" encoding="utf-8"?>
<extension type="module" version="2.5.0" client="site">
<name>MyModName</name>
... Other Options ...
<files>
<filename module="mod_mymodname">mod_mymodname.php</filename>
<filename>mod_mymodname.xml</filename>
</files>
<languages folder="languages">
<language tag="en-GB">en-GB.mod_mod_mymodname.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="modid" size="50" type="text" label="MODID" description="Description here" />
</fieldset>
</fields>
</config>
</extensions>
and my en-GB.mod_mymodname.ini has that content in it
MODID=Module ID
The problem is that in my admin section the field label has the value of "MODID" instead of "Module ID"
Is there anything wrong with that ? Is my first Joomla module, and I am not sure if everything is correct.
Note : The module doesn't require any translation in the front-end. I only need I18n for the administration section.
make sure you mentioned correct text for MODID in language file.
en-GB.mod_mymodname.ini ---> This file was used for declaring the text what we given in that module
Just add the following line in en-GB.mod_mymodname.ini this language file.
MODID="Module ID"
Save and check the module.. Hope this will work....
language file need to be in joomla language folder. If you had installed the module from admin then check the language folder and check if your file exists there.
check in administrator/languages/en-GB/
also you may have to change the way you have mentioned language files in your xml.
Have a look at this link for more detailed description
http://docs.joomla.org/Specification_of_language_files#Language_file_naming_conventions_and_precedence
Make sure you also have en-GB.mod_mymodname.sys.ini for translating text coming from the xml.
I thought of something else too. There does seem to be a known issue where for certain strings from the xml are only translated when the language file is in the main language folder rather than the extension language folder. So I usually put copies both places even though it's considered bad practice to put extension files in the core folder.
first add your module.xml language tag
<languages folder="languages">
<language tag="fr-FR">fr-FR.mod_mod_mymodname.ini</language>
<language tag="fr-FR">fr-FR.mod_mod_mymodname.sys.ini</language>
</languages>
then create two new file in your module language folder
fr-FR.mod_mod_mymodname.ini
fr-FR.mod_mod_mymodname.sys.ini
add the text you want to translate in .ini file like
MOD_MYMODULE_USERNAME="this is my mod"
Then add this constant value to your module default.php file like
JText::_ ('MOD_MYMODULE_USERNAME')
Related
I've become fairly confused when I'm trying to create a subfolder and populate it with things in my plugin manifest XML.
If I want to create a subfolder and at the same time add files to it, how would that be done? Read comments in the code draft (all names are of course more distinct than used here).
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="2.5.0" group="group" method="upgrade">
<name>Handelsbanken Finans Delbetalning</name>
<!-- The following elements are optional and free of formatting conttraints -->
<creationDate>July 2013</creationDate>
<author>Emil Carlsson</author>
<authorUrl>http://valid.url</authorUrl>
<copyright>Copyright (C) 2013</copyright>
<version status="BETA">0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>Plugin description.</description>
<update> <!-- Runs on update; New in 1.6 -->
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /site/ in the package -->
<files folder="site">
<filename>plgName.xml</filename>
<filename>plgName.php</filename>
<folder>helpers</folder>
</files>
</extension>
This gives me nothing really. I can't find the folder I shouldhave been created from what I gathered from the documentation. It also doesn't specifies how I populate these folder :(. I am assuming that it is possible to more or less just package all files I want and then it will create the subfolders where I want/need them. But that it is a question of how to write the manifest file. If anyone have a good tutorial about this I would be very thankful :). I've googled until my fingers are almost at the Point of bleeding :(. I guess I could put all the files in the same folder, but I want to have some sort of structure to visualize for other developers what's part of the core of the plugin and what's not part of the plugin core.
Problem is solved. In my not installation script I linked in the files for what I thought only was used by the configuration XML (a field to configurate the plugin). In this file I had the node "files" as well, in this node I'd not linked in the helpers directory. When this was done all the subdirectories was added as well. So in short - Don't forget to link in the folder in all places where you have a files-node.
mod_modulo.xml file:
<?xml version="1.0" encoding="utf-8"?>
<install type="module" version="1.5.0">
<name>**EXTNAME**</name>
<description>**EXTDESCR**</description>
<files>
.
.
.
</files>
<languages>
<language tag="en-US">languages/en-US.mod_modulo.ini</language>
<language tag="es-ES">languages/es-ES.mod_modulo.ini</language>
</languages>
</install>
es-ES.mod_modulo.xml:
EXTNAME=Mi modulo
EXTDESCR=Descripcion de mi modulo va aqui
I am using Joomla!1.5 to develop modules because I think that newer versions of Joomla are compatible with older modules. Anyway, the question is: How can I set the values of name and description in mod_module.xml to the strings found in the corresponding language file ?
Joomla 1.5's component installation manifest definition includes a section for administrator interface language files:
...
<administration>
<languages folder="administrator/language/">
<language tag="en-GB">en-GB/en-GB.com_my.ini</language>
<language tag="es-ES">es-ES/es-ES.com_my.ini</language>
</languages>
</administration>
...
However, this specification does not work for modules in that version.
The Document type definition used by J1.5's manifest files is no longer served.
Thant's why I am not sure whether the failure to copy the language files to the admin section's folder is a bug or is done by design. Their removal during the uninstallation process indicated that it is indeed a bug.
Joomla! v1.5 module installation is performed by libraries/joomla/installer/adapters/module/php.
This file is not accessing this node during the installation, but is deleting it during uninstall it deletes it:
$this->parent->removeFiles($root->getElementByPath('administration/languages'), 1);
What can you do?
Legacy packages support in 2.5 and 3.x requires compromises. I would personally advise against it, as it cripples your design.
Therefoe, you can either write a Joomla! 2.5+ module, or you can try to hack your way around this, which would not be pretty. Modules don't event have installation scripts, so you cannot even copy the language files during the module installation process.
The first thing that comes to mind is copying the language files to the administrator folder the first time the controller is invoked.
All this should, hopefully, convince you (and anyone reading this post) to switch to the current Joomla! version.
Try this,
In your xml file
<languages>
<language tag="en-US">languages/en-US.mod_modulo.ini</language>
<language tag="es-ES">languages/es-ES.mod_modulo.ini</language>
</languages>
in your mod_modulo.ini file
EXTNAME="Mi modulo"
EXTDESCR="Descripcion de mi modulo va aqui"
in your default.php file have.
echo "Name :".JText::_('EXTNAME');
echo "Description:".JText::_('EXTDESCR');
Hope its help you..
I've created a joomla templates. As instructed I have placed my files and folders inside and linked to css file in index.php but when I cut up all the text in templateDetails.xml it is still showing as previous in the browsers and also at positions even after doing a clean refresh. Why is it taking its position and css, I'm surprised.
Edit
as per comments I have been placing my templateDetails.xml contents
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.5/template-install.dtd">
<install version="1.5" type="template">
<name>bini7a</name>
<creationDate>Mon, Jun-10, 2013</creationDate>
<author>Bhojendra Rauniyar</author>
<authorEmail></authorEmail>
<authorUrl></authorUrl>
<copyright>Bhojendra Rauniyar</copyright>
<license>GNU/GPL</license>
<version>1.0</version>
<description>bini7a: Bhojendra Template</description>
<files>
<filename>index.php</filename>
<filename>templateDetails.xml</filename>
<folder>images</folder>
<folder>css</folder>
</files>
<positions>
<position>headera1</position>
<position>headera2</position>
<position>mid</position>
<position>headerb1</position>
<position>headerc1</position>
<position>headerd</position>
<position>left</position>
<position>right</position>
</positions>
</install>
But even if I delete all these all the positions work correctly as defined position and also the css
The positions specified within Joomla's templateDetails.xml are only really needed when configuring module positions within the administrator's Module Manager. Once the position has been set it would appear the templateDetails.xml file does not need to be referenced again to display the module in that requested position.
To remove these positions permanently, either uninstall the template and reinstall with the new XML file or (the better) remove the positions from the template's index.php file.
You're looking for JDoc statements like the below:
<jdoc:include type="modules" name="headera1" />
See http://docs.joomla.org/Jdoc_statements for more information on the JDoc statements.
I hope this helps solve your dilemma.
I create one template for joomla 2.5. But when I installed it it show the error:
"Failed loading XML file
D:\wamp\www\demoproject\tmp\install_51a44308e27b9\templateDetails.xml
XML: XML declaration allowed only at the start of the document
JInstaller: :Install: Cannot find Joomla XML setup file"
How can I solve it please?
It means your XML file isn't properly written. The actual error is:
XML declaration allowed only at the start of the document
Check the file and make sure
<?xml version="1.0" encoding="utf-8"?>
is the first line in the file. No line breaks or anything else is allowed before this.
That means you try to install the wrong .zip file. It happens often if you try to install a Joomla 1.5 template to a Joomla 1.6 website or the other way around.
Another common reason is, that you try to install the templates download package (<- the ZIP Archive with all the template stuff inside, like the psd file, the docs AND the installation files) , instead of the included installation file.
<extension version="2.5" type="template" client="site"> Try extension tag instead install.
<!DOCTYPE install PUBLIC "-//Joomla! 1.6//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.6/template-install.dtd"> Include the correct doc type.
How do I upload a css file in my Joomla module? The manifest file is:
<files>
<filename>mod_wforcsliderresz.xml</filename>
<filename module="mod_wforcsliderresz">mod_wforcsliderresz.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<folder>tmpl</folder>
</files>
<media folder="media" destination="mod_wforcsliderresz">
<folder>css4c</folder>
</media>
<languages>
<!-- Any language files included with the module -->
<language tag="en-GB">en-GB.mod_wforcsliderresz.ini</language>
</languages>
I can overcome the problem by uploading the css directly but that's no good as a long term solution.
I've checked through FTP for the newly created folder media/mod_wforcsliderresz/css but there is no mod_wforcsliderresz subfolder within media.
I also tried to add a cssstfff above the tmpl definition but that wouldn't work. Any help would be great.
I think your css folder
css4c (if it exists) , is uploaded tomedia/media/mod_wforcsliderresz/css4c
Note that it's media/media.If you would remove
folder="media" from <media folder="media" destination="mod_wforcsliderresz">
then it would be in media/mod_wforcsliderresz/css4c.
Try changing this:
<media folder="media" destination="mod_wforcsliderresz">
<folder>css4c</folder>
</media>
to this:
<media folder="mod_wforcsliderresz">
<folder>css4c</folder>
</media>