How should I store/access localized UI strings in Sitecore?
I'm adding support for multiple language to my site. I've found many places in my renderers that have hard-coded strings I'll need to address.
I seem to have a couple different options of fixing this... one would be to use the standard .NET approach and store strings in a resource file. I'm not liking this because my Sitecore translators can't get to that... and also because I don't think Sitecore sets the Culture by default? Which I believe is how ASP.NET knows which language to use from the resource file.
Another option would be to add fields for all these strings in my Sitecore templates so they are visible to translators in Content Editor. But this seems like a huge hassle... there are many, many places where I would have to update my templates solely to开发者_StackOverflow store UI element strings.
Are there any other Sitecore-supported options? Suggestions? We are currently on v6.2.
I think you should probably have a look at using a Sitecore dictionary and/or token substitution. Not played with it myself, but I think it could do the work you need to do.
See page 12 of the reusing data guide.
http://sdn.sitecore.net/upload/sitecore6/sc62keywords/reusing_and_sharing_data_sc62_a4001.pdf
I imagine you could also play with explicitly setting the culture from the Sitecore language parameter and using it to access a .net resource file. The resource file itself could be produced by a Sitecore rendering of the Sitecore dictionary. That way you'd give editors and translators access to the strings to localise and use out of the box ASP.Net to bring them into your renderings.
精彩评论