I am working on a D5b website that also includes a community translation function: www.iwanttospeak.net

After an approach with a custom interface i decided to use l10n_client as a basis. My first impression of this module is very positive. I saw that in the newest version the confusing list of translateable terms is narrowed down a bit by a new logic to get the translatable terms...

However i chose a different approach hacking version l10n_client-5.x-1.0

The default language of www.iwanttospeak.net is "english" but as im german my "reference" translation is "german". I wanted that my translators are only able to translate strings that are used in the reference translation. I did that by adding a quick-and-dirty hack that i want to share here for discussion. I would be happy if i could contribute to the improvement of l10n_client.

<?php
  if (user_access('use on-page translation')) {
    // Get all strings used on the page.
    // $strings = locale();
    
    $lang = i18n_get_lang();
    
    $sql = "
    SELECT s.*, t2.current, t2.current_locale
    FROM {locales_target} t
    INNER JOIN {locales_source} s ON s.lid = t.lid
    LEFT JOIN (SELECT translation AS current, locale AS current_locale, lid FROM {locales_target} WHERE locale = '$lang') t2 ON t.lid = t2.lid
    WHERE t.locale = 'de' 
    AND t.translation != ''
    ";
    
    $result = db_query($sql);
    while ($template = db_fetch_object($result)) {
      $strings["$template->source"] = "$template->current" ? "$template->current" : 1;
    }
    
    ksort($strings);

....

}
?>

Comments

gábor hojtsy’s picture

Status: Active » Closed (won't fix)

Looks like others were not interested in this.