Browse Source

build_lang_stat: build language statistic for OSM Wiki

master
parent
commit
609377ae38
  1. 55
      bin/build_lang_stat
  2. 2
      lib/modulekit/lang

55
bin/build_lang_stat

@ -0,0 +1,55 @@
#!/usr/bin/php
<?php
require "lib/modulekit/lang/inc/build_statistic.php";
?>
<!--
Status:
0-15 #FF0033
16-50 #FF7700
51-70 #FFCC00
71-85 #77CC00
86-100 #33CC00
-->
{|class="wikitable sortable"
|-
!scope="col"| Code
!scope="col"| Language
!scope="col"| Native name
<?php
$languages = json_decode(file_get_contents("lib/modulekit/lang/lang/list.json", true));
$languages_en = json_decode(file_get_contents("lib/modulekit/lang/lang/en.json", true));
$dirs = array(
"OSB Core UI" => "lang/",
"Tag Translations" => "node_modules/openstreetmap-tag-translations/tags/",
"Category Titles" => "node_modules/openstreetbrowser-categories-main/lang/",
);
foreach ($dirs as $dirId => $dir) {
print "!scope=\"col\"| {$dirId}\n";
$stat[$dirId] = build_statistic($dir);
}
print "!scope=\"col\"| Total\n";
$total = 0;
foreach ($dirs as $dirId => $dir) {
$total += $stat[$dirId][''];
}
foreach ($languages as $code => $native_name) {
print "|-\n";
print "| {$code}\n";
print "| [[/{{Languagename|{$code}|en}}|{{Languagename|{$code}|en}}]] || {{Languagename|{$code}}}\n";
$sum = 0;
foreach ($dirs as $dirId => $dir) {
print "| {{Progress Bar|max={$stat[$dirId]['']}|current=" . ($stat[$dirId][$code] ?? 0) . "}}\n";
$sum += $stat[$dirId][$code];
}
print "| {{Progress Bar|max={$total}|current={$sum}}}\n";
}
?>
|}

2
lib/modulekit/lang

@ -1 +1 @@
Subproject commit 89c651dbbbbd8464f78029d7479e9b719d302aae
Subproject commit b1b4760b0555aa1b1862c4f641adca7af76a2fc8
Loading…
Cancel
Save