Loading translation service classes from App_Code
Kentico EMS required
Features described on this page require the Kentico EMS license.
For translation services defined in the App_Code folder, you need to ensure that the system loads the appropriate class when calling the given service.
Open your Kentico project in Visual Studio.
Edit the App_Code class containing your translation service.
Add a using statement for the CMS namespace:
using CMS;
Add the RegisterCustomClass attribute above the class declaration.
[assembly: RegisterCustomClass("SampleMachineTS", typeof(SampleMachineTS))] [assembly: RegisterCustomClass("SampleTS", typeof(SampleTS))]
The RegisterCustomClass attribute registers custom classes and makes them available in the system. The attribute accepts two parameters:
- The first parameter is a string identifier representing the name of the class. The name must match the value of the Service provider - Class field specified for the given service in the system.
- The second parameter specifies the type of the class as a System.Type object. When a user requests the translation service, the attribute ensures that the system gets an instance of the appropriate class and executes its methods.
You can now create your translation services in the Translation services application using the specified App_Code classes.