How to translate administrator menu items in Joomla! 1.5.6?

That’s a question that I’ve been doing to myself in the past two days.

Unfortunately there aren’t much informations about this subject, and from what I’ve read there is a lot of people with the same doubts I had.

Because I haven’t found any documentation on this subject I’ve decided to write the my own tutorial, hope it helps you.

Assuming that you already know how to create a Joomla! component setup XML file, I’ll write here how you can translate your administrator menu items using language packages. That way I will not talk about website front-end since I’m only focusing on administration menus.

I will also assume that you have a directory structure similar to the one below:

com_mycomponent
com_mycomponent/mycomponent.xml
com_mycomponent/admin
com_mycomponent/admin/index.html
com_mycomponent/admin/language
com_mycomponent/admin/language/index.html
com_mycomponent/admin/language/en-GB.com_mycomponent.ini
com_mycomponent/admin/language/en-GB.com_mycomponent.menu.ini
com_mycomponent/admin/language/pt-PT.com_mycomponent.ini
com_mycomponent/admin/language/pt-PT.com_mycomponent.menu.ini

1. Open XML setup file.

$ geany com_mycomponent/mycompoment.xml

2. Open administration tag and start to write component administration menu, our component’s menu will be composed by a title (COM_MYCOMPONENT) and two child links (LINK-1 and LINK-2). Note that all & must be escaped to & for the file to be valid XML and be parsed by the installer.

<administration>
<menu>COM_MYCOMPONENT</menu>
<submenu>
<menu link=”option=com_mycomponent&amp;controller=c1“>LINK-1</menu>
<menu link=”option=com_mycomponent&amp;controller=c2“>LINK-2</menu>
</submenu>

Now that we’ve finished the component administration menu, we will load language package files that will translate your component administration menu itens.
For this example we will have two different translations, English and Portuguese.
Although we are writing four files, two pairs for each language, the *.menu.ini are the ones that matter for this tutorial, the other ones are used to translate other texts that you will use in your component.

<languages folder=”admin/language”>
<language tag=”en-GB”>en-GB.com_mycomponent.ini</language>
<language tag=”en-GB”>en-GB.com_mycomponent.menu.ini</language>
<language tag=”pt-PT”>pt-PT.com_mycomponent.ini</language>
<language tag=”pt-PT”>pt-PT.com_mycomponent.menu.ini</language>
</languages>
</administration>

End of component administration supported languages and close administration tag.

3. Edit the English package file and write the translations for the items you’ve just created.

$ geany com_mycomponent/admin/language/en-GB.com_mycomponent.menu.ini
COM_MYCOMPONENT=My Component
COM_MYCOMPONENT.LINK-1=Link number one
COM_MYCOMPONENT.LINK-2=Link number two

4. Repeat the step #3 for the Portuguese package file.

$ geany com_mycomponent/admin/language/pt-PT.com_mycomponent.menu.ini
COM_MYCOMPONENT=O meu Componente
COM_MYCOMPONENT.LINK-1=Ligação número 1
COM_MYCOMPONENT.LINK-2=Ligação número 2

Note : All ini files need to be saved as UTF-8.

With this four steps you are able to translate your component administrator menu items, although it is a simple process, unfortunately there isn’t much documentation on this subject, and the one that exists is a bit poor and doesn’t explain all the steps.

To complete what I’ve wrote in here you can also take a look at this tutorial that talks about this subject, and you may also take a look at this one that covers the steps needed to follow while developing a component.

Facebook Twitter Linkedin Plusone
  • Christoforos

    great!! this was really helpful. Is there a way to accomplish the same thing with xml parameters ?

  • http://www.blog.joaomorais.com João Morais

    Hi Chris,

    Thanks for your feedback, I’m glad this post has helped you :)

    I’m not sure if this feature has changed in latest versions. As you should know Joomla 1.6 is already out, and to be honest the last time I worked with Joomla was when I wrote this post…

    Cheers.