vB5 Manual and API Documentation
Forums API Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Languages & Phrases

An Introduction to Languages and Phrases

vBulletin’s language system allows you to localize your site in languages other than US English without editing any templates or files. The vBulletin phrase system makes its templates language independent so you can display pages in multiple languages using a single style.

Each phrase (for example, “password” or “one hour ago”) can have a translation for every language specified in this Language Manager. When a channel page is loaded, vBulletin checks what language the current logged-in user has selected, looks up the phrase variables in that language, and replaces them with the appropriate translated text.

In addition to translated phrases, vBulletin’s language system supports translated images (by allowing you to override a style’s images folder setting), and language-specific date/time/number formats.

The topics in this section cover what you need to know to localize your vBulletin site.

The difference between a Language and Phrases

Within vBulletin, a language is a container that sets up the support of a different language. This includes options like right-to-left, the HTML Character Set, the PHP Locale, and any specific data and time formatting overrides.

Phrases are the individual strings of text that make up the user interface. Sometimes multiple phrases will be needed to create a specific output string. This is due to variations in how languages handle gender, numbers, and other specific rules that may come up.

The ‘Master Language’ and ‘Custom Master Language’

Regardless of any languages you enable as administrator (for example, Spanish or German) there are always two that always exist in vBulletin: the Master Language and the Custom Master Language. They are generally protected from being directly edited.

The Master Language is where all of vBulletin’s untranslated, default phrases exist. It is important to have the original version of all phrases available for reference purposes. You cannot directly edit these language phrases.

The Custom Master Language contains only custom phrases you have created, which can be accessed as if they were part of the Master Language.

Phrase Syntax

The many phrase variable names in vBulletin have their values stored as strings when vBulletin’s cached language data is generated or regenerated.

For example, the phrase variable show_all_users is stored as Show All Users, and additional_options is stored as Additional Options.

Sometimes the strings contain substitution variables that are not replaced with specific values until runtime.

For example, the phrase variable showing_avatars_x_to_y_of_z is stored as the following string with substitution variables {1}, {2}, and {3}:

Showing Avatars {1} to {2} of {3}

At runtime, the string might contain the values 10, 20, and 24 in place of {2}, and {3}:

Showing Avatars 10 to 20 of 24.

Suppose you wanted the output string to look like the following:

24 Avatars Total. Displaying 10 - 20.

You could accomplish that by changing the string to the following:

{3} Avatars Total. Displaying {1} - {2}.

As you can see, the order of the substitution variables can be changed. The important thing is that you reference the correct substitution variable number for the output variable you want.

Using Phrases in Templates

Phrases are generally straightforward to use in templates. Simple phrases (without any variable portions) can be referenced like regular $variables; complex phrases are referenced similarly to template conditionals. When referencing a phrase in a template, you need to know the following information:

  • The phrase name (phrase_name)
  • The phrase name is what uniquely identifies a phrase and how phrases are referenced. Generally, the phrase name reflects the phrase text directly; for example, the phrase with variable name poll_timeout has the text of Poll Timeout.

The phrase group

If the phrase is in a group, you can access it only on pages that load that group.

Using Phrases

To use a phrase in a template, you need to use the following constructs.

phrase - {vb:phrase phrase_name[, arguments for phrase...]} Inserts the specified phrase. If arguments are provided, they will be run through htmlspecialchars().

Example: {vb:phrase welcome}

rawphrase - {vb:rawphrase phrase_name[, arguments for phrase...]} Inserts the specified phrase, but arguments bypass htmlspecialchars().

Example: {vb:rawphrase message_by_x_on_y_at_z, {vb:link member, {vb:raw postinfo}}, {vb:raw postinfo.username}, {vb:raw postinfo.postdate}, {vb:raw postinfo.posttime}}

For more information about template syntax, see «».