Quickest and least expensive way to retrieve URL segment

I would like to check a url segment (in this case whether the site is
/en/ or /zh/) so I can display content based on language.

In Radiant what is the quickest and least expensive way to do this?

Thanks!

The <r:if_url> and <r:unless_url> tags probably provide what you need.
Give the tags a ‘matches’ attribute that contains a regular expression.
Here’s an example:

<r:if_url matches="^/en/"><r:content part=“body_en” /></r:if_url>

That would output the “body_en” part if the beginning of the URL matches
/en/.

Sean

Sean C. wrote:

The <r:if_url> and <r:unless_url> tags probably provide what you need.
Give the tags a ‘matches’ attribute that contains a regular expression.
Here’s an example:

<r:if_url matches="^/en/"><r:content part=“body_en” /></r:if_url>

That would output the “body_en” part if the beginning of the URL matches
/en/.

Sean

Doh. That was sitting right in front of my face. Thanks for the quick
reply, Sean!

-R