Debian Codegraph @

translation-canary/translation_canary/translated/__main__.py

raw
1 # Entry point for testing translations
2 #
3 # Copyright (C) 2015 Red Hat, Inc.
4 #
5 # This copyrighted material is made available to anyone wishing to use,
6 # modify, copy, or redistribute it subject to the terms and conditions of
7 # the GNU Lesser General Public License v.2, or (at your option) any later
8 # version. This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY expressed or implied, including the implied
10 # warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 # the GNU Lesser General Public License for more details. You should have
12 # received a copy of the GNU Lesser General Public License along with this
13 # program; if not, write to the Free Software Foundation, Inc., 51 Franklin
14 # Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat trademarks
15 # that are incorporated in the source code or documentation are not subject
16 # to the GNU Lesser General Public License and may only be used or
17 # replicated with the express permission of Red Hat, Inc.
18 #
19 # Red Hat Author(s): David Shea <[email protected]>
20
21 import sys, argparse
22 from . import testSourceTree
23
24 ap = argparse.ArgumentParser(description='Validate translated strings')
25 ap.add_argument('--release', action='store_true', default=False,
26 help='Run in release mode')
27 ap.add_argument('--test', dest='release', action='store_false',
28 help='Run in test mode')
29 ap.add_argument('--no-modify-linguas', dest='modify_linguas', action='store_false', default=True,
30 help='In release mode, do not remove failing translation from LINGUAS')
31 ap.add_argument('source_trees', metavar='SOURCE-TREE', nargs='+',
32 help='Source directory to test')
33
34 args = ap.parse_args()
35
36 status = 0
37 for srcdir in args.source_trees:
38 if not testSourceTree(srcdir, args.release, args.modify_linguas):
39 status = 1
40
41 sys.exit(status)