简体   繁体   English

在国家/地区代码前面加上pathauto结构

[英]Prefixing the pathauto structure with a country code

My client wants their site to be localised, so that example.com/uk presents the uk version, example.com/aus would be the australian version etc etc. However, I want the actual content, and the nodes delivered, to remain and the basic path structure to not change- just prefixed with the country code. 我的客户希望本地化他们的网站,以便example.com/uk呈现英国版本,example.com / aus将是澳大利亚版本,等等。但是,我希望保留实际内容和交付的节点,不变的基本路径结构-仅以国家/地区代码为前缀。 Of course I want a 'switch country' button, automatic redirections based on geoIP etc, but for now I just want to focus on the path structure. 当然,我需要一个“切换国家/地区”按钮,基于geoIP的自动重定向等功能,但是现在我只想关注路径结构。 However, I still want the country selected to be available within views, content types, template files etc, so that uk/products/chairs and aus/products/chairs will still be aliases of node/1 but will then be supplied with a session/cookie/variable set as 'uk' or 'aus'. 但是,我仍然希望所选国家/地区在视图,内容类型,模板文件等中可用,因此uk / products / chairs和aus / products / chairs仍将是node / 1的别名,但将在会话中提供/ cookie /变量设置为“ uk”或“ aus”。

Does anyone know any way of doing this please? 有谁知道这样做的任何方式吗? Google hasn't really supplied much knowledge :/ Google并没有真正提供很多知识:/

Many fanks! 很多粉丝! :) :)

If you're on Drupal 7, just go to admin/config/regional/language and click "edit" for each language which will allow you to set the "Path prefix language code." 如果您使用的是Drupal 7,只需转到admin / config / regional / language,然后为每种语言单击“编辑”,即可设置“路径前缀语言代码”。 This will append the phrase of your choosing after the domain and before the Drupal path just as you requested. 这将按照您的要求在域之后和Drupal路径之前添加您选择的短语。

The "Switch country" button can be found on the Blocks page as the "Language switcher" block. 可以在“块”页面上将“切换国家/地区”按钮作为“语言切换器”块。

As for uk/products/chairs and aus/products/chairs, so long as one is a translation of the other (using the built-in locale module and possibly the internationalization module , you shouldn't have any problems. 至于uk / products / chairs和aus / products / chairs,只要其中一个是另一种的翻译(使用内置的语言环境模块,可能还使用国际化模块 ,则应该没有任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM