Khan/khan-exercises — pull request #44684 by jeresig (2013-04-16 00:59:30+00:00)
Title: i18n Linter and Auto-fixer

An i18n linting tool for exercises.

Catches common i18n problems in exercises and recommends solutions to fix them. Wherever possible the script can also automatically fix the problems with limited user interaction.

By default the script acts as a linter outputting errors that must be corrected by hand and a list of any errors that could be fixed automatically (which is still considered to be a linting failure).

If run with the --fix flag then the script will automatically fix the files in place wherever possible. The user will be prompted to clear up any ambiguities as well.

Fixes:
- Removes all usage of the gender methods (he/He/his/His)
- All usage of plural() (switching to a more-translatable format wherever possible)
- All inline ternary operators (e.g. `A == 1 ? "one" : "many"`)

I also adjusted a large number of exercises by hand to handle cases that were poorly translatable (for example cases where multiple plural numbers were used per string). This included removing methods like `groupVerb`.

To run the linter do:

`python build/lint_i18n_strings.py exercises/*.html`
or `make lint`

After applying this patch you should have no errors when running the linter.

To fix detected errors run:

`python build/lint_i18n_strings.py --fix exercises/*.html`
or `make fix_lint`