You are here

function _facebook_comments_get_language_code in Facebook Comments Social Plugin 7

Same name and namespace in other branches
  1. 8 facebook_comments.module \_facebook_comments_get_language_code()

Returns a Language code format pt_PT. If the current language code is not in the conversion array it returns English as default language.

1 call to _facebook_comments_get_language_code()
facebook_comments_display in ./facebook_comments.module
Generate the output of a Facebook commenting plugin.

File

./facebook_comments.module, line 522
Facebook Comments Social Plugin module file.

Code

function _facebook_comments_get_language_code() {

  // Get global language.
  global $language;

  // Current language.
  $current_language = $language->language;

  // Get available languages.
  $language_codes = _facebook_comments_get_language_codes();
  $languages = array();

  // Get available language codes.
  if (array_key_exists($current_language, $language_codes)) {
    $languages = $language_codes[$current_language];
  }
  else {
    $languages = $language_codes['en'];
  }

  // Get the first elements key, for the available language codes.
  reset($languages);
  return key($languages);
}