Lazy evaluation is an evaluation strategy that delays the evaluation of an expression until its value is needed; that is, it is a call-by-need mechanism. In our application, there can be several instances of texts that are evaluated later while rendering the template. This usually happens when we have texts that are marked as translatable outside the request context, so we defer the evaluation of these until they are actually needed.
Implementing lazy evaluation and the gettext/ngettext functions
Getting ready
Let's start with the application from the previous recipe. Now, we want the labels in the product and category creation forms to show the translated values.