Localizing resources in custom skin layouts

Overview

To streamline the localization of skin layouts, developers may want to use a script that can pull localized strings directly into a page. This is helpful in avoiding the need to create a separate translated page for each language. 

Requirements: Knowledge of creating themes for DNN

For Static strings:

To localize static strings in a custom skin, the simplest method is to make use of the DNN Text Skin Object. This approach will simply output the value of the static string to the page. For example, if there's text next to a login object that says, “Welcome," then this method will be sufficient for localization.

For Dynamic strings:

If a developer wants to localize a string for a dynamic value such as <input ... placeholder="LOCALIZEME"> then the following back-end code will need to be added to the skin to populate the value LOCALIZEME:

<%= Localization.GetString("LOCALIZEME", PortalSettings.ActiveTab.SkinPath + Localization.LocalResourceDirectory + "/" + layoutName) %>

NOTE: This code may require the addition of the full namespaces of the objects. It can also be turned into a function if the custom skin has a backend (ascx.cs) file.

Comments

1 comment

Please sign in to leave a comment.