Skip to content

Add translation file validation

Background

Invalid translation files can lead to users not being able to install the extension (e.g. trac#6666) and it's difficult to spot such issues beforehand since there are dozens of different languages. Therefore we should validate translation files.

What to change

Include linting step for translation files to ensure that they are valid by checking for the following:

  • Files
    • Is locale format valid?
    • Is file extension .json?
    • Does file exist in default locale? (see #263 (closed))
    • Is content valid JSON?
  • Strings
    • Is string ID format valid?
    • Does string ID exist in default locale? (see #263 (closed))
    • Does message property exist?
    • If string contains placeholder, does placeholders property exist?
  • Placeholders
    • Is placeholder syntax valid? incl. no $# style placeholders are used
    • Does placeholder exist in default locale? (see #263 (closed))
    • Do all placeholders from default locale exist? (see #263 (closed))
    • Does corresponding item in placeholders exist?
    • Does string contain placeholder for each item in placeholders?
  • Tags
    • Is tag syntax valid?
    • Does tag exist in default locale? (see #263 (closed))
    • Do all tags from default locale exist? (see #263 (closed))
    • Is there exactly one end tag for each start tag?
    • Is there exactly one start tag for each end tag?
    • Is the tag structure hierarchical? e.g. <a><strong>foo</a></strong>
Edited by Thomas Greiner
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information