Skip to content

Automated tests for all locales (ja, oc, sample, de) and missing translations #19

Description

@codeling

Problem

The automated tests of PR #11 run with the English locale only. The other locale files (locales/de.php, ja.php, oc.php, sample.php) are not tested: they are not even known to load without errors, and new texts may be missing in them. The keys Wrong password (login) and Invalid page name were added without translations (de.php has Wrong password since PR #11; the others fall back to the English text, which __() handles by returning the key).

Tests to add

  • Let the harness set W2_LOCALE (configOverrides()), and run a smoke test for each locale file: every main view renders (status 200, no PHP warnings, see RegressionTest), the page language attribute is correct, and translated texts appear (e.g. the toolbar tooltips).
  • Unit test: every locale file is valid PHP, defines $w2_word_set as an array of strings, has no duplicate keys, and the values keep their format (e.g. date_format is a valid format string).
  • A completeness check against locales/en.php / the keys used with __() in the code (extract them with the tokenizer, like SourceGuardTest), reporting missing keys per locale; decide whether missing keys fail the build or only produce a report.
  • Security: translations are escaped by __() (h()), so a locale value with quotes or markup (e.g. " or <) cannot break out of attributes; test this with a generated locale.
  • Characters: non-ASCII text and the W2_CHARSET meta tag are consistent (files are UTF-8).

Also add the missing translations (Wrong password, Invalid page name, ...) for the existing locales, if the maintainers of those translations agree.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions