/
accesskey_checker_PO
executable file
·63 lines (51 loc) · 2.49 KB
/
accesskey_checker_PO
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
#!/bin/bash
#
# Copyright 2012 Zuza Software Foundation
#
# 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 Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Finds problems with accesskeys in Gettext PO files
#
# This is really only useful for Mozilla PO files. It finds single
# character msgids, filters out those that we've reviewed and found
# to not be stray accesskeys. It counts them and then leaves the
# filtered PO files for later examination.
function usage()
{
echo "Usage: $(basename $0) [dir]"
exit
}
if [ $# -ne 1 ]; then
usage
fi
if [ ! -d $1 ]; then
usage
fi
sourcedir=$1
singledir=${sourcedir}-single
accesskeydir=${sourcedir}-accesskey
# Full entity names of items that should be ignored
ignore_full_dtd="privatebrowsingpage.clearRecentHistoryAfter|firstdayofweek.default|noStyleSheet-tip-end.label|rememberActions.post.label|dontrememberActions.post.label|syncKey.findOutMore2.label|syncKey.footer3.label|aboutApps.noApps.post|aboutPage.licenseLinkSuffix|consoleEvaluate.label|rights.intro-point2-c|rights.intro-point3c|rights.intro-point4c|rights2.webservices-c"
ignore_full_properties="gecko.handlerService.defaultHandlersVersion|Byte|Kilo|Mega|Giga|CertDumpAVACountry|CertDumpAVALocality|CertDumpAVAOrg|CertDumpPK9Email|pluralRule|intl.ellipsis|VK_SHIFT|VK_META|VK_ALT|VK_CONTROL|MODIFIER_SEPARATOR"
# Items with these suffixes should be ignored
ignore_suffix="commandkey|key|macCommandKey|commandKey"
rm -rf $singledir $accesskeydir
pogrep --progress=none --search=source -e "^.$" $sourcedir $singledir
pogrep --progress=none --search=locations -e "($ignore_full_dtd|$ignore_full_properties|\.($ignore_suffix))" -v $singledir $accesskeydir
rm -rf $singledir
echo "DTD potential errors"
pocount $(find $accesskeydir -name "*dtd*") | tail
echo "Properties potential errors"
pocount $(find $accesskeydir -name "*properties*") | tail
echo "Actual problem files are located in directory: $accesskeydir"