管理菜单中的 Joomla 组件标题未被翻译
Joomla component title in admin menu doesn't get translated
各位程序员大家好。
我正在 Joomla 2.5.6 中为客户开发一个组件。
我通过查看其他一些组件清单文件(和 Joomlas 自己的文档)构建了清单 XML 文件。
我遇到的问题是,在管理菜单中查看时,link 文本没有得到翻译,而是变成了 "com-mycomponent"。
所以这看起来像是语言文件的问题。但奇怪的部分来了,当我点击 link 时,它打开了页面,但当我查看菜单时,它现在显示翻译后的菜单项文本。
所以我的猜测是 Joomla 仅在使用该组件时加载语言文件,这是有道理的。
但是如何让 Joomla 在不使用该组件时翻译菜单项。
这是我的 mycomponent.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5.0" method="upgrade">
<name>My Component</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>April 2016</creationDate>
<author>My name</author>
<authorEmail>My email</authorEmail>
<authorUrl>http://www.mywebsite.com</authorUrl>
<copyright>Copyright My company</copyright>
<license>N/A</license>
<!-- The version string is recorded in the components table -->
<version>1.0.0</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Hello World component ...</description>
<media destination="com_mycomponent" folder="media">
<folder>icons</folder>
</media>
<administration>
<!-- Administration Menu Section -->
<menu link="option=com_mycomponent" img="../media/com_mycomponent/icons/dollar-iconx16.png" view="queue">COM_MYCOMPONENT</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>com_mycomponent.php</filename>
<filename>controller.php</filename>
<folder>controllers</folder>
<folder>views</folder>
<folder>language</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB/en-GB.com_mycomponent.ini</language>
<language tag="da-DK">language/da-DK/da-DK.com_mycomponent.ini</language>
</languages>
</administration>
</extension>
看看 this page 那里详细解释了如何使用语言文件,对于管理员菜单,您需要一个 .sys.ini 语言文件:
Joomla! extension's must also specify a sys.ini file which is used
a. during the extension's installation, to allow localising the
post-installation messages,
b. to build the administrator Components
menu, c. to localise component parameters and menu parameters d. and
in the Extension Manager->Manage.
对于 joomla 相关的问题,您可以使用 joomla.stackexchange.com
各位程序员大家好。
我正在 Joomla 2.5.6 中为客户开发一个组件。 我通过查看其他一些组件清单文件(和 Joomlas 自己的文档)构建了清单 XML 文件。
我遇到的问题是,在管理菜单中查看时,link 文本没有得到翻译,而是变成了 "com-mycomponent"。 所以这看起来像是语言文件的问题。但奇怪的部分来了,当我点击 link 时,它打开了页面,但当我查看菜单时,它现在显示翻译后的菜单项文本。
所以我的猜测是 Joomla 仅在使用该组件时加载语言文件,这是有道理的。
但是如何让 Joomla 在不使用该组件时翻译菜单项。
这是我的 mycomponent.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5.0" method="upgrade">
<name>My Component</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>April 2016</creationDate>
<author>My name</author>
<authorEmail>My email</authorEmail>
<authorUrl>http://www.mywebsite.com</authorUrl>
<copyright>Copyright My company</copyright>
<license>N/A</license>
<!-- The version string is recorded in the components table -->
<version>1.0.0</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Hello World component ...</description>
<media destination="com_mycomponent" folder="media">
<folder>icons</folder>
</media>
<administration>
<!-- Administration Menu Section -->
<menu link="option=com_mycomponent" img="../media/com_mycomponent/icons/dollar-iconx16.png" view="queue">COM_MYCOMPONENT</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>com_mycomponent.php</filename>
<filename>controller.php</filename>
<folder>controllers</folder>
<folder>views</folder>
<folder>language</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB/en-GB.com_mycomponent.ini</language>
<language tag="da-DK">language/da-DK/da-DK.com_mycomponent.ini</language>
</languages>
</administration>
</extension>
看看 this page 那里详细解释了如何使用语言文件,对于管理员菜单,您需要一个 .sys.ini 语言文件:
Joomla! extension's must also specify a sys.ini file which is used
a. during the extension's installation, to allow localising the post-installation messages, b. to build the administrator Components menu, c. to localise component parameters and menu parameters d. and in the Extension Manager->Manage.
对于 joomla 相关的问题,您可以使用 joomla.stackexchange.com