Our Articles about the Web and Drupal

Views exposed filters and Internationalization, translating the "Any" value

Unless you've made a multi-lingual site before, you'd never believe all the small issues that come up, for example that the target language has a few different translations for a single English term.

In Drupal, its important for module developers to use the t() function so that text goes into Drupal's translation system. This is the most common source of translation frustrations.

Translating "Any" in a views exposed filter

Views lets you set exposed filters so that visitors can choose what kind of content they want to see. However you'll quickly find that the default selection "<Any>" is untranslatable.

Fortunately, its just that its not in a t() function. It would be easy to override this function to put the text into the t() function, but there is an even easier solution. There is an option for another value, "- Any -" which is in the t() function. You can find this option at SITENAME/admin/build/views/tools, down at the bottom.

Its called:

LABEL FOR "ANY" VALUE ON OPTIONAL 
SINGLE-SELECT EXPOSED FILTERS

Set this to "- Any -" and now it will be translatable.

Share this

Let's start talking about your project!

Let's start talking about your project!