Localization: helper tool for converting strings to resources

We recently anounced that finally the whole Sense/Net ECMS is internationalized: all visible texts are easily localizable. All our core content types, portlets and views contain only string resource keys instead of hard-coded English texts. To achieve this, we created a couple of internal helper tools to extract hard-coded strings and replace them with string resource keys. We did not release these tools with the official community release of Sense/Net 6.2. These tools are experimental, but we have decided to publish one of them to make localizing your existing content a bit easier.

Resource converter was created to extract strings from text files of the following types:

 

  • content type definitions (CTDs)
  • portlet classes: portlet names
  • portlet classes: property titles and descriptions

The tool is extendable, you can create your own converter plugins that make your localization process faster. For example you may create converters for ASCX controls, page templates or any kind of text file. The tool works in the file system so you need to have your files in a local folder instead of the repository. The files need to be writable if you plan to execute the tool with the "Update source files" option enabled, so if you are using a version control system, make sure that the files are checked out and writable.

Usage

As you can see on the screenshot below, you only need to drag a folder or a single file onto the tool, choose a converter and set the language code. You may execute the tool without updating the source files first. The result is a log file containing the files the tool will modify and the generated resource xml content (copied to the clipboard, ready to paste).

 

 

 

This is how the Car content type definition file looks like before conversion:

 

 

After converting the CTD:

 

 

You can see that all display names and descriptions, and even the choice options are converted to resources. The generated resource content is on your clipboard ready to use: you can paste it onto a new xml file and upload it to the portal as a Resource content.

Please note that the tool was used and tested only on our core files. It is advisable to back up your files before you try to convert them with the tool.

Download (source code): Resource converter tool zip

Custom converters

To create your custom converter, you only have to implement the IResourceConverter interface in the package above, and modify the Program.cs source file to load your custom type too.

Pingbacks and trackbacks (2)+

Comments are closed

Welcome to the blog!

Sense/Net ECM is ever evolving. Community means the world to us so we want to keep you apprised on what’s happening on our side of the woods. Want to make us happy? Add a comment and tell us what you think!

Month List