You are here

function _l10n_client_page_strings in Localization client 6

Same name and namespace in other branches
  1. 5 l10n_client.module \_l10n_client_page_strings()
  2. 6.2 l10n_client.module \_l10n_client_page_strings()
  3. 7 l10n_client.module \_l10n_client_page_strings()

Get the strings to translate for this page.

These will be:

  • The ones added through l10n_client_add_string_to_page() by this or other modules.
  • The strings stored by the locale function (not for for this module's own pages).
1 call to _l10n_client_page_strings()
l10n_client_footer in ./l10n_client.module
Implementation of hook_footer().

File

./l10n_client.module, line 287
Localization client. Provides on-page translation editing.

Code

function _l10n_client_page_strings() {
  global $language;

  // Get the page strings stored by this or other modules.
  $strings = l10_client_add_string_to_page();

  // If this is not the module's translation page, merge all strings used on the page.
  if (arg(0) != 'locale' && is_array($locale = locale()) && isset($locale[$language->language])) {
    $strings += array(
      'default' => array(),
    );
    $strings['default'] = array_merge($strings['default'], $locale[$language->language]);

    // Also select and add other strings for this path. Other users may have run
    // into these strings for the same page. This might be useful in some cases
    // but will not work reliably in all cases, since strings might have been
    // found on completely different paths first, or on a slightly different
    // path.
    $result = db_query("SELECT s.source, t.translation, s.textgroup FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = '%s' WHERE s.location = '%s'", $language->language, request_uri());
    while ($data = db_fetch_object($result)) {
      if (!array_key_exists($data->source, $strings[$data->textgroup])) {
        $strings[$data->textgroup][$data->source] = empty($data->translation) ? TRUE : $data->translation;
      }
    }
  }
  return $strings;
}