You are here

function clientside_validation_libraries_add_locale in Clientside Validation 7.2

Load the localization file to show the messages in the current language.

1 string reference to 'clientside_validation_libraries_add_locale'
clientside_validation_libraries_info in ./clientside_validation.module
Implements hook_libraries_info().

File

./clientside_validation.module, line 140
Add client side validation to forms.

Code

function clientside_validation_libraries_add_locale(&$library) {

  // Get the current language.
  global $language;
  $path = 'dist/localization/messages_' . $language->language . '.js';

  // Check if we do not use English and there is a translation.
  if ($language->language != 'en' && file_exists($library['library path'] . '/' . $path)) {

    // Add the localized language to the files.
    $library['files']['js'][] = $path;
  }
}