Khan/khan-exercises — pull request #44718 by jeresig (2013-04-16 21:17:52+00:00)
Title: 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`

See also the following for the Python review:
http://phabricator.khanacademy.org/D2143