OLD | NEW |
1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 import argparse | 5 import argparse |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import re | 8 import re |
9 import shutil | 9 import shutil |
10 import subprocess | 10 import subprocess |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 def updatepsl(base_dir, **kwargs): | 368 def updatepsl(base_dir, **kwargs): |
369 """Update Public Suffix List. | 369 """Update Public Suffix List. |
370 | 370 |
371 Downloads Public Suffix List (see http://publicsuffix.org/) and generates | 371 Downloads Public Suffix List (see http://publicsuffix.org/) and generates |
372 lib/publicSuffixList.js from it. | 372 lib/publicSuffixList.js from it. |
373 """ | 373 """ |
374 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater | 374 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater |
375 publicSuffixListUpdater.updatePSL(base_dir) | 375 publicSuffixListUpdater.updatePSL(base_dir) |
376 | 376 |
377 | 377 |
| 378 @argparse_command() |
| 379 def checktranslations(base_dir, platform, **kwargs): |
| 380 """Perform translation checks. |
| 381 |
| 382 Checks translations files for structure and for overlong translations. |
| 383 """ |
| 384 from buildtools.packager import readMetadata |
| 385 metadata = readMetadata(base_dir, platform) |
| 386 |
| 387 locale_config = read_locale_config(base_dir, platform, metadata) |
| 388 |
| 389 import buildtools.localeTools as localetools |
| 390 localetools.check_translations(locale_config) |
| 391 |
| 392 |
378 def process_args(base_dir, *args): | 393 def process_args(base_dir, *args): |
379 if build_available_subcommands(base_dir): | 394 if build_available_subcommands(base_dir): |
380 MAIN_PARSER.set_defaults(base_dir=base_dir) | 395 MAIN_PARSER.set_defaults(base_dir=base_dir) |
381 | 396 |
382 # If no args are provided, this module is run directly from the command | 397 # If no args are provided, this module is run directly from the command |
383 # line. argparse will take care of consuming sys.argv. | 398 # line. argparse will take care of consuming sys.argv. |
384 arguments = MAIN_PARSER.parse_args(args if len(args) > 0 else None) | 399 arguments = MAIN_PARSER.parse_args(args if len(args) > 0 else None) |
385 | 400 |
386 function = arguments.function | 401 function = arguments.function |
387 del arguments.function | 402 del arguments.function |
388 function(**vars(arguments)) | 403 function(**vars(arguments)) |
OLD | NEW |