2

I'm developing a component and want to set up multiple language support at least for the front end at this stage.

I may have missed something or not interpreted it correctly but in the Joomla component development tutorial.

I think only adding language for the back is discussed; Under the section "Adding language translation in the public site" the site/language/en-GB/en-GB.com_helloworld.ini file is left empty.

I could not find anything else later or earlier in the tutorial.

Appreciate your help.

3
  • Many components don't have much in the way of front end language needs. If you do need front end strings they are created exactly like the backend ones. Just look at any core component and you will see examples.
    – Elin
    May 15, 2014 at 10:14
  • ok, thnx Elin. I would have thought most components focus at functions for the frontend (public websiite) and therefore do have a language need?
    – Joppo
    May 15, 2014 at 11:57
  • It really depends, but anyway the only difference is the name of the client when you install.
    – Elin
    May 15, 2014 at 12:12

1 Answer 1

3

You only have to add the additional languages to the XML installer of your extension. For example:

<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5.0" method="upgrade">
...

    <!-- Front end translation files -->
    <languages folder="language/frontend">
        <language tag="en-GB">en-GB/en-GB.todo_cli.ini</language>
        <language tag="en-GB">en-GB/en-GB.com_todo.ini</language>
        <language tag="es-ES">es-ES/es-ES.com_todo.ini</language>
        <language tag="es-ES">es-ES/es-ES.com_todo.sys.ini</language>       
    </languages>

...

    <!-- Administrator back-end section -->
    <administration>
..
        <!-- Back-end translation files -->
        <languages folder="language/backend">

            <language tag="en-GB">en-GB/en-GB.com_todo.ini</language>
            <language tag="en-GB">en-GB/en-GB.com_todo.sys.ini</language>
            <language tag="es-ES">es-ES/es-ES.com_todo.ini</language>
            <language tag="es-ES">es-ES/es-ES.com_todo.sys.ini</language>

        </languages>
    </administration>
..
</extension>

Ini files follow the usual format. Example:

; ToDo Project
; Copyright (C) 2014 - 2014 MYCOPYRIGHT. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 - No BOM

COM_TODO_ALIGN="Image Float"
COM_TODO_ALIGN_DESC="This will apply the classes 'pull-left', 'pull-center' or 'pull-right' to the '<figure>' or '<img>' element"
COM_TODO_BROWSE_FILES="Browse files"
COM_TODO_CAPTION="Caption"
COM_TODO_CAPTION_CLASS_LABEL="Caption Class"

Your Answer

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