本地化和方言

发布于 2024-12-26 02:53:42 字数 239 浏览 3 评论 0原文

我阅读了各种关于设计网站的综合讨论,不仅针对多语言场景,而且支持针对特定社区的词汇和语法本地化;例如,技术社区与普通公共社区。

我发现这些讨论很引人注目,但它们没有解释如何在 C1 上下文中实现这些场景以添加不同的“方言”。

我猜测这些方言应该手动添加到以下数据源文件中,并像语言一样对待:“Composite.Cultures.en-us”。

请解释是否有处理上述场景的最佳实践,以及是否有更少手动的方法来实现它。

I read various Composite discussions regarding designing websites not only for multilingual scenarios but also to support localizing volcabulary and grammar for a specific community; for example, technical vs. general public communities.

I found these discussions compelling however they didn't explain how to implement these scenarios in the context of C1 for adding different "dialects".

I am guessing that these dialects should be manually added to the following data source file and treated like a language: "Composite.Cultures.en-us".

Please explain if there is a best-practice for handling the above scenario and if there is a less manual method for achieving it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小矜持 2025-01-02 02:53:42

如果您想在相同的页面结构中针对不同的“方言”显示不同的内容,那么是的 - 将它们视为语言是有意义的。
系统从 Windows 注册表中获取语言列表,因此如果您想添加一种方言作为语言,您可以使用一些代码将其注册( http://msdn.microsoft.com/en-us/library/ms172469.aspx )。但我不推荐这样做,因为相关的 ASP.NET 进程必须能够访问 Windows 注册表,并且每次需要将站点移动到新环境时都可能需要一些额外的工作。
您还可以使用不打算用作方言切换器 Fe en-US / en-GB / en-AU 的现有区域性代码。

另一种选择是为每个页面上的内容设置单独的占位符,一个用于技术用户,另一个用于非技术用户。将根据 url/cookie 显示其中之一。在这种方法中,您还必须决定是否要将它们保留在爬虫的相同网址下或不同的网址下,页面应该具有相同的注释还是单独的等等。

如果方言网站不保持相同的页面结构,您还可以决定将它们作为不同的页面树,并在需要时使用某种元数据字段将相关页面链接到另一个页面。

If you want to show different content with in the same page structure for different "dialects", then yes - treating them as languages make sense.
The list of languages is fetched by the system from Windows registry, so if you want to add a dialect as a language, you can register it in with some code ( http://msdn.microsoft.com/en-us/library/ms172469.aspx ). I wouldn't recommend it though, as the related ASP.NET process would have to have access to windows registry, and there may be some additional work each time you need to move the site to a new environment.
You can also use an existing culture code that you aren't going to use as a dialect switcher F.e. en-US / en-GB / en-AU.

Another alternative would be to have separate placeholders for content on each page, one for technical users and one more for non-technical. One or another will be shown depending on url/cookie. In this approach you also you have to decide if if you want to keep them under the same url for crawlers or under different, should pages have the same comments or separate, etc.

If dialect sites aren't keeping the same page structure, you may also decide to have them as different page trees, and use some kind of a meta data field to link related pages one to another when you need to.

春庭雪 2025-01-02 02:53:42

我不确定我是否理解这个问题。是否因为您希望前端网站上的某个字符串根据登录者而不是网站显示的语言来表达不同的内容?

C1 中的默认本地化文件位于 ~/Composite/localization 中,格式为 Some.Namespace.language.xml。这意味着,如果您的网站采用美式英语,但您想要显示 Techs 或 Others 的某些字符串的不同版本,则可以创建以下 xml 文件

  • My.Component.General.en-us.xml
  • My.Component。 Technical.en-us.xml

当您需要显示字符串时,您将有以下逻辑

var ns = "My.Component";
var mode = is_tech ? "Technical" : "General";

return StringResourceSystemFacade.GetString(ns +"."+ mode, "title");

Im not sure if i understand the question. Is it because you want to have a certain string on your frontend website to say different things depending on who is logged in, and not in which language the site is being shown?

Default localization-files in C1 is located in ~/Composite/localization in the format Some.Namespace.language.xml. This means, that if your site is in American English, but you want to show different versions of certain strings for Techs or Others, you could create the following xml-files

  • My.Component.General.en-us.xml
  • My.Component.Technical.en-us.xml

And when you need to get strings to show, you would have the following logic

var ns = "My.Component";
var mode = is_tech ? "Technical" : "General";

return StringResourceSystemFacade.GetString(ns +"."+ mode, "title");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文