Localization Macros in Page Template Layouts in Kentico 8

Kentico has some powerful localization features that i have not had the opportunity to use much during my time at BizStream. However in a recent project there were two languages and we were looking to embed localized strings into the layouts of our page templates.

With a little help from my friendly neighborhood MVP, and some updating to the new API in Kentico 8, I created the proper macro to get the values out of Kentico and into my page layout.

Creating the string itself itself is simple. Open the admin page and go into Configuration > Localization. Add a new string into Kentico. This is the string that will be translated on the page template.

Picture of creating a new localization string

Once you’ve created the string, use the following macro in the page template to place the proper translation of the string in the template. Note that for this macro there can not be spaces between the macro brackets and your string’s key. This will break the macro.

<%= ResHelper.LocalizeString("{$GetStarted$}") %>

Written on November 7th, 2014 by Dan Walker

Want to read more?

If you’ve enjoyed what you’ve seen so far, you might like some of my other posts. Visit the archive to see all of my past writings.

Blog Archive »
 

About the Author

Dan Walker is a programmer from Grand Rapids, MI. He works at Gordon Food Service.

More About Dan »

Get in touch