Joomla! 2.5 language file - translate description - joomla

I create a new plugin for joomla 2.5, and in xml i use:
<description>PLG_VAR_DESC</description>
But when install, he dont show the the translation but the var on file.
<languages folder="">
<language tag="en-GB">en-GB.plg_system_name.ini</language>
<language tag="en-GB">en-GB.plg_system_name.sys.ini</language>
</languages>
<files>
<folder>images</folder>
<filename>index.html</filename>
<filename>parameters.xml</filename>
<filename plugin="plg_name">plg_name.php</filename>
</files>
I try everything but i cant put this work..
Thanks

Under the administrator panel in Joomla! you can find under Site - Global configuration - System:
This will allow you to see the Joomla! Debug console:
There you can see if the language file your are using is loaded. If it's not loaded, than your manifest file is not consistent.
I think that the problem could be solved with:
<languages folder="admin">
instead of
<languages folder="">
Also for your reference, the Joomla! documentation on "Specification of language files" may be a good read.

I found the problem.. is the name of language file. Thank's for helping me

Related

Joomla 2.5 Package installation with language strings

I am in the process of creating a Joomla 2.5 Component which should be installed together with an associated Plugin. Therefore i'm using the concept of "Package" as described here: http://docs.joomla.org/Package
My Questions is: how do i implement a translatable text which is displayed post installation?
If you look at my package-xml-file i'd like to have the placeholder MY_PACKAGE_DESCRIPTION translated.
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="package">
<name>My Package</name>
<author></author>
<creationDate>January 2014</creationDate>
<packagename>mycomponent</packagename>
<copyright>©2014</copyright>
<url></url>
<version>1.0.0</version>
<packager></packager>
<packagerurl></packagerurl>
<description>MY_PACKAGE_DESCRIPTION</description>
<update></update>
<scriptfile>installer.php</scriptfile>
<files folder="packages">
<file type="component" id="com_mycomponent" >com_mycomponent.zip</file>
<file type="plugin" id="myplugin" group="quickicon">plg_quickicon_myplugin.zip</file>
</files>
<languages folder="language">
<language tag="en-GB">en-GB.pkg_mypackage.sys.ini</language>
<language tag="de-DE">de-DE.pkg_mypackage.sys.ini</language>
</languages>
</extension>
I tried to create dedicated language files for the package but neither those nor the language files of my component or plugin are referenced during installation.
Solution
I finally got everything working as expected. You have to be very careful with the naming of the XML-Elements and the naming and location of your files.
Like cppl pointed out the packagename needs to be reflected in the name of the language files. Also Joomla seems to require the language files in the exact location (relative to the root-path in your zipfile):
language/[language tag]/[language file]
So finally this did work:
<packagename>mypackage</packagename>
...
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.pkg_mypackage.sys.ini</language>
<language tag="de-DE">de-DE/de-DE.pkg_mypackage.sys.ini</language>
</languages>
I also was struggling in getting the installer script to run during the package installation.
<scriptfile>installer.php</scriptfile>
Following the Joomla naming conventions the correct naming of the installer class has to be
class pkg_mypackageInstallerScript {
...
}
Finally the corresponding folder-structure in the installable ZIP-Package is now as follows:
pgk_mypackage.xml
installer.php
packages/com_mycomponent.zip
packages/plg_quickicon_myplugin.zip
language/de-DE/de-DE.pkg_mypackage.sys.ini
language/en-GB/en-GB.pkg_mypackage.sys.ini
The main problem I see is the packagename element doesn't match the language element. You have (in your question at least)
<packagename>mycomponent</packagename>
...
<languages folder="language">
<language tag="en-GB">en-GB.pkg_mypackage.sys.ini</language>
<language tag="de-DE">de-DE.pkg_mypackage.sys.ini</language>
</languages>
To work with these language files your <packagename> should be:
<packagename>mypackage</packagename>
You can see this if you look at the package adapter in Joomla 2.5:
public function loadLanguage($path)
{
$this->manifest = $this->parent->getManifest();
$extension = 'pkg_' . strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->packagename, 'cmd'));
$lang = JFactory::getLanguage();
$source = $path;
$lang->load($extension . '.sys', $source, null, false, false)
|| $lang->load($extension . '.sys', JPATH_SITE, null, false, false)
|| $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
|| $lang->load($extension . '.sys', JPATH_SITE, $lang->getDefault(), false, false);
}
In, psuedo, it literally assembles 'pkg_' . <packagename> . '.sys' as the file name.

