Where is the best place for language files?

62 views
Skip to first unread message

Astrid Günther

unread,
Jun 19, 2016, 6:51:38 AM6/19/16
to Joomla! General Development
Hi,

I am new here. I asked this question here too: http://forum.joomla.org/viewtopic.php?f=727&t=926911

I wonder what way is the best to use language files of an extension.
The common way is to load the files to the language folders like this:

Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8"?>
<extension
version="3.0"
type="plugin"
group="content"
method="upgrade">
<name>plg_content_coordstomap</name>
<creationDate>Mai 2016</creationDate>
<license> http://www.gnu.org/licenses/gpl-3.0.html</license>
<version>1.2.0</version>
<description>PLG_CONTENT_COORDSTOMAP_XML_DESCRIPTION</description>
<files>
<filename plugin="coordstomap">coordstomap.php</filename>
</files>
[b] <languages>
<language tag="en-GB">language/en-GB/en-GB.plg_content_coordstomap.ini</language>
<language tag="en-GB">language/en-GB/en-GB.plg_content_coordstomap.sys.ini</language>
<language tag="de-DE">language/de-DE/de-DE.plg_content_coordstomap.ini</language>
<language tag="de-DE">language/de-DE/de-DE.plg_content_coordstomap.sys.ini</language>
</languages>[/b]
</extension>


But it works too, if you copy them to the folder of the extension the way like this:


Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8"?>
-<extension method="upgrade" group="content" type="plugin" version="3.0">
<name>plg_content_coordstomap</name>
<creationDate>Mai 2016</creationDate>
<license> http://www.gnu.org/licenses/gpl-3.0.html</license>
<version>1.2.0</version>
<description>PLG_CONTENT_COORDSTOMAP_XML_DESCRIPTION</description>
<files>
<filename plugin="coordstomap">coordstomap.php</filename>
[b]<folder>language</folder>[/b]
</files>
</extension>


I prefer the second way. This works quite good for me. But I wonder if I miss something and I would better copy the files in the intended language folder.

Regards
Astrid

piotr_cz

unread,
Jun 19, 2016, 7:43:51 AM6/19/16
to Joomla! General Development
As far as I know contents of the languages folder i copied to application languages folder during installation.
But while developing an extension, you may remove these and then extension language files will be used instead.

Allon Moritz

unread,
Jun 19, 2016, 8:15:00 AM6/19/16
to joomla-de...@googlegroups.com
I would put them into the language folder in your extension. Much easier to maintain and adding new languages. On DPFields https://github.com/Digital-Peak/DPFields/tree/master/com_dpfields. I'm using it that way. No need to add every language to your manifest file then.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

Astrid Günther

unread,
Jun 19, 2016, 1:15:34 PM6/19/16
to Joomla! General Development
Thank you very much for your feedbacks.

Bakual

unread,
Jun 20, 2016, 2:52:32 AM6/20/16
to Joomla! General Development
Old way was to put them into global language folder. New way is to use the extension language folder.

However it is good to know that the global language folder is checked first. Which means if there is a file found there, it will be loaded instead of the one in the extension language folder. If you put your language files into the extension language folder, that allows a user to override the complete file by putting it into the global folder.
Also, when using the extension language folder, you can ship all translations with your extension and they install no matter what languages are actually installed on the system. If you're using the global folder, then only the languages currently installed are copied. If the user installs an additionally language later, he will have to install your extension again to get the missing translation. 

So imho, there are only downsides to use the global folder :)
Reply all
Reply to author
Forward
0 new messages