简体   繁体   English

使用Umbraco实现多语言功能的几个问题?

[英]Several questions to implement multi lingual functionality with Umbraco?

I'm struggling to implement the multilingual functionality in Umbraco CMS version 7.5, currently i see 2 possible solutions: 我正在努力在Umbraco CMS版本7.5中实现多语言功能,目前我看到2种可能的解决方案:

1- Use only one root path 1-仅使用一个根路径

I think the best package as a complement for this solution is "Vorto", all I have to do is create new data types which extends the vorto data types and I can start edit texts directly on document types. 我认为,作为该解决方案的补充的最佳软件包是“ Vorto”,我要做的就是创建新的数据类型,以扩展vorto数据类型,并且我可以直接在文档类型上开始编辑文本。

2- Use multiple root path 2-使用多个根路径

The idea is to duplicate the main root path for each language. 这个想法是为每种语言复制主要的根路径。

-> I followed a lot of tutorials on the web but they all relate on previous versions of Umbraco and the solutions i found seem not working with the current version... Once i duplicate the root path and i associate the language to the root folder, what's the next step ? ->我在网上浏览了很多教程,但是它们都与Umbraco的先前版本有关,我发现的解决方案似乎不适用于当前版本...一旦我复制了根路径并将语言与根文件夹相关联下一步是什么?

I have a few more questions: 我还有几个问题:

  1. Do you have a better solution than the 2 on top ? 您是否有比顶部2个更好的解决方案?
  2. How Umbraco knows the client language ? Umbraco如何了解客户语言? Does it take the first language in the header "Accept-language" in the HTTP request ? 它是否在HTTP请求的标题“ Accept-language”中采用第一语言?
  3. How could i extend the default routing to add the language as the first part, for example: http://domainName.ext/language/ .... 我如何扩展默认路由以将语言添加为第一部分,例如: http://domainName.ext/language/ ...。

Thank you by advance ! 预先感谢您!

Both scenarios have their pros and cons and both are widely used in the Umbraco community / solutions. 两种情况都有其优点和缺点,并且都在Umbraco社区/解决方案中广泛使用。 I prefer 2nd solution, as especially on larger sites it gives you ability to restrict access for different language editors for example and not each site has a requirement to be 1-1 content structured. 我更喜欢第二种解决方案,因为特别是在较大的站点上,它使您能够限制例如不同语言编辑器的访问,并且并非每个站点都必须具有1-1内容结构。

There is an Umbraco TV episode covering this topic here: https://umbraco.tv/videos/umbraco-v7/implementor/multi-lingual/creating-a-multi-lingual-site/introduction/ . 这里有一个覆盖此主题的Umbraco电视剧集: https : //umbraco.tv/videos/umbraco-v7/implementor/multi-lingual/creating-a-multi-lingual-site/introduction/

In summary: 综上所述:

  • you need to create copy of your root language node 您需要创建根语言节点的副本
  • then setup the culture for it 然后为它建立文化
  • use dictionary items to translate static content for each language 使用字典项翻译每种语言的静态内容
  • create simple language picker choosing related site or just redirecting to selected language root 创建简单的语言选择器,选择相关站点或仅重定向到所选语言的根目录

Regarding your questions: 关于您的问题:

Ad.1. Ad.1。 I don't have :) 我没有:)

Ad.2. Ad.2。 It's selecting culture set up on the node(s), so it may be forced. 它正在选择在节点上设置的区域性,因此可能会被强制执行。 Other than that it use standard .NET culture detection, so yes - it's using "accept-language" headers. 除此之外,它使用标准的.NET文化检测,所以可以-它使用的是“ accept-language”标头。

Ad.3. Ad.3。 There is a key "umbracoHideTopLevelNodeFromPath" which enables you to include top level roots in the url paths. 有一个关键的“ umbracoHideTopLevelNodeFromPath”,它使您可以在URL路径中包括顶级根。 Read more: https://our.umbraco.org/documentation/reference/config/webconfig/ 了解更多: https : //our.umbraco.org/documentation/reference/config/webconfig/

And still, if you prefer to go with option 1, there is an awesome article about it with example code as well: http://24days.in/umbraco/2015/multilingual-vorto-nested-content/ . 而且,如果您喜欢使用选项1,还有一篇很棒的文章以及示例代码: http : //24days.in/umbraco/2015/multilingual-vorto-nested-content/ I will be playing with it now too! 我现在也会玩它! :) :)

Well, the easiest way for option 2 to work would be to make a tree structure like this: 好吧,选项2起作用的最简单方法是制作一个像这样的树结构:

Root

  • LanguageA LanguageA
  • LanguageB LanguageB

If you want the domain.ext/language/ URL, set the domain.ext on the Root node and set the language on each of the Language Nodes. 如果需要domain.ext / language / URL,请在“根”节点上设置domain.ext,并在每个“语言”节点上设置语言。 You can also set both domain and language on each of the language nodes to get (for instance) domainname.com for one and domainname.net for the other. 您还可以在每个语言节点上同时设置域和语言,以获取(例如)一个域的domainname.com和另一个域的domainname.net。

This way of doing it shouldn't have changed lately. 这种方式最近应该不会改变。

With regards to you first point, there IS another way coming, but not for a while. 关于您的第一点,还有另一种方式来了,但是暂时没有。 Umbraco 8 (due Q1 2017) will support the concept of page variants, which means you can have a single tree and then a variant for each different language, negating the need for stuff like Vorto. Umbraco 8(将于2017年第一季度发布)将支持页面变体的概念,这意味着您可以拥有一棵树,然后为每种不同的语言提供变体,从而无需使用Vorto之类的东西。

It's still early days though, so we'll have to wait and see how well the feature works! 虽然还处于初期,所以我们必须等待,看看该功能的效果如何!

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

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