Open funkyfuture opened 8 years ago
Replacement of keywords instead of the exact phrase can lead to some problems with localization; for example, in Russian "configuration file" may be: "файл конфигурации", "файла конфигурации", "файлу конфигурации", "файлом конфигурации", "файле конфигурации"
Also "must be" may be:
what are these derivations caused by? are these nouns to be used in different cases (like lat: casus)?
differentiations of singular and plural is a must. would it be feasible to replace the noun and verbum spanning part? with agglutinating languages this idea propably won't work at all. maybe we should develop a localization framework first that also takes grammar as input. ;-)
please keep in mind that my native tongue is a cases-poor germanic one. in these regards it's a shame that the soviet union wasn't the avantgarde in computing. though it was propably easier to develop computing systems with a simple language as english.
this is a followup of https://github.com/nicolaiarocci/cerberus/issues/174, and here's a first design write-up:
The
HumanErrorHandler
produces text output that is read and interpreted by human beings. Most use-cases will propably inform users about invalid configurations and form data. Here are some ideas for features and options:Value substitutions allow to replace document and schema constraint values. For example, a regex pattern that matches any URL would be replaced with "an URL".
The extent of communicated error description is configurable per error type. For example:
Similar errors over various fields are aggregated, eg:
Some keywords can be replaced to match the application's context. For instance, the output may talk about a 'configuration file' instead of a 'document'.
Error messages can be localized.
The output might be aimed at terminal or html output and thus consider terminal / file line width or include tags and attributes.
In the end, this will not be trivial. But lesser demand wouldn't matter, given the targeted entities.
@luizpericolo @andreymal @Pithikos @k1-hedayati you might be interested in that.
addendum: a first implementation doesn't need to be feature-complete, but the anticipations must be reflected.