{aalang}

Description

Returns the two-letter code of the language the current page is being rendered in (for example cz, en, es) - lowercased, from the AA language state. It takes no parameters. When no page language is set it falls back to the first two letters of the install default language. Unlike xlang, aalang always returns a valid code, not only inside the Site module, which makes it the reliable way to branch templates, labels and URLs by language. The value is runtime state and changes with the rendering context, so the same call yields a different code on a page served in another language.

Examples

virtual{aalang}
Expecteden or cz or es ... (the current rendering language)
Actualen
Returns the two-letter code of the language the page is currently rendered in. The value is runtime state, not fixed by the template: it is cz when the page renders in Czech, en in English, es in Spanish, and so on. Marked illustrative because the output depends on the rendering context.
test{strlen:{aalang}}
Expected2
Actual2
Whatever the current language, aalang is always a two-letter lowercase code, so its length is always 2. This makes a length check a stable, context-independent test.
virtual{ifeq:{aalang}:en:Contact:cz:Kontakt:Kontakt}
ExpectedContact (en) or Kontakt (cz); fallback Kontakt
ActualContact
The most common real-world use: feed aalang into ifeq to pick a label per language. In an English context the result is Contact, in a Czech context Kontakt; the last value is the fallback. Illustrative because the chosen branch depends on the current language.
virtual{ifeq:{aalang}:cz:Ano:Ne}
ExpectedAno (cz) or Ne (any other language)
ActualNe
A two-value switch: when the current language is cz the first value is used, otherwise the second. Returns Ano in a Czech context and Ne in any other. Illustrative because the result depends on the current language.
virtualkontakt/{aalang}/index.html
Expectedkontakt/en/index.html or kontakt/cz/index.html ... (current language)
Actualkontakt/en/index.html
Because aalang is plain text, you can drop it straight into a path or query string to build language-specific links. The path segment becomes the current language code, for example kontakt/en/index.html or kontakt/cz/index.html. Illustrative because the code inserted depends on the current language.
test{ifeq:{aalang}:de:de:cs}
Expectedcs
Actualcs
A pattern taken from production: map the AA language code to the value an HTML lang attribute expects. Czech content is served as German only when the language is de, otherwise as cs. The current language is cz, which is not de, so the result is cs.