Localizer strings translation not always show all the strings in my page.
For example, two menu titles, both created under the same language. One appear ready to be translated and the other can´t be found.
Sometimes, one string will appear under Localizer strings translation later. Seems like database don´t instantly update. Sometimes, a string never appear.

Thanks in advance.

Comments

Roberto Gerola’s picture

Probably you have installed localizer prior to create the menu items.

You can use the following code to import the strings in localizer :

$s = "SELECT * from {menu} WHERE type IN(118,112) AND pid=0 AND mid NOT IN
(SELECT object_key FROM {localizertranslation} WHERE object_name='menu')";
$r = db_query($s);

while ($i=db_fetch_object($r)) {
$t = array(
'object_key' => $i->mid,
'object_name' => 'menu',
'object_field' => 'title',
'translation' => $i->title,
'language' => 'en'
);
localizertranslation_save($t);
}

$s = "SELECT * from {menu} WHERE type IN(118,112) AND pid>0 AND mid NOT IN
(SELECT object_key FROM {localizertranslation} WHERE object_name='menu_item')";
$r = db_query($s);

while ($i=db_fetch_object($r)) {
$t = array(
'object_key' => $i->mid,
'object_name' => 'menu_item',
'object_field' => 'title',
'translation' => $i->title,
'language' => 'en'
);
localizertranslation_save($t);
}


$ii = localizertranslation_findall("language='en'");
foreach ($ii as $key=>$i) {
$or = $i['translation'];

$ll = array('fr', 'de', 'es');
foreach ($ll as $l) {
  unset ($i['tid']);
  $i['language']= $l;

  $tr = '';
  $result = db_query("SELECT s.lid, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE s.source = '%s' AND t.locale = '%s'", $or, $l);
  // Translation found
  if ($trans = db_fetch_object($result)) {
    if (!empty($trans->translation)) {
      $tr = $trans->translation;
    }
  }

  if($tr !=  $or) {
    $i['translation'] =  $tr;
    localizertranslation_save($i);
  }
}

}
Roberto Gerola’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.