<commit_before><?php
require_once dirname(__FILE__).'/accesscheck.php';

## fetch updated translation
#var_dump($LANGUAGES);

if (!Sql_Table_exists($GLOBALS['tables']['i18n'])) {
  include dirname(__FILE__).'/structure.php';
  Sql_Create_Table($GLOBALS['tables']['i18n'],$DBstruct['i18n']);
}
if (isset($_GET['lan'])) { ## Non-JS version
  include 'actions/updatetranslation.php';
}

$LU = getTranslationUpdates();
if (!$LU || !is_object($LU)) {
  print Error(s('Unable to fetch list of languages, please check your network or try again later'));
  return;
}

#var_dump($LU);
print '<ul>';
foreach ($LU->translation as $lan) {
#  var_dump($lan);
  $lastupdated = getConfig('lastlanguageupdate-'.$lan->iso);
  if (!empty($LANGUAGES[(string)$lan->iso])) {
    $lan_name = $LANGUAGES[(string)$lan->iso][0];
  } else {
    $lan_name = $lan->name;
  }
  if ($lan->lastmodified > $lastupdated) {
    $updateLink = pageLinkAjax('updatetranslation&lan='.$lan->iso,$lan_name);
  } else {
    $updateLink = $lan_name;
  }
  if (empty($lastupdated)) {
    $lastupdated = s('Never');
  } else {
    $lastupdated = date('Y-m-d',$lastupdated);
  }
  
  printf ('<li>%s %s: %s, %s: %s</li>',$updateLink,s('Last updated'),$lastupdated,s('Last modified'),date('Y-m-d',(int)$lan->lastmodified));
}
print '</ul>';<commit_msg>only update the current admin language, to avoid overloading the translation server unnecessarily<commit_after><?php
require_once dirname(__FILE__).'/accesscheck.php';

## fetch updated translation
#var_dump($LANGUAGES);

if (!Sql_Table_exists($GLOBALS['tables']['i18n'])) {
  include dirname(__FILE__).'/structure.php';
  Sql_Create_Table($GLOBALS['tables']['i18n'],$DBstruct['i18n']);
}
if (isset($_GET['lan'])) { ## Non-JS version
  include 'actions/updatetranslation.php';
}

$LU = getTranslationUpdates();
if (!$LU || !is_object($LU)) {
  print Error(s('Unable to fetch list of languages, please check your network or try again later'));
  return;
}

#var_dump($LU);
print '<ul>';
foreach ($LU->translation as $lan) {
#  var_dump($lan);
  $lastupdated = getConfig('lastlanguageupdate-'.$lan->iso);
  if (!empty($LANGUAGES[(string)$lan->iso])) {
    $lan_name = $LANGUAGES[(string)$lan->iso][0];
  } else {
    $lan_name = $lan->name;
  }
  if ($lan->iso == $_SESSION['adminlanguage']['iso'] && $lan->lastmodified > $lastupdated) {
    $updateLink = pageLinkAjax('updatetranslation&lan='.$lan->iso,$lan_name);
  } else {
    $updateLink = $lan_name;
  }
  if (empty($lastupdated)) {
    $lastupdated = s('Never');
  } else {
    $lastupdated = date('Y-m-d',$lastupdated);
  }
  
  if ($lan->iso == $_SESSION['adminlanguage']['iso']) {
    printf ('<li><strong>%s %s: %s, %s: %s</strong></li>',$updateLink,s('Last updated'),$lastupdated,s('Last modified'),date('Y-m-d',(int)$lan->lastmodified));
  } else {
    printf ('<li>%s %s: %s, %s: %s</li>',$updateLink,s('Last updated'),$lastupdated,s('Last modified'),date('Y-m-d',(int)$lan->lastmodified));
  }
}
print '</ul>';
{'fraction_non_alphanumeric': 0.22121517287680428, 'fraction_numerical': 0.004699563611950319, 'mean_word_length': 5.492374727668845, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2970575', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1057, 'n_words': 187}