2016-04-07 50 views
0

你好同事程序員。管理菜單中的Joomla組件標題不會被翻譯

我正在爲Joomla 2.5.6中的客戶開發一個組件。 我通過查看一些其他組件清單文件(和Joomlas自己的文檔)構建了我的清單XML文件。

我遇到的問題是在管理菜單中查看鏈接文本沒有得到翻譯,而是變成了「com-mycomponent」。 所以這看起來像是語言文件的問題。但是這裏出現了怪異的部分,當我點擊鏈接時它會打開頁面,但是當我在菜單中查看時,它現在顯示翻譯後的菜單項文本。

所以我的猜測是,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> 

回答

1

看看this page其中精心講解了如何使用語言文件,對管理員的菜單中,你需要一個.sys.ini語言文件:

Joomla!擴展名還必須指定使用的sys.ini文件

a。在擴展安裝期間,允許本地化安裝後的消息 b。構建管理員組件 菜單,c。本地化組件參數和菜單參數d。並在擴展管理器 - >管理中輸入 。

爲Joomla相關的問題,你可以使用joomla.stackexchange.com

+1

謝謝!肯定是菜鳥的錯誤。 很高興知道Joomla stackexchange網站。 –