为什么语言没有加载?我做错了什么?

时间:2013-03-04 02:46:30

标签: joomla joomla-extensions

我正在研究我的第一个Joomla 3.0组件,因此我为语言创建了两个文件夹:

com_moving/language/en-GB/en-GB.ini
com_moving/language/es-ES/es-ES.ini

我的moving.xml就是这个(取自我发现的com_ola_j3):

<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
    <name>COM_MOVING</name>
    <creationDate>Marzo 2013</creationDate>
    <author>Reynier Perez Mira</author>
    <authorEmail>reynierpm@gmail.com</authorEmail>
    <authorUrl>http://www.reynierpm.com</authorUrl>
    <copyright>Copyright (C) 2013 Reynier Perez Mira. Derechos reservados.</copyright>
    <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
    <version>1.0</version>
    <description>COM_MOVING_DESCRIPTION</description>
    <scriptfile>script.php</scriptfile>

    <install> <!-- Runs on install -->
        <sql>
            <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
        </sql>
    </install>
    <uninstall> <!-- Runs on uninstall -->
        <sql>
            <file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
        </sql>
    </uninstall>

    <!-- Site 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 /site/ in the package -->
    <files folder="site">
        <filename>index.html</filename>
        <filename>moving.php</filename>
        <filename>controller.php</filename>
        <folder>views</folder>
        <folder>models</folder>
        <folder>language</folder>
    </files>

    <media destination="com_moving" folder="media">
        <filename>index.html</filename>
        <folder>images</folder>
    </media>

    <languages folder="site">
        <language tag="en-GB">language/en-GB/en-GB.com_moving.ini</language>
        <language tag="es-ES">language/es-ES/es-ES.com_moving.ini</language>
    </languages>

    <administration>
        <!-- Administration Menu Section -->
        <menu img="../media/com_moving/images/tux-16x16.png">COM_MOVING_MENU</menu>
        <!-- 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>config.xml</filename>
            <filename>access.xml</filename>
            <filename>moving.php</filename>
            <filename>controller.php</filename>
            <!-- SQL files section -->
            <folder>sql</folder>
            <!-- tables files section -->
            <folder>tables</folder>
            <!-- models files section -->
            <folder>models</folder>
            <!-- views files section -->
            <folder>views</folder>
            <!-- controllers files section -->
            <folder>controllers</folder>
            <!-- helpers files section -->
            <folder>helpers</folder>
        </files>

        <languages folder="admin">
            <language tag="en-GB">language/en-GB/en-GB.com_moving.ini</language>
            <language tag="en-GB">language/en-GB/en-GB.com_moving.sys.ini</language>
            <language tag="es-ES">language/es-ES/es-ES.com_moving.ini</language>
            <language tag="es-ES">language/es-Es/es-ES.com_moving.sys.ini</language>
        </languages>
    </administration>
</extension>

当我去扩展&gt;扩展管理器&gt;发现我没有获得组件名称我刚刚得到“COM_MOVING”为什么?我做错了什么?

1 个答案:

答案 0 :(得分:1)

您应该有两个单独的语言集。一个用于管理员端,一个用于站点(前端)。总计,这四个文件应位于以下位置:

com_moving/admin/language/en-GB/en-GB.ini
com_moving/admin/language/es-ES/es-ES.ini

com_moving/site/language/en-GB/en-GB.ini
com_moving/site/language/es-ES/es-ES.ini

您可以在xml文件中看到这一点,因为有两种不同的语言声明,每种声明都指定一个文件夹。