You are here

function yashare_get_language in Yandex.Share 7.2

Same name and namespace in other branches
  1. 7 yashare.inc \yashare_get_language()

Returns selected language or protected language for API.

2 calls to yashare_get_language()
yashare_admin_settings in ./yashare.admin.inc
Returns settings form.
yashare_element_info in ./yashare.module
Implements hook_element_info().

File

./yashare.inc, line 170
Helper functions for the Yandex.Share module.

Code

function yashare_get_language($protect = FALSE) {
  $lang = variable_get('yashare_l10n', 'auto');
  if (!$protect) {
    return $lang;
  }
  $langs = yashare_get_languages();
  if ($lang == 'auto') {
    global $language;
    $lang = $language->language;
    if (!array_key_exists($lang, $langs)) {
      $lang = 'ru';
    }
  }
  return $lang;
}