Joomla-查找菜单项的所有翻译 [英] Joomla -- find all translations of a menu item
问题描述
我正在将Joomla 2.5与语言切换器模块和插件一起使用来构建多语言站点.
I am using Joomla 2.5 with the Language-Switcher Module and Plugin to built an multilingual site.
主要问题是:切换语言始终会导致已翻译的主页,但不会导致已翻译的菜单项.因此,我遇到了查找菜单项的所有翻译的问题.
The main problem is: switching the language always leads to the translated homepage, but not to the translated menu-item., so I ran into the problem to find all translations of an Menu item.
基于内部结构,语言过滤器仅过滤具有适当语言设置的页面项目.因此,每个菜单项,链接或URL都是唯一的,并且不可能为每个翻译后的菜单项定义类似根"菜单项的内容.是否可以创建一个在menu-item-creation-form中插入新按钮的插件?
Based on the internal Structure, the Language-filter only filters the page items with suitable language settings. So each menu item, or link, or url is unique and it is not possible to define something like a 'root' menu item for every translated menu item. Is it possible to create a Plugin that inserts a new button in the menu-item-creation-form?
问候philipp
推荐答案
让它正常工作!搜索翻译"并没有得到正确的结果,而是搜索关联"解决了它.在查看com_menus文件的代码写入位置时,我找到了答案:
Got it Working! Searching for "translations" did not lead to proper results, instead searching for "associations" solved it. I found the answer while looking into code of the com_menus files where is written:
$associations = MenusHelper::getAssociations( $active->id );
仅此而已,我只需要通过以下方式注册MenusHelper类:
That's all, I just needed to register the MenusHelper class via:
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
这篇关于Joomla-查找菜单项的所有翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!