registerMiddleware

Registers a middleware to the list of middlewares.

This method takes a KlarityMiddleware object as a parameter and adds it to the middlewares list. The KlarityMiddleware object should be an instance of a class that implements the KlarityMiddleware interface and provides methods for modifying the translation process, such as validating, filtering, transforming, or enriching the texts. The method throws an IllegalStateException if the middleware is already registered in the list. The method does not return anything.

Parameters

middleware

a KlarityMiddleware object representing the middleware to register.

Throws

if the middleware is already registered in the list.