R-Project: Translation Status
[This article was first published on fernandohrosa.com.br - en » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Introduction
This page was originally set up to shows statistics of the current status of the translation of messages for the R-project. The statistics can be generated with a Perl script that wrote for this: rt_status.pl
I had put this info here in order to help the Translation Teams coordinate efforts and do quality check, like checking for fuzzy translations.
I have since stopped posting the output of this script to this post, because now I mantain a pootle server for R translation which can provide much more detailed information. Keeping the original Perl script I had wrote and documentation up for posterity. If you want to collaborate with the translation project and/or have access to the pootle server please contact me.
Download rt_status.pl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | #!/usr/bin/perl -w # # rt_status.pl # # A script to summarize current status of the translation # efforts of the R-project # # Fernando Henrique Ferraz P Rosa <academic @ feferraz.net> # Created: 27/09/2005 # Last Update: 28/09/2005 # # use: # rt_status.pl langcode # # obs: edit $RSRCPATH to match the path to your R # sources # # $RSRCPATH = "/home/mentus/utils/R/development/espelho/r-devel"; $lang = $ARGV[0]; if (!(defined($lang))) { die("You must specify a language code\n"); } format STDOUT = @<<<< @<<<< @<<<< @<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ppronto , $ptrans , $puntrans , $pfuzzy , $pnome . print "\tLanguage code : $lang\n\n"; print " % done T U F file name\n"; @lista = `find $RSRCPATH/ -name '*.pot'`; $sum_tot = 0; $sum_trans = 0; $sum_fuzzy = 0; $sum_untrans = 0; foreach $pot (@lista) { chomp($pot); $pot_trans = $pot; $pot_trans =~ s/R\.pot/$lang.po/; $pot_trans =~ s/RGui\.pot/RGui-$lang.po/; $pot_trans =~ s/\/R-.*\.pot/\/R-$lang.po/; $pot_trans =~ s/\/\w+\.pot/\/$lang.po/; $saida_t = `msgfmt --statistics $pot -o /dev/null 2> saida.tot`; open(PIPEG,"saida.tot"); $saida_t = <PIPEG>; if ($saida_t =~ m/, (\d+) untranslated/) { $n_total_pot = $1; } else { print "$saida_t\n"; die("Falha no arquivo $pot\n"); } close(PIPEG); if (!(-e $pot_trans)) { $n_trans_po = 0; } else { $saida = `msgfmt --statistics $pot_trans 2> saida.tmp`; open(PIPE,"saida.tmp"); $saida = <PIPE>; chomp($saida); while ($saida !~ m/translated/) { $saida = <PIPE>; chomp($saida); } close(PIPE); $match =0 ; if ($saida =~ m/(\d+) fuzzy translation/) { $n_fuzzy_po = $1; $match = 1; } else { $n_fuzzy_po = 0; } if ($saida =~ m/(\d+) translated message/) { $n_trans_po = $1; $match = 1; } else { $n_trans_po = 0; } if ($saida =~ m/(\d+) untranslated message/) { $n_untrans_po = $1; $match =1; } else { $n_untrans_po = 0; } if ($match == 0) { die("File $pot_trans contains no translated, no fuzzy and not even untranslated messages!\n"); } $n_total_po = $n_trans_po + $n_untrans_po; } $pnome = $pot_trans; $pnome =~ s/^$RSRCPATH\///g; if (-e $pot_trans) { $prop = 100*$n_trans_po/$n_total_po; $ppronto = $prop; $ptotal = $n_total_po; $pfuzzy = $n_fuzzy_po; $pnome = " $pnome"; $ptrans = $n_trans_po; $puntrans = $n_untrans_po; write; } else { $prop = 0; $n_fuzzy_po = 0; $n_trans_po = 0; $n_untrans_po = $n_total_pot; $ppronto = $prop; $pfuzzy = $n_fuzzy_po; $ptotal = $n_total_pot; $pnome = "*$pnome"; $ptrans = $n_trans_po; $puntrans = $n_untrans_po; write; } $sum_tot += $n_total_pot; $sum_trans += $n_trans_po; $sum_untrans += $n_untrans_po; $sum_fuzzy += $n_fuzzy_po; } if ($sum_tot == 0) { die("No messages found. Check your \$RSRCPATH.\n"); } $porc = 100*$sum_trans / $sum_tot; $ppronto = "-"; $ptrans = $sum_trans; $puntrans = $sum_untrans; $pfuzzy = $sum_fuzzy; $pnome = ""; write; print "\n\tDone "; printf ("%2.2f",$porc); print "% (T/(T+U))\n"; unlink("saida.tmp"); unlink("saida.tot"); unlink("messages.mo"); |
Summaries description
The summaries compiled below show per language translation statistics for each .pot file on the R source.
- T stands for the number of translated messages.
- U stands for the number of untranslated messages.
- F is the number of fuzzy messages.
Every file which hasn’t a .po file for the given language yet has a * preprended to its name.
To leave a comment for the author, please follow the link and comment on their blog: fernandohrosa.com.br - en » R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.