You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.4 KiB

  1. #!/usr/bin/php
  2. <?php
  3. require "conf.php";
  4. require "lib/modulekit/lang/inc/build_statistic.php";
  5. ?>
  6. <!--
  7. Status:
  8. 0-15 #FF0033
  9. 16-50 #FF7700
  10. 51-70 #FFCC00
  11. 71-85 #77CC00
  12. 86-100 #33CC00
  13. -->
  14. {|class="wikitable sortable"
  15. |-
  16. !scope="col"| Code
  17. !scope="col"| Language
  18. !scope="col"| Native name
  19. <?php
  20. $languages = json_decode(file_get_contents("lib/modulekit/lang/lang/list.json", true));
  21. $languages_en = json_decode(file_get_contents("lib/modulekit/lang/lang/en.json", true));
  22. $dirs = array(
  23. "OpenStreetBrowser UI" => "lang/",
  24. "Translations of OSM Tags" => "node_modules/openstreetmap-tag-translations/tags/",
  25. "Category Titles" => $repositories['default']['path'] . 'lang/',
  26. );
  27. foreach ($dirs as $dirId => $dir) {
  28. $stat[$dirId] = build_statistic($dir);
  29. }
  30. $total = 0;
  31. foreach ($dirs as $dirId => $dir) {
  32. $total += $stat[$dirId][''];
  33. print "!scope=\"col\"| {$dirId} ({$stat[$dirId]['']})\n";
  34. }
  35. print "!scope=\"col\"| Total ({$total})\n";
  36. foreach ($languages as $code => $native_name) {
  37. $sum = 0;
  38. foreach ($dirs as $dirId => $dir) {
  39. $sum += $stat[$dirId][$code] ?? 0;
  40. }
  41. if ($sum > 0) {
  42. print "|-\n";
  43. print "| {$code}\n";
  44. print "| {{Languagename|{$code}|en}} || {{Languagename|{$code}}}\n";
  45. foreach ($dirs as $dirId => $dir) {
  46. print "| {{Progress Bar|max={$stat[$dirId]['']}|current=" . ($stat[$dirId][$code] ?? 0) . "}}\n";
  47. }
  48. print "| {{Progress Bar|max={$total}|current={$sum}}}\n";
  49. }
  50. }
  51. ?>
  52. |}