Skip to content

Translations

Webperf Core can write its reports in several languages. The translations live in locales/, one directory per language.

Available languages

Code Language
en English (default)
sv Swedish
da Danish
fi Finnish
is Icelandic
no Norwegian
gov A separate set for the public sector

Pick a language at run time:

python default.py -u https://example.com -t 22 -r -L sv

or permanently in settings.json:

{ "general": { "language": "sv" } }

How the files are organised

locales/
  sv/
    LC_MESSAGES/
      webperf-core.po     # shared strings and help texts
      webperf-core.mo     # the compiled version
      http_validator.po   # a pair of files per test
      ...

The format is gettext. You edit the .po file; the .mo file is the compiled one the program reads.

Improving a translation

  1. Find the right .po file under locales/<language>/LC_MESSAGES/
  2. Change the msgstr line. Leave msgid alone: it's the key
  3. Run the validation:
python default.py --update-translations

This checks that the language files line up and updates them.

Adding a new language

  1. Create locales/<code>/LC_MESSAGES/
  2. Copy the .po files from en as a starting point
  3. Translate each msgstr
  4. Run python default.py --update-translations
  5. Test it: python default.py -u https://example.com -t 22 -r -L <code>

Things to keep in mind

The placeholders must come along. {0} and {1} are replaced with values at run time. Leaving one out loses information, and swapping their order can make the result nonsense.

Line breaks matter. Many strings start with - or end with \n because they're assembled into a bullet list in the terminal.

Test names are more than help text. The TEXT_TEST_VALID_ARGUMENTS_* strings are the canonical names of the tests. Other systems read them, including this documentation and the /v1/tests endpoint on api.webperf.se. Changing one changes what a test is called everywhere.

See also