Getting a blog language (site “lang_id” field vs the WPLANG setting)

I don’t know what the lang_id option is for. AFAIK it is not part of the core WordPress options.

If you want to check the language of all blogs you could check the blog’s own options table for WPLANG, or use the network’s WPLANG option (or fail with a locale you need) in a similar way as WordPress’ own get_locale() function.

I’d recommend to check out the WordPress source code. You’ll see that the get_bloginfo() function is basically a wrapper for getting options or calling other functions to retrieve the requested data. In the case of the ‘language’ parameter it calls the get_locale() function which resides in wp-includes/l10n.php

See:
http://phpxref.ftwr.co.uk/wordpress/nav.html?_functions/index.html

Looking at the get_locale() function it shows that in order to retrieve the locale/language of a site in a WordPress multisite setup it will:

  1. Check if the locale was set and return this after applying the ‘locale’ filter

  2. If the locale variable was not set it will check the WPLANG option in the WordPress default (per-site) options.

  3. If the site’s own WPLANG option is empty or does not exists it will check the network’s options for the WPLANG option.

  4. If all fails assume the locale is en_US

Leave a Comment