[英]Joomla language switcher override
I'm trying to force the language swither module not to redirect to the home page if there is no menu item associations in Joomla 2.5. 如果Joomla 2.5中没有菜单项关联,我试图强制语言切换模块不要重定向到主页。 I would just like to change country code in the current URL. 我只想更改当前URL中的国家/地区代码。
So that 'my-domain.com/ en /menu?view=cat&id=1' translate to: 'my-domain.com/ de /menu?view=cat&id=1' and so on ... 这样'my-domain.com/ zh / menu?view = cat&id = 1'转换为:'my-domain.com/ de / menu?view = cat&id = 1'等,依此类推...
I guess I should modify modLanguagesHelper class but do not know how to create a required $language->link to work properly through JRoute. 我想我应该修改modLanguagesHelper类,但不知道如何创建必需的$ language-> link才能通过JRoute正常工作。
Any help is appreciated! 任何帮助表示赞赏!
Joomla usually does that by default. Joomla通常默认情况下会这样做。 It seems strange that it doesn't with the approach you have followed. 奇怪的是,它与您所采用的方法不同。
Although, reading the comments you left, I understand it's not an easy task and you have already built quite a big part of the website, to go back to structure. 尽管阅读您留下的评论,但我知道这不是一件容易的事,并且您已经建立了网站的很大一部分,以恢复结构。
If I were you, I would write a small custom module to change the lang=xx or /xx/ in the URL, and redirect the user to the language they want. 如果您是我,我会写一个小的自定义模块来更改URL中的lang = xx或/ xx /,并将用户重定向到他们想要的语言。 If you need help on that, feel free to comment below. 如果您需要帮助,请在下面发表评论。
As per your question, I would personally go with simple string manipulation. 根据您的问题,我个人会进行简单的字符串操作。 Since you are really familiar with PHP (taking into consideration that you have written your own custom component), it should be a piece of cake for you, to: 由于您真的很熟悉PHP(考虑到您已经编写了自己的自定义组件),因此,对于您来说,这应该是小菜一碟:
It's not the suggested scenario, but you can really make a usable module if you also add: 这不是建议的方案,但是如果您还添加以下内容,则可以真正创建一个可用的模块:
And make sure that you get the site name dynamically, and then you may also have a module that could be published in the JED to help others in the same situation like you! 并确保您动态获取站点名称,然后您可能还会有一个模块可以在JED中发布,以帮助处于类似情况的其他人!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.