Skip to content

Localization

The Browsertrix UI supports multiple languages. Browsertrix end users can set a language preference in their account settings.

Contributing

Translations are managed through Weblate, a web-based translation tool. Registration is free! Once registered, you can submit translations for review by Browsertrix maintainers.

Register for Weblate

Adding a Language

Adding support for a new language involves a small code change. If you'd like to add a new language and would prefer that a Browsertrix maintainer make the change, submit a Localization Request on GitHub. A Browsertrix maintainer will respond to your request on GitHub.

To add a new language directly through code change:

  1. Look up the BCP 47 language tag and add it to the targetLocales field in lit-localize.json.

    {
      // ...
      "sourceLocale": "en",
      "targetLocales": [
        "es",
        // Add your language tag here
        ],
    }
    

  2. Generate a new XLIFF file by running:

    yarn localize:extract
    
    This will add an .xlf file named after the new language tag to the /xliff directory.

  3. Open a pull request with the changes.

  4. Once the pull request is merged, manually refresh the language list in the Weblate Browsertrix project. Translations are managed entirely through the Weblate interface.

New languages will be available in user preferences only after the app is redeployed.

Making Strings Localizable

All text should be wrapped in the msg helper to make them localizable:

import { msg } from "@lit/localize";

// later, in the render function:
render() {
  return html`
    <button>
      ${msg("Click me")}
    </button>
  `
}

See Lit's message types documentation page for details.