Web Oriented Object Framework

User Guide (Version 0.5b4)

Woof!
User Guide (Version 0.5b4)

Language-specific page templates

An application may optionally use different page section templates for different languages. This is supported by Woof! through an minor enhancement of the template location algorithm.

When a client sends an HTTP Accept-Language header indicating its language preferences, Woof! will modify its algorithm for locating templates by first checking for the existence of the appropriate template in a subdirectory whose name is the same as the language identifier and use that in preference if it exists.

In addition, the configuration variable app_default_language should be set to the language identifier corresponding to the template files in the standard location. By default, this is set to en.

Note that it is not required that every section or action have a language-specific template. You may choose to have specific templates in some cases and fall back to the default in others.

As an example, consider the following header from a client received in a request to action ACTION in controller CONTROLLER:

Accept-Language: fr,de;q=0.7,en;q=0.3

When looking for the header page section, Woof! will look for the file CONTROLLER-ACTION-header.wtf in order

under the controller directory.

On the other hand, if the client preference was as per the following header:

Accept-Language: fr,de;q=0.3,en;q=0.7

where en has a higher priority over de, the search order would be

Note here that not only has the en subdirectory moved above the de directory, but that the default directory is also moved up. This is because the app_default_language configuration setting has a value of en by default, and hence the default directory is treated as though it has the priority associated with en.