0

我正在开发我的第一个 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>

当我转到扩展 > 扩展管理器 > 发现时,我没有得到刚刚得到“COM_MOVING”的组件名称,为什么?我做错了什么?

4

1 回答 1

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 文件中看到这一点,其中有两种不同的语言声明,并且每个声明都指定一个文件夹。

于 2013-03-04T07:05:26.627 回答