| 23 | |
| 24 | |
| 25 | def parse_args(self): |
| 26 | parser = ArgumentParser( |
| 27 | description=""" |
| 28 | A script for converting categories.txt into the strings.txt format |
| 29 | and back, as well as for autoformatting categories.txt. This is |
| 30 | useful for interacting with the translation partners. |
| 31 | """ |
| 32 | ) |
| 33 | |
| 34 | parser.add_argument( |
| 35 | "-c", "--categories", |
| 36 | required=True, |
| 37 | dest="categories", |
| 38 | help="""Path to the categories file to be converted into the strings.txt format.""" |
| 39 | ) |
| 40 | |
| 41 | parser.add_argument( |
| 42 | "-o", "--output", |
| 43 | dest="output", |
| 44 | help="""The destination file.""" |
| 45 | ) |
| 46 | |
| 47 | parser.add_argument( |
| 48 | "-f", "--format", |
| 49 | dest="format", action="store_true", default=False, |
| 50 | help="""Format the file and exit""" |
| 51 | ) |
| 52 | |
| 53 | return parser.parse_args() |
| 54 | |
| 55 | |
| 56 | class CategoriesTxt: |