sitecore: multi-lingual site

扶醉桌前 提交于 2019-12-11 14:56:23

问题


I'm working on a site that will support several languages. I create a template and a content item. Then I fill in the fields for language-specific versions of a content item. Thats OK.

I want to translate labels that go through the whole application. Let it be "More" label. I thought it is something about Dictionary and usage of Sitecore.Globalization.Translate.Text("More") but it doesn't work for pages with non-default language(provided I created a language-specific version of a dictionary item).

What is the correct solution?


回答1:


but it doesn't work for pages with non-default language(provided I created a language-specific version of a dictionary item)

Vitaliy,

Leveraging dictionary for this purpose is a proper way of doing it.

The Text method of Sitecore.Globalization.Translate class is supposed to respect the context language, so that should work.

public static string Text(string key)
{
    Assert.ArgumentNotNull(key, "key");
    return TextByLanguage(key, Context.Language);
}

Please file a ticket with tech support if that does not work for you.



来源:https://stackoverflow.com/questions/3672609/sitecore-multi-lingual-site

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!