AdguardTeam / FiltersCompiler

A tool that compiles & validates filters
GNU Lesser General Public License v3.0
52 stars 12 forks source link

Improve validation script for required locales #129

Closed slavaleleka closed 2 years ago

slavaleleka commented 2 years ago

@slavaleleka commented on Wed Dec 08 2021

If base locale contains such translation objects:

{
    "filter.1.name": "AdGuard Russian filter",
    "filter.1.description": "Filter that enables ad blocking on websites in the Russian language."
},
{
    "filter.2.name": "AdGuard Base filter",
    "filter.2.description": "EasyList + AdGuard Base filter. This filter is necessary for quality ad blocking."
}

and some other locale (for example, de) has such ones (filter.1.description is absent):

{
    "filter.1.name": "AdGuard — Russischer Filter",
},
{
    "filter.2.name": "AdGuard — Basisfilter",
    "filter.2.description": "EasyList + AdGuard Basisfilter. Dieser Filter ist für die Verbesserung zum Sperren von Werbung erforderlich."
}

locale validation script will throw error:

- de:
  - critical priority - invalid or absent message key/value:
      "filter.1.name": "AdGuard — Russischer Filter",

That's fine.


But if one of required locales does not have both keys (filter.1.name and filter.1.description are missed):

{
    "filter.2.name": "AdGuard — Basisfilter",
    "filter.2.description": "EasyList + AdGuard Basisfilter. Dieser Filter ist für die Verbesserung zum Sperren von Werbung erforderlich."
},

there is no error while validation but it should be thrown