Merge remote-tracking branch 'refs/remotes/KiCad/master'

This commit is contained in:
ejs-ejs 2016-10-02 21:40:42 +03:00
commit 1c0c94f6f3
11 changed files with 59213 additions and 59736 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@ Makefile
CMakeFiles/*
*.pot
.DS_Store
i18n_status.svg
i18n_status.csv

View File

@ -6,7 +6,6 @@ cvpcb
3d-viewer
gerbview
bitmap2component
new
polygon
pcb_calculator
potrace

33998
ca/kicad.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

25065
ja/kicad.po

File diff suppressed because it is too large Load Diff

71
plot_i18n_status.py Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#####################################
#
# This program source code file is part of KiCad, a free EDA CAD application.
#
# Copyright (C) 2016 Nick Østergaard <oe.nick at gmail dot com>
# Copyright (C) 2016 KiCad Developers
#
# License GNU GPL Version 3 or any later version.
#
#####################################
import matplotlib.pyplot as plt
import csv
import numpy as np
import time
# Initialize data structure variable
data = []
# Read CSV file
with open('i18n_status.csv', 'r') as csvfile:
spamreader = csv.reader(csvfile, delimiter=';')
for row in spamreader:
data.append(row)
# Replace empyt values with zero and convert numbers to int
for index,value in np.ndenumerate( data ):
if value=='':
data[index[0]][index[1]] = 0
try:
data[index[0]][index[1]] = int(data[index[0]][index[1]])
except:
pass
# Sort data after mostly translated
data[1:] = sorted(data[1:], key=lambda x: int(x[1]), reverse=True)
# Prepare some number for formatting the plot
N = len(data[1:]) # number of languages
width = 0.35 # the width of the bars
ind = np.arange(N)*width*5 # the x locations for the groups
# Plot the bars
fig, ax = plt.subplots()
rects1 = ax.bar(ind, list(zip(*data))[1][1:], width, color='b')
rects2 = ax.bar(ind+width, list(zip(*data))[2][1:], width, color='r')
rects3 = ax.bar(ind+2*width, list(zip(*data))[3][1:], width, color='y')
# Plot ceiling
max_nof_strings = sum(map(int, data[1][1:4]))
plt.plot([0,max(ind)+3*width],[max_nof_strings,max_nof_strings], color='k', linewidth='2')
ax.set_xlim([0,max(ind)+3*width])
# Add some text for labels, title and axes ticks
ax.set_ylabel('Number of strings')
ax.set_title('Translation status')
ax.set_xticks(ind+width*1.5)
ax.set_xticklabels(list(zip(*data))[0][1:])
ax.yaxis.grid(True, which='both') # horizontal lines
ax.legend((rects1[0], rects2[0], rects3[0]), ('TRANSLATED', 'FUZZY', 'UNTRANSLATED'), loc='upper center', bbox_to_anchor=(0.5, -0.05), fancybox=True, ncol=3)
plt.figtext(0.99, 0.96, time.strftime("%d/%m %Y"), horizontalalignment='right')
plt.subplots_adjust(left=0.07, right=0.99, top=0.95, bottom=0.12)
fig.set_size_inches(12, 8)
fig.savefig('i18n_status.svg')
# Show the magic to the user
plt.show()

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,61 @@
#!/bin/bash
#!/bin/bash -e
#####################################
#
# This program source code file is part of KiCad, a free EDA CAD application.
#
# Copyright (C) 2015 Marco Ciampa <ciampix@libero.it>
# Copyright (C) 2015 KiCAd Developers
# Copyright (C) 2015-2016 KiCad Developers
#
# License GNU GPL Version 3 or any later version.
#
#####################################
if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then
echo "Usage: $0 [-k] [locale]"
echo
echo "Where -k means keep pot template and not delete it"
exit
fi
LANG=C
if [ "$1" = "-k" ] ; then
display_help() {
echo "Usage: $0 [-k] [-p] [locale]"
echo " -k keep pot template and not delete it"
echo " -p plot the translation statistics [requires python with matplotlib]"
echo " -s=<path> path to kicad source code"
exit
}
# Handle command line arguments
for i in "$@"; do
case $i in
-h|--help)
display_help
shift
;;
-k)
KEEP=1
shift
;;
-p)
PLOT=1
shift
;;
-s=*)
SOURCEDIR="${i#*=}"
shift
;;
*)
SINGLE_LANG=$i
;;
esac
done
if [ -z ${SOURCEDIR} ]; then
SOURCEDIR=../kicad-source-mirror
echo "Using default SOURCEDIR=${SOURCEDIR}"
fi
SOURCEDIR=../kicad-source-mirror #Set this first!!!
#Autovars
cd $(dirname ${BASH_SOURCE[0]})
LOCALDIR=$PWD
LINGUAS=`cat LINGUAS|grep -v '^#'|grep -v '^\s*$'` #Read file without comment and empty lines
POTDIRS=`cat POTDIRS|grep -v '^#'|grep -v '^\s*$'` #Read file without comment and empty lines
CSVFILE=${PWD}/i18n_status.csv
LINGUAS=`cat $LOCALDIR/LINGUAS|grep -v '^#'|grep -v '^\s*$'` #Read file without comment and empty lines
POTDIRS=`cat $LOCALDIR/POTDIRS|grep -v '^#'|grep -v '^\s*$'` #Read file without comment and empty lines
cd $SOURCEDIR
@ -47,23 +75,61 @@ rm $LOCALDIR/POTFILES
validate() { echo $LINGUAS | grep -F -q -w "$1"; }
#If supplied, update only the specified locale
if [ ! "$1" = "" ] ; then
if ! validate "$1"; then
if [ ! "$SINGLE_LANG" = "" ] ; then
if ! validate "$SINGLE_LANG"; then
echo "Error!"
echo "Locale argument \"$1\" not present in current locale list:"
for i in $LINGUAS; do echo -n "$i " ; done
for i in $LINGUAS; do echo -n "$i "; done
echo # newline
exit 1
else
LINGUAS="$1"
LINGUAS="$SINGLE_LANG"
fi
fi
echo "Writing summary to ${CSVFILE}"
echo "LANG;TRANSLATED;FUZZY;UNTRANSLATED" > "${CSVFILE}"
for i in $LINGUAS
do
msgmerge --force-po $LOCALDIR/$i/kicad.po $LOCALDIR/kicad.pot -o $LOCALDIR/$i/kicad.po 2>&1 # >> /dev/null
msgfmt --statistics $LOCALDIR/$i/kicad.po 2>&1 >>/dev/null
echo "## $i"
msgmerge --force-po $LOCALDIR/$i/kicad.po $LOCALDIR/kicad.pot -o $LOCALDIR/$i/kicad.po 2> /dev/null
msgfmt --statistics $LOCALDIR/$i/kicad.po 2>&1 >>/dev/null |
while IFS=",." read A B C D ; do
echo $A
echo $B
echo $C
echo $D
for STRING in "$A" "$B" "$C" "$D" ; do
STRING=${STRING# }
case "$STRING" in
*" translated message"* )
TRANSLATED=${STRING% translated message*}
;;
*" fuzzy translation"* )
FUZZY=${STRING% fuzzy translation*}
;;
*" untranslated message"* )
UNTRANSLATED=${STRING% untranslated message*}
;;
"" )
;;
* )
echo >&2 "$0: Unknown format of \"msgfmt --statistics $LOCALDIR/$i/kicad.po \": \"$STRING\""
exit 1
;;
esac
done
echo "$i;${TRANSLATED};${FUZZY};${UNTRANSLATED}">>"${CSVFILE}"
done
done
if [ "$PLOT" = "1" ]; then
cd $LOCALDIR
$LOCALDIR/plot_i18n_status.py
fi
if [ ! "$KEEP" = "1" ]; then
rm $LOCALDIR/kicad.pot
fi

File diff suppressed because it is too large Load Diff