Hi,
I've wrote a simple script to have a snapshot of italian translation
status, module translated, assigned and so on.
This script use some info write on
it/Translators
and some info taked from
en/<section>/CVS/Entries
With this scrip you can:
- check which module is assigned ( a option)
- check which module is translated
( t option)
- check which module is translated/assigned sorted by collab
( c option)
- check if there's new module on en section
( n option)
- list module not in sync with en version
( d option)
use some temp file on /tmp dir
It's possible to use it on different language section simple translating
message and using <lang>/Translators with additional info like
Directory/File Translator Status/EN
========================================================
bookinfo.xml perugini T1.13
with
- T for translated follow from en revision
- A for assigned follow from en revision
That's all.
Luk
P.S:
you need this tools
bash
awk
sed
grep
On 07 Aug 2001 10:46:25 +0200, Thomas wrote:
>
>
> Hojtsy g�bor wrote:
>
> >
> >
> > >>I too think that this is not needed for translations. I can't think
> > of
> > >>any situation where I would use this. An En-version comment
> > >>will be at least usable :))
> > >Whenever I find out a partally translated file, I know at once
> > >which version is was started from, without diff or reading the
> > >whole file.
> >
> > You will now which French version it was. Where it helps you?
>
> You're right. I use a tag like (proposed by Jeroen I think)
> <!-- up-to-date against phpdoc/en/chapters/security.xml:1.23 -->
>
> As soon as I have enough files with this tag, I'll write a simple script
>
> which shows me the priority (which file is farest behind) of "my" files.
>
> The more users in our language follow this, the more useful it will be
> (but having a system and a common "living" it are different things :).
>
> Cu,
> Thomas
>
>
--
________________________________________________________________
Ing. Luca Perugini o Linux Consultant
Editor PHP Manual Italian language o mailto:[EMAIL PROTECTED]
SysAdmin o http://www.uisp.it
SysAdmin o http://www.sporty.it
________________________________________________________________
#!/bin/sh
# Check Status of PHP italian translation
#
# Author: Luca Perugini , <[EMAIL PROTECTED]>
#
# Copyright (C) 2001 Luca Perugini
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
#
#
# $Id: checkTr,v 1.5 2001/08/07 10:07:07 perugini Exp perugini $
# $Log: checkTr,v $
# Revision 1.5 2001/08/07 10:07:07 perugini
# Added variable for localization
# now it's possible to use it with different language section
#
# Revision 1.4 2001/07/17 17:59:41 perugini
# Report nr module english section
# Fixed some error
#
# Revision 1.3 2001/07/16 17:07:31 perugini
# Fixed missing d options
#
# Revision 1.2 2001/07/16 17:01:27 perugini
# Added GPL license
#
# Revision 1.1 2001/07/16 16:58:13 perugini
# Initial revision
#
# Select and check status of module translated
# Luca Perugini
# List of english file
list_en=`find en/ -name '*xml' |cut -b4-`
tot_en=`echo $list_en|wc -w`
#General Def
#Language section
lang_transl='it/Translators'
#To update
toupdate='AGGIORNARE'
#Translated and differ from en versione
translated='Moduli Tradotti'
translated_summary="Riepilogo $translated"
translated_total_begin="Totale moduli tradotti"
translated_total_end="su $tot_en"
translated_table_desc='Nome Nr moduli Percentuale sul totale'
#Translated and differ from en versione
assigned='Moduli Assegnati'
assigned_summary="Riepilogo $assigned"
assigned_total_begin="Totale moduli assegnati"
assigned_total_end="su $tot_en"
assigned_table_desc='Nome Nr moduli Percentuale sul totale'
#Translated and differ from en versione
collab='Moduli ordinati per collaboratori'
collab_summary="Riepilogo Moduli Assegnati/Tradotti"
collab_total_begin="Totale moduli"
collab_total_middle1='tradotti e'
collab_total_end="assegnati su $tot_en"
collab_table_desc='Nome Nr moduli trad. % ass. % '
#Translated and differ from en versione
translated_diff_from_en="Moduli Tradotti verifica versione en"
#Not found on lang/Translators
not_found_on_trans_desc="Moduli Non Presenti in $lang_transl"
not_found_on_trans="Non presente in $lang_transl"
#Menu section
menu_module_translated='Moduli tradotti'
menu_module_assigned='Moduli assegnati'
menu_module_not_on_transl='Moduli non presenti in Translators'
menu_module_sort_by_coll='Moduli ordinati per collaboratori'
menu_module_translated_diff_from_en='Moduli tradotti: elenca moduli che differiscono dalla versione inglese'
_cktr(){
n=`echo $1 |cut -f2 -d '/'`
dir=`echo $1 |cut -f1 -d '/'`
t=`grep -w "$n" $lang_transl 1>/dev/null`
[ $? = 0 ] &&
{
a=`grep -w $n $lang_transl |grep T`
[ $? = 0 ] && b=`echo $a|cut -f2- -d ' '` && echo -n "$1 $b " &&
{
[ -d en/$dir ] && h_vr=`grep -w $n en/$dir/CVS/Entries |cut -f3 -d '/'`
[ ! -d en/$dir ] && h_vr=`grep -w $n en/CVS/Entries |cut -f3 -d '/'`
t_vr=`grep -w $n $lang_transl|grep T|sed -e 's/\(.*T\)\(.*\)/\2/'`
[ ! "$h_vr" = "$t_vr" ] && echo "$h_vr $toupdate"
[ "$h_vr" = "$t_vr" ] && echo "$h_vr "
}
}
}
_ckass(){
n=`echo $1 |cut -f2 -d '/'`
dir=`echo $1 |cut -f1 -d '/'`
t=`grep -w "$n" $lang_transl 1>/dev/null`
[ $? = 0 ] &&
{
a=`grep -w $n $lang_transl|grep A`
[ $? = 0 ] && b=`echo $a|cut -f2- -d ' '` && echo -n "$1 $b " &&
{
[ -d en/$dir ] && h_vr=`grep -w $n en/$dir/CVS/Entries |cut -f3 -d '/'`
[ ! -d en/$dir ] && h_vr=`grep -w $n en/CVS/Entries |cut -f3 -d '/'`
t_vr=`grep -w $n $lang_transl|grep A|sed -e 's/\(.*A\)\(.*\)/\2/'`
[ ! "$h_vr" = "$t_vr" ] && echo "$h_vr $toupdate"
[ "$h_vr" = "$t_vr" ] && echo "$h_vr "
}
}
}
_ck(){
n=`echo $1 |sed -e 's/\(.*\)\///'`
t=`grep -w "$n" $lang_transl 1>/dev/null`
[ $? = 1 ] &&
echo $1 $not_found_on_trans
}
_ckcoll(){
n=`echo $1 |cut -f2 -d '/'`
dir=`echo $1 |cut -f1 -d '/'`
t=`grep -w "$n" $lang_transl 1>/dev/null`
[ $? = 0 ] &&
{
a=`grep -w $n $lang_transl| grep '[TA]'`
[ $? = 0 ] && b=`echo $a|cut -f2- -d ' '` && echo -n "$1 $b " &&
{
[ -d en/$dir ] && h_vr=`grep -w $n en/$dir/CVS/Entries |cut -f3 -d '/'`
[ ! -d en/$dir ] && h_vr=`grep -w $n en/CVS/Entries |cut -f3 -d '/'`
t_vr=`grep -w $n $lang_transl|grep '[TA]'|sed -e 's/\(.*[TA]\)\(.*\)/\2/'`
[ ! "$h_vr" = "$t_vr" ] && echo "$h_vr $toupdate"
[ "$h_vr" = "$t_vr" ] && echo "$h_vr "
}
}
}
case "$1" in
d)
echo $translated_diff_from_en
for a in $list_en; do
_cktr $a;
done |sort -k1 |awk '{ printf "%-40s %-15s %-10s en %-5s %s\n",$1,$2,$3,$4,$5}'>/tmp/tra.out
[ -f /tmp/tra.out ] && cat /tmp/tra.out |grep "$toupdate"
;;
t)
echo $translated
for a in $list_en; do
_cktr $a;
done |sort -k1 |awk '{ printf "%-40s %-15s %-10s en %-5s %s\n",$1,$2,$3,$4,$5}'>/tmp/tra.out
[ -f /tmp/tra.out ] && cat /tmp/tra.out &&
{
echo
echo $translated_summary
echo
tot=`cat /tmp/tra.out| wc -l`
echo $translated_total_begin $tot $translated_total_end
echo
echo $translated_table_desc
for n in `cat /tmp/tra.out |cut -b42-57|sort|uniq`; do
echo -n $n ' ';
par=`grep $n /tmp/tra.out |wc -l`; echo -n $par ' ' ;
echo "4 k $par $tot / 100 * p" |dc|sed -e 's/\(.*\.\)\([0-9][0-9]\)\(.*\)/\1\2/'
done |awk '{ printf "%-15s %-4s %5s\n",$1,$2,$3}'
}
;;
a)
echo
echo $assigned
for a in $list_en; do
_ckass $a;
done |sort -k1 |awk '{ printf "%-40s %-15s %-10s en %-5s %s\n",$1,$2,$3,$4,$5}' >/tmp/ass.out
[ -f /tmp/ass.out ] && cat /tmp/ass.out &&
{
echo
echo $assigned_summary
echo
tot=`cat /tmp/ass.out| wc -l`
echo $assigned_total_begin $tot $assigned_total_end
echo
echo $assigned_table_desc
for n in `cat /tmp/ass.out |cut -b42-57|sort|uniq`; do
echo -n $n ' ';
par=`grep $n /tmp/ass.out |wc -l`; echo -n $par ' ' ;
echo "4 k $par $tot / 100 * p" |dc|sed -e 's/\(.*\.\)\([0-9][0-9]\)\(.*\)/\1\2/'
done |awk '{ printf "%-15s %-4s %5s\n",$1,$2,$3}'
}
;;
n)
echo
echo $not_found_on_trans_desc
for a in $list_en; do
_ck $a;
done
;;
c)
echo
echo $collab
for a in $list_en; do
_ckcoll $a;
done |sort -k2 |awk '{ printf "%-40s %-15s %-10s en %-5s %s\n",$1,$2,$3,$4,$5}'>/tmp/coll.out
[ -f /tmp/coll.out ] && cat /tmp/coll.out &&
{
echo
echo $collab_summary
echo
tot=`cat /tmp/coll.out| wc -l`
tot_tra=`cat /tmp/coll.out|grep T | wc -l`
tot_ass=`cat /tmp/coll.out|grep A | grep -v T | wc -l`
echo $collab_total_begin $tot $collab_total_middle $tot_tra $collab_total_middle1 $tot_ass $collab_total_end
echo
echo $collab_table_desc
for n in `cat /tmp/coll.out |cut -b42-57|sort|uniq`; do
echo -n $n ' '
par=`grep $n /tmp/coll.out |wc -l`;
echo -n $par ' '
par_tra=`grep $n /tmp/coll.out |grep T |wc -l`;
echo -n $par_tra ' '
par_tra_per=`echo "4 k $par_tra $tot / 100 * p" |dc|sed -e 's/\(.*\.\)\([0-9][0-9]\)\(.*\)/\1\2/'`;
echo -n $par_tra_per ' '
par_ass=`grep $n /tmp/coll.out |grep A | grep -v T |wc -l`; echo -n $par_ass ' ' ;
echo "4 k $par_ass $tot / 100 * p" |dc|sed -e 's/\(.*\.\)\([0-9][0-9]\)\(.*\)/\1\2/'
done |awk '{ printf "%-15s %-4s %-4s %5s %-4s %5s\n",$1,$2,$3,$4,$5,$6}'
}
;;
*)
echo "checkTr [t,a,n,c,d]"
echo
echo " t :- $menu_module_translated"
echo " a :- $menu_module_assigned"
echo " n :- $menu_module_not_on_transl"
echo " c :- $menu_module_sort_by_coll"
echo " d :- $menu_module_translated_diff_from_en"
echo
echo " Copyright (C) 2001 Luca Perugini"
echo
;;
esac