language file in joomla is not working properly?

http://127.0.0.1/COM/administrator/index.php?option=com_process_name
when i click on my newly created component form components menu "com_process_name" should be translated from language.ini file but joomla 3.1 is not translating that file properly as shown above.
my com.process.sys_language.ini file
COM_PROCESS_NAME="Hello World"
but when I watch it from extension Manager->manage it shows its proper name Hello World
I am using JOOMLA 3.1.5
my manifest file
<extension type="component" version="3.1" method="upgrade">
<name>COM_PROCESS_NAME</name>
<author>Arslan Tahir</author>
<creationDate>25 DEC 2013</creationDate>
<copyright>GPL</copyright>
thats how i am including language file
<languages folder="components/com_process">
<language tag="en-GB">en-GB/en-GB.com_process.ini</language>
<language tag="en-GB">en-GB/en-GB.com_process.sys.ini</language>
</languages>
The URl used to view your component such as:
index.php?option=com_process_name
is generated by the component name com_process_name which cannot be translated. Anywhere else on Joomla, it can be

Joomla! 2.5 language file - cannot translate description into xml-File

I checked out the question here: Joomla! 2.5 language file - translate description
It is exact the problem I have but unfourtunately I cannot answer the commen from Valentin. So here is my Problem again:
In my xml-File I have this line:
<description>COM_MYCOMPONENT_DESCRIPTION</description>
And in the file en-GB.com_mycomponent.sys.ini I have this:
COM_MYCOMPONENT="MyComponent"
COM_MYCOMPONENT_DESCRIPTION="This is the myComponent description"
COM_MYCOMPONENT_SUMMARY="Summary"
But in Debug-Mode for Languages I have every time this result:
??COM_MYCOMPONENT_DESCRIPTION??
Any Ideas?
Björn
You are using the language file correctly, therefore I am under the impression that it's due to the location of the file. Make sure you have the following in your XML file:
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.com_mycomponent.ini</language>
<language tag="en-GB">en-GB/en-GB.com_mycomponent.sys.ini</language>
</languages>
Also take note of the location:
I have used folder="language" then used en-GB before the file name so the folder structure will be like so:
root(where the XML is)/language/en-GB/en-GB.com_mycomponent.sys.ini
You don't have to put your language files in both places.
Your first configuration is actually correct and is working on Joomla 3.3 for sure.
In your manifest file you should have the language files declares as
<administration>
....
<folder>language</folder>
.....
</administration>
and dont make use of
<languages>....</languages>
Also on your package the folder structure should be
admin/language/en-GB/en-GB.yourcomponent.sys.ini.
If you have this configuration already, you are correct.
In that case from the message of the language debug mode, I assume that you either have mispeled something or there is an error inside your language file.
The latter is what usually happens with me. For example many times I have this error:
COM_MYCOMPONENT_TRA="A translation string"
COM_MYCOMPONENT_ANOTHER_ONE="Another one"
COM_MYCOMPONENT_SOMEOTHER=Some othen translation string"
COM_MYCOMPONENT_MORE="One more "
COM_MYCOMPONENT_LAST_ONE="E translation string"
(Missing the first double quote on the third line).

Joomla error uploading hand-coded template

I'm trying to upload my hand-coded template to Joomla 2.5.
I have moved it to the templates folder online. Now I'm trying to INSTALL it from Extension Manager > Install (I see the path to it in the textbox against the Install button). But upon clicking the button, I get this error:
-1 - An error has occurred.
Copy failed
Here's my XML file:
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="template">
<name>Travels</name>
<description>
Template for Target Travels
</description>
<files>
<filename>index.php</filename>
<filename>catergory.php</filename>
<filename>templateDetails.xml</filename>
<filename>css/template.css</filename>
<filename>css/mystyle.css</filename>
<filename>css/common.css</filename>
<filename>css/crasel.css</filename>
<filename>css/jquery.jcarousel.css</filename>
<filename>css/skin.css</filename>
<folder>css</folder>
<folder>images</folder>
</files>
<positions>
<position>breadcrumb</position>
<position>welcome</position>
<position>tour_catergory</position>
<position>left</position>
<position>right</position>
<position>top</position>
<position>user1</position>
<position>user4</position>
<position>footer</position>
</positions>
</extension>
Any idea on the cause and how to fix it?
This is usually due to permission issues with folders. In the Joomla backend go to:
Site (top menu) >> System Information >> Directory Permissions and ensure the "templates" folder is writable. Whilst you're at it, ensure all folder and files in the list are writable.
Hope this helps
If your template is already in place you should use discover install not install from directory. You have no need to copy files if the files are already where they need to be.

