Contributions API

l10n_client_init

Definition

l10n_client_init()
contributions/l10n_client/l10n_client.module, line 67

Description

Implementation of hook_init().

Code

<?php
function l10n_client_init() {
  global $conf, $language;
  
  if (user_access('use on-page translation')) {
    // Turn off the short string cache *in this request*, so we will
    // have an accurate picture of strings used to assemble the page.
    $conf['locale_cache_strings'] = 0;
    drupal_add_css(drupal_get_path('module', 'l10n_client') .'/l10n_client.css', 'module');
    // Add jquery cookie plugin -- this should actually belong in 
    // jstools (but hasn't been updated for HEAD)
    drupal_add_js(drupal_get_path('module', 'l10n_client') .'/jquery.hotkeys.js', 'module');
    drupal_add_js(drupal_get_path('module', 'l10n_client') .'/jquery.cookie.js', 'module');
    drupal_add_js(drupal_get_path('module', 'l10n_client') .'/l10n_client.js', 'module');
    // Add server address if we have a server set up. Otherwise add empty string.
    $server = variable_get('l10n_client_server', '');
    drupal_add_js(array('l10n_client_server' => $server ? $server .'/translate/remote/1.0/'. $language->language : ''), 'setting');
    // We use textareas to be able to edit long text, which need resizing.
    drupal_add_js('misc/textarea.js', 'module');
  }
}
?>