Hi, I'm Rhys, and this is the second in our series of videos showing how to build a real extension for Telligent Community.
In this video we'll look at making the simple plugin we created in the previous version translatable.
It's good practice to make plugins translatable in Telligent Community (although not required), this means you should avoid hard coding strings in your plugins and widgets, and instead make use of the translation APIs which allows administrators to change the value of the strings, and translate them to different languages if required.
Making a plugin translatable is pretty simple and requires you to implement the ITranslatablePlugin interface.
This requires you to implement one property and one method. The method gives you access to the translation controller, we will need this when accessing text resources. Implementing this is simple, firstly we add a private variable to store the controller for when we need it, and then in the UpdateController method we set this variable. Several other plugin types in the Telligent platform use this pattern.
The property allows you to define the default translation values, and the resources that can be translated or edited.
We will add a new translation for the default language, en-US, and then define two resources, one called configuration, and one called template.
Then we can update the display text we set for the configuration properties, instead of hard coding the text for Configuration and Template, we use the translation controller to get our resource values. Make sure you only make the display text translatable and not the ids or keys that we use in the code.
When we rebuild and deploy our new version we can see a new Translation tab in the plugin management screen, we can use this to edit our resource values. If we save these and then open the plugin again we will see the new resource values.
In this video we've shown an overview of the translation APIs in Telligent. In the next video we will start integrating our plugin with the Rich Text Editor and be able to see some functionality in action!