Page MenuHomePhabricator

Improve language code validation
Open, Needs TriagePublic0 Estimated Story Points

Description

We validate language codes for mediawiki export in the function "fixLang" in ZoteroService.js. However, output can be improved, both by modifying potential input instead of removing it, and also being more strict potentially with the post-fix.

Event Timeline

Mvolz raised the priority of this task from to Needs Triage.
Mvolz updated the task description. (Show Details)
Mvolz added a project: Citoid.
Mvolz moved this task to IO Tasks on the Citoid board.
Mvolz added a subscriber: Mvolz.

Hey @Mvolz, I guess that this report by a Polish Wikipedian also belongs here? Thanks.

Also, because the validation pattern in Citoid's fixLang is /^[a-z]{2}(?:-?[a-z]{2,})*$/i, it doesn't allow some values that would work with Wikipedia's CS1/2 citation templates, as listed here.

For example, abq-latn or es-419 do not match the pattern (resulting in Citoid getting rid of them), while these are valid values for CS1/2 templates' language parameter.