Multilingual Business Rule Messages are very important because the rule implementation must provide feedback to the user in the way they understand (i.e., in their own language and terminologies). Also, it is important in system development that the logic of the business rules is not compromised during language translation. If the logic is different for a particular region or country, that is not limited to the feedback messaging language/translation and may be interpreted as a totally different rule.

In FlexRule there is a rich functionality for sending feedback to the user or for calling an application named Notification. Notification can be used throughout the system to collect and format the feedback from executing rules, then organising them into logical groups and sending them back to the caller of the rule, user or application.

In the Notification component, when a message is being retrieved, depending on the current setting of the system (Culture), the proper translation will be picked automatically. Then it will be formatted and send back to the caller.

For instance in the following example, depending on the selected language, the engine would pick the proper translation of a message and format it to be sent to the UI (User Interface):

Default (English) translation of rule

There is an opportunity to register a default language and then our business rule framework allows you to override that for different languages. For example in this instance we select the “Farsi” language:

Overridden (Farsi) translation of rule


External Multilingual Messages

To register your language, you can simply add a language resource file to your solution and register it in your application.
Language resources for rules translation
Or alternatively you can load them dynamically and register them with the same method.

Registration is just matter of calling a single method named “Register” for each language/culture:

private void SetupLocalisation(ExecutorSetupInformation setup)
// registering default messaging for all cultures
// passing null for culture parameter defaults this translation for all cultures
setup.MultilingualMessages.Register(Language_en.ResourceManager, null);

// override the culture specific messaging
// List of language translation overrides
setup.MultilingualMessages.Register(Language_fa.ResourceManager, CultureInfo.GetCultureInfo("fa"));
setup.MultilingualMessages.Register(Language_en.ResourceManager, CultureInfo.GetCultureInfo("en"));
setup.MultilingualMessages.Register(Language_fr.ResourceManager, CultureInfo.GetCultureInfo("fr"));

For more detailed information have a look at the “Samples\Validation\FlexRule.Samples.LocalisedPersonValidator” sample application for FlexRule Runtime v4.4.

In this example, we embedded the messages as part of the application resources, which means your application manages the loading of different message translations. This allows you to read them from any other data source (e.g., database) and register them as a dictionary.

Last updated December 15th, 2020 at 08:06 am, Published June 17th, 2014 at 08:06 am