You are here

function outdatedbrowser_get_language_file_path in Outdated Browser 7

Same name and namespace in other branches
  1. 8 outdatedbrowser.module \outdatedbrowser_get_language_file_path()

Gets the path of the appropriate language file of Outdated Browser plugin.

1 call to outdatedbrowser_get_language_file_path()
outdatedbrowser_page_build in ./outdatedbrowser.module
Implements hook_page_build().

File

./outdatedbrowser.module, line 138
Outdated Browser module file.

Code

function outdatedbrowser_get_language_file_path() {
  $result = '';
  $library_path = libraries_get_path('outdatedbrowser');
  $langfile_pattern = $library_path . "/outdatedbrowser/lang/%s.html";
  global $language;
  if (file_exists(drupal_realpath(sprintf($langfile_pattern, $language->language)))) {

    // A translation file for the active interface language was found.
    $result = sprintf($langfile_pattern, $language->language);
  }
  elseif (file_exists(drupal_realpath(sprintf($langfile_pattern, language_default('language'))))) {

    // A translation file for the default system language was found (fallback).
    $result = sprintf($langfile_pattern, language_default('language'));
  }
  elseif (file_exists(drupal_realpath(sprintf($langfile_pattern, 'en')))) {

    // An english translation file was found (second and last fallback method).
    $result = sprintf($langfile_pattern, 'en');
  }
  return $result;
}