Joomla -- find all translations of a menu item(Joomla -- 查找菜单项的所有翻译)
问题描述
我使用 Joomla 2.5 和 Language-Switcher 模块和插件来构建多语言网站.
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 都是唯一的,不可能为每个翻译的菜单项定义类似根"菜单项的内容.是否可以创建一个在菜单项创建表单中插入新按钮的插件?
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?
问候菲利普
推荐答案
成功了!搜索translations"并没有得到正确的结果,而是搜索associations"解决了这个问题.我在查看写入的 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 -- 查找菜单项的所有翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Joomla -- 查找菜单项的所有翻译
基础教程推荐
- 在PHP中根据W3C规范Unicode 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何替换eregi() 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
