[translations] determining correct import

Jakub Suchy jakub at rtfm.cz
Sun Feb 4 19:11:40 UTC 2007


> This will redirect and loop import.php until all files are processed.
> This is BAD solution, but can't think of better one now. Anyone?

Aah, one more came to me after sending this.
We can track execution time when doing autoimport. Something like:
$time_taken = 0;
$avg = average time needed to import one translation file. computed by us? is it reliable?
foreach($files as $file) {
  $start = microtime();
  import_file($file);
  $stop = microtime();
  $time_taken += $stop-$start;
  if ($time_taken > ($avg_computed - $treshold)) {
   // print a warning "There is not enough time to import all
   // translation files. You should <a href="/import-manually-now">run import manually again</a>"
  }
}

This assumes that:
1) We can track modules already imported and not yet imported
2) We are able to determine average time needed to import translation
file. One can compare $time_taken to max_execution_time but this is
really non-deterministic, one more file can be over limit and you can do
nothing...Should be simplier if everybody is using PHP5 with exceptions.


More information about the translations mailing list