2

I am just trying to create backend component and I can't get the language file to work.

This is my xml manifest (the important part):

<media destination="com_displaygroups" folder="media">
  <filename>index.html</filename>
  <folder>css</folder>
</media>

<administration>
  <!-- Administration Menu Section -->
  <menu link='index.php?option=com_displaygroups'>COM_DISPLAYGROUPS</menu>
  <submenu>
    <menu view="groups">COM_DISPLAYGROUPS_BY_GROUPS</menu>
    <menu view="users">COM_DISPLAYGROUPS_BY_USERS</menu>
  </submenu>
  <!-- Administration 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 /admin/ in the package -->
  <files folder="admin">
    <!-- Admin Main File Copy Section -->
    <filename>index.html</filename>
    <filename>displaygroups.php</filename>
    <filename>controller.php</filename>
    <folder>models</folder>
    <folder>views</folder>
    <folder>language</folder>
  </files>
  <languages folder="admin/language">
    <language tag="en-GB">en-GB/en-GB.com_displaygroups.sys.ini</language>
  </languages>
</administration>

I just want one language file because that 3 strings in the manifest are all what I need. When I install the component i get the message:

Warning JInstaller: :Install: File does not exist C:\xampp\htdocs\just-joomla\tmp\install_56dd839e79478\admin\language\en-GB\en-GB.com_displaygroups.sys.ini

but I can see that Joomla adds language file inside administrator\components\com_displaygroups\language\en-GB\ the en_GB.com_displaygroups.sys.ini

Can anyone tell me what am I doing wrong here? :(

Edit1\ My file tree inside component:

com_displaygroups
│   displaygroups.xml
│   tree.txt
│   
├───admin
│   │   controller.php
│   │   displaygroups.php
│   │   index.html
│   │   
│   ├───language
│   │   │   index.html
│   │   │   
│   │   └───en-GB
│   │           en_GB.com_displaygroups.sys.ini
│   │           index.html
│   │           
│   ├───models
│   │       groups.php
│   │       index.html
│   │       users.php
│   │       
│   ├───sql
│   │   │   index.html
│   │   │   
│   │   └───updates
│   │       │   index.html
│   │       │   
│   │       └───mysql
│   │               0.0.1.sql
│   │               index.html
│   │               
│   └───views
│       │   index.html
│       │   
│       ├───groups
│       │   │   index.html
│       │   │   view.html.php
│       │   │   
│       │   └───tmpl
│       │           default.php
│       │           index.html
│       │           
│       └───users
│           │   index.html
│           │   view.html.php
│           │   
│           └───tmpl
│                   default.php
│                   index.html
│                   
└───media
    │   index.html
    │   
    └───css
            display-style.css
            index.html

2 Answers 2

2

You can also ship the language files within your component in the language folder as I do with DPFields https://github.com/Digital-Peak/DPFields/blob/master/com_dpfields/admin/dpfields.xml#L48. After installation the language files are still in your component folder. Joomla will auto detect the translation files.

Check out that the filename in the manifest file and the folder tree are the same. Otherwise they don't get loaded. If it still doesn't work, then it can be that you have an error in your language file. Set Debug Language to yes in your Joomla configuration, it will tell you which files could be loaded and which ones not.

2
  • Thank You @Laoneo for pointing me to the Debug Language option. Thanks to that I saw that my files aren't loaded at all and then I saw it... Stupid me. Check my file name in manifest and in the tree... Please adjust Your answer a lil bit (with pointing that I am blind ;) ) and I'll accept it. :) Commented Mar 10, 2016 at 8:06
  • Adjusted answer with filename check :-)
    – Laoneo
    Commented Mar 10, 2016 at 8:42
2

Try this:

<languages folder="admin">
    <language tag="en-GB">language/en-GB/en-GB.com_displaygroups.sys.ini</language>
</languages>

and remove

<folder>language</folder>

From the section of your manifest.

6
  • 2
    Thank You @Terry for Your suggestion. Tried it and still same error but now after deleting <folder>language</folder> the language folder isn't even copied. I also edited my question and added the tree view for my component. Commented Mar 8, 2016 at 7:26
  • 1
    By running the manifest file like I have mentioned it doesn't move the language folder into your component directory, it should only copy the files into Joomla language folder. That is more personal preference I think than anything, I do it this way in all of my components and it works well. The only other thing I can think of to check is whether or not you are encoding the language file as UTF-8 without BOM. That may be fuddling with the file. What software app are you using to write your language file?
    – Terry Carter
    Commented Mar 8, 2016 at 22:32
  • You can also download my JoomRoster component from the JED and see how I laid out my folder structure / manifest file. It is almost identical to yours so the BOM issue is the only other thing I can think of. extensions.joomla.org/extensions/extension/…
    – Terry Carter
    Commented Mar 8, 2016 at 22:33
  • 1
    If you are using Notepad to create your lang file, download Notepad++ as an editor, copy your language strings into a new text document, and under the encoding menu at the top set the encoding to UTF-8 without BOM. Save it as your ini file and try an upload again.
    – Terry Carter
    Commented Mar 8, 2016 at 22:35
  • 1
    Thank You @Terry for all Your help, I feel so stupid right now... Take a look, at my file name in manifest and in the tree... Just kill me now... On the other hand, now I know more about language files then ever lol :D I would like to close this question... Commented Mar 10, 2016 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.