开发者

JText::_ not working

开发者 https://www.devze.com 2023-03-17 21:49 出处:网络
There\'s the thing: I have created complete Joomla1.5 component, added language ini file for JText::_ translation, it gets loaded during installation, but translation doesn\'t work.

There's the thing: I have created complete Joomla1.5 component, added language ini file for JText::_ translation, it gets loaded during installation, but translation doesn't work.

Here's the language part of xml manifest file (it is supposed to work only in the admin):

<administration>
  (...)     
  <languages folder="admin/language">
    <language tag="pl-PL">pl开发者_运维百科-PL.com_COMPONENTNAME.ini</language>
  </languages>

</administration>

file pl-PL.com_COMPONENTNAME.ini resides in admin/language/ in the installation pack, after installation it's loaded to the administrator/language/ folder, but JText::_() method doesn't seem to read it.

I tried JFactory::getLanguage()->load('com_COMPONENTNAME'), no effect tho.

Here's part of the ini file (I tried both with and without double quotes):

# $Id: pl-PL.com_COMPONENTNAME.ini
# author

AGENTS="Agenci"
AGENT="Agent"


I know, 5 years too late... but finally an answer. ;)

You are missing the lang subfolder. Correct would be:

 <languages folder="administrator/language">
    <language tag="pl-PL">pl-PL/pl-PL.com_yourcomponentname.ini</language>
  </languages>

Joomla Language Management

You can also use local language files without adding them to the manifest: https://docs.joomla.org/Specification_of_language_files

0

精彩评论

暂无评论...
验证码 换一张
取 消