Load language file during joomla (2.5) system plugin installation

I'm having a real hard time showing a localized string during the installation of a system plugin (in Joomla 2.5). The "normal" way with localized strings in the xml file doesn't seem to work, (see this other question: Language based installation description).
I now tried the way proposed there, to show the description via the install scripts. This kind of works (I can echo text successfully), however, I also can't localize there - when debugging the language it shows that the plugin.sys.ini is not loaded yet; I tried to manually load the file, but had no success with loading any of my plugin language files.
This is what I got so far (in a file named setupscripts.php):
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
class plgsystemmyplgnameInstallerScript {
static function loadLanguage() {
$lang =& JFactory::getLanguage();
$lang->load('plg_system_myname', JPATH_ADMINISTRATOR);
}
function install($parent)
{
self::loadLanguage();
echo JTEXT::_("PLG_MYNAME_TEST_TEXT");
}
function uninstall($parent)
{
self::loadLanguage();
echo JText::_('PLG_MYNAME_UNINSTALL_TEXT');
}
function update($parent)
{
self::loadLanguage();
echo JText::_('PLG_MYNAME_UPDATE_TEXT');
}
function preflight($type, $parent) {}
function postflight($type, $parent) {
self::loadLanguage();
echo JText::_('PLG_MYNAME_INSTALL_TEXT');
}
}
But I only get ??PLG_MYNAME_TEST_TEXT?? ??PLG_MYNAME_INSTALL_TEXT?? (language debugging is turned on) during installation... weirdly enough, the language debug feature at the bottom of the page under "untranslated strings" shows "None" (where do the question marks then come from if not from a tried but failed translation???).
Tried some variations of it (with .sys at the end of the plugin name, since I actually think the setup strings should be in the .sys.ini file, without the second parameter (leaving it default), but no luck - no error, nothing in the log (in fact my log file isn't existing, probably there was no entry yet? can one set the log level with Joomla?). But never is there any file loaded (nothing changes under "loaded language files".
Anybody got an idea how to load the language properly?
Is there something special to consider when loading languages during setup? Why is there no error message if loading the languages fails? Do I maybe have to install the language files to a special location to get them recognized during installation? My current xml looks like this:
<extension version="2.5" type="plugin" group="system" method="upgrade">
<name>PLG_MYNAME</name>
<!-- ... author, copyright, version, .. -->
<scriptfile>setupscripts.php</scriptfile>
<files>
<filename plugin="myname">myname.php</filename>
<filename>setupscripts.php</filename>
<filename>index.html</filename>
<folder>sql</folder>
</files>
<!-- ... install->sql->file ... -->
<!-- ... uninstall->sql->file ... -->
<!-- ... update->schemas->schemapath ... -->
<languages [folder="admin"]>
<language tag="en-GB">en-GB.plg_system_myname.ini</language>
<language tag="en-GB">en-GB.plg_system_myname.sys.ini</language>
<!-- ... other languages ... -->
</languages>
<!-- ... config->fields->fieldset->field ... -->
</extension>
(the square brackes around folder="admin" are supposed to indicate that I tried both with and without this attribute. It doesn't change anything).
It only works on installation if you also copy the files to the admin language folder. If you look at the core extensions you will see that they do both. It's really a bug but that's the work around.
Finally I found out how to really do it. A thorough search in the google Joomla dev group brought up this very similar question.
Basically, the language files need to reside in a separate language folder it seems, and the files section also needs to reference them. My xml now looks like this:
<!-- ... everything else stayed the same, except: -->
<files>
<filename plugin="myplg">myplg.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>sql</folder>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_system_myplg.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_system_myplg.sys.ini</language>
<!-- .. other languages ... ->
</languages>
<!-- ... rest of the xml file ... -->
The language files are now all in separate subfolders... they get copied to the exact same location as before (administrator/language//...), but now the description from the XML is also localized!
I find it very weird that there are so many ways to specify language files, which all basically work except for the one corner case of the installation...
Hope this will help other people struggling with this!

Resources