Improve JSON error handling.
Replace ngettext with ungettext.