Optional Weblate modules

Several optional modules are available for your setup.

Git exporter

Provides you read-only access to the underlying Git repository using HTTP(S). Git fetch request bodies can use gzip compression; Weblate limits the decoded request body to 10 MiB before passing it to Git. Weblate also limits each fetch negotiation to 8,192 packets and 64 shallow-exclusion requests. A Git backend that stops producing output for 30 seconds is terminated; large fetches can continue as long as the backend keeps producing output. The initial HTTP headers must arrive within two minutes.

Installation

  1. Add weblate.gitexport to installed apps in settings.py:

    INSTALLED_APPS += ("weblate.gitexport",)
    
  2. Export existing repositories by migrating your database after installation:

    weblate migrate
    

Hint

Git exporter is turned on in our official Docker image. To turn it off, use:

WEBLATE_REMOVE_APPS=weblate.gitexport

Usage

The module automatically hooks into Weblate and sets the exported repository URL in the Component configuration. The repositories are accessible under the /git/ part of the Weblate URL, for example https://example.org/git/weblate/main/.

Repositories for publicly available projects can be cloned without authentication:

git clone 'https://example.org/git/weblate/main/'

Access to browse the repositories with restricted access (with Private access control or when REQUIRE_LOGIN is enabled) requires an API token which can be obtained in your user profile:

git clone 'https://user:KEY@example.org/git/weblate/main/'

Note

Weblate serves the Git repository itself, but it does not serve Git LFS objects. See Git LFS for supported behavior. Clone repositories using Git LFS from the upstream repository and add Weblate as another remote. If you only need Git-tracked files, you can clone from Weblate with GIT_LFS_SKIP_SMUDGE=1 to skip downloading Git LFS objects.

Hint

By default members of Users group and anonymous user have access to the repositories for public projects via Access repository and Power user roles.

Billing

This is used on Hosted Weblate to define billing plans, track invoices and usage limits.

Installation

1. Add weblate.billing to installed apps in settings.py:

INSTALLED_APPS += ("weblate.billing",)
  1. Run the database migration to optionally install additional database structures for the module:

weblate migrate

Billing plan creation and assignment

You first need to create a billing plan to activate billing. Navigate to the Administration section (represented by the wrench icon) and open the Tools screen. From there, proceed to the Django admin interface.

In the Django admin interface, locate the BILLING section and add a billing plan. For instance, you can add a Free plan with no cost.

If you wish to assign a billing plan to an existing project, this can also be done within the Django admin interface using the Customer billings option.

Lastly, the Django admin interface provides an Invoice option for logging your customer payments.

Libre hosting cleanup

Hosted Weblate checks active subscriptions with zero monthly and yearly prices each day. Cleanup covers all projects in the workspace. Weblate warns the workspace billing contacts by e-mail after 90 days with no components anywhere in the workspace, a missing license, or an unmet Libre hosting condition. Persistent repository update, push, merge, or recovery failures also qualify, as do outstanding upstream or outgoing changes reported by the repository diagnostics. Dismissing a diagnostic leaves the underlying issue eligible. A repository can be quiet and still be in sync.

The management alerts page lists projects scheduled for removal. The Scheduled removal warning on the project and billing pages lists the issues and the date by which to resolve them. Follow View affected components in the warning or its e-mail to see diagnostics, including dismissed ones. For subscriptions covering several projects, this link opens workspace diagnostics. In workspace and project diagnostics and on each component’s alerts tab, the May affect Libre hosting badge identifies issues that can trigger a warning if they persist. Workspace and project diagnostics list these issues first. Weblate locks all existing components in the workspace for translation when it issues the warning. Maintainers can unlock them at any time, including after the warning clears or the trial starts.

Fix the listed issues within 30 days to keep active Libre hosting. Moving the project to another billing resets the warning. Once Weblate records the last qualifying issue as resolved, refresh the page to see the warning clear. If a listed issue persists, the subscription enters a 30-day Libre trial. Fix the Libre hosting checklist and request approval again from the billing page. An expired trial follows the usual removal grace period and backup process.

Externally managed payments

Billing records use local invoices to determine paid validity by default. An integration can explicitly set Billing.payment_mode to Billing.PaymentMode.EXTERNAL and supply an aware datetime in external_paid_until. In this mode, local invoices remain available as history but do not establish paid validity. An unset timestamp grants no paid validity. Free plans and trials retain their existing behavior.

The timestamp can be extended, shortened, or cleared. Normal model saves recalculate the paid status; bulk database updates bypass this calculation. Payment validity includes BILLING_GRACE_PERIOD, while check_payment_status(now=True) checks validity without that grace period. Expired external billings use the existing unpaid notification and removal schedule. Restoring validity for an active external billing cancels scheduled removal, including removal work already queued before renewal.

Changing payment mode does not change the plan, workspace, or billing lifecycle state. Switching back to Billing.PaymentMode.LOCAL uses local invoices again and ignores the retained external timestamp. These integration fields are not exposed in forms or REST APIs.

Merging billings is supported only when both use local payment mode. A merge involving an externally managed billing is rejected without changing either billing. External entitlement transfers require coordination by the integration.

Integrations must manage authentication, update ordering, and atomic entitlement updates. They must explicitly activate trials or reactivate terminated billings when appropriate, and exclude externally managed billings from local checkout and recurring payment processing. Local recurring payment inactivity assessment does not apply to externally managed billings.

Usage

After installation you can control billing in the admin interface. Users with billing enabled will get new Billing tab in their User profile.

Superusers can view the 20 most recent billing audit entries on the billing detail page. Select View all in the Audit log section to browse older entries using the pagination controls.

The billing module additionally allows users to create new projects and components without being superusers (see Adding translation projects and components). This is possible when following conditions are met:

  • The billing is in its configured limits (any overusage results in blocking of project/component creation) and paid (if its price is non zero)

  • The user has Add projects to workspace permission for the workspace covered by the billing plan.

When creating a project, users can choose which workspace should contain it. Projects created in a workspace with billing count against the billing plan assigned to that workspace. See Billing for billing permissions and notifications.

Avatars

Avatars are downloaded and cached server-side to reduce information leaks to the sites serving them by default. The built-in support for fetching avatars from e-mails addresses configured for it can be turned off using ENABLE_AVATARS.

Weblate currently supports:

Localization CDN

The JavaScript localization CDN and Translation files CDN add-ons write files to LOCALIZE_CDN_PATH; Weblate does not serve them. Configure the web server or CDN serving LOCALIZE_CDN_URL as a public, read-only static file host.

Treat every published CDN file as public. The add-on specific UUID in the URL is not an access-control mechanism. Do not enable CDN add-ons for components that contain private strings, unreleased product text, customer data, internal URLs, API examples, repository paths, translator comments, or file-format metadata that should not be exposed.

The Translation files CDN add-on publishes raw translation files in formats supported by Weblate. Some formats can be interpreted by browsers or other clients as HTML, SVG, XML, JavaScript, YAML, or application-specific configuration. Serve the CDN from a dedicated domain that is separate from Weblate and from the application consuming the translations. Do not share authentication cookies with the CDN domain.

The Translation files CDN skips symbolic links in translation files and their parent directories. The next successful publication removes skipped files from the manifest and the CDN origin. For immediate cleanup after an upgrade, remove affected files from the origin and purge their URLs from the CDN cache. Removing origin files cannot revoke previously downloaded copies. Rotate any exposed credentials.

Recommended server configuration:

  • Serve only the directory configured by LOCALIZE_CDN_PATH; do not expose Weblate repositories, backups, media, configuration, or the whole data directory.

  • Disable directory listing.

  • Deny access to .kotlin-sdk-staging and all its contents. The Kotlin SDK add-on uses this directory for temporary preparation, not publication. Apply this restriction before enabling the add-on, including when a CDN copies files from the origin directory.

  • Use HTTPS and make the CDN host read-only from the web server.

  • Send X-Content-Type-Options with nosniff.

  • Configure conservative MIME types. Serve unknown translation formats as text/plain or application/octet-stream; only serve weblate.js as JavaScript.

  • For raw translation formats that are not intended to be rendered in a browser, consider adding Content-Disposition with attachment.

  • Configure Access-Control-Allow-Origin only for sites that need browser access to the files.

  • Set cache lifetimes that match your update expectations, and purge CDN caches when stale translations must disappear quickly.

The following nginx snippet serves only the configured CDN directory and applies conservative defaults for raw translation files:

weblate/examples/weblate.nginx.cdn.conf
#
# nginx configuration for the Weblate localization CDN
#
# You will want to change:
#
# - server_name to match the host configured in LOCALIZE_CDN_URL
# - root to match LOCALIZE_CDN_PATH
# - Access-Control-Allow-Origin to the sites that need browser access
# - TLS configuration if HTTPS is not terminated before nginx
#
server {
    listen 80;
    server_name cdn.example.com;

    # LOCALIZE_CDN_PATH
    root /home/weblate/data/l10n-cdn;

    autoindex off;
    disable_symlinks on;

    location = / {
        return 404;
    }

    # Kotlin SDK preparation files must never be served.
    location ^~ /.kotlin-sdk-staging {
        return 404;
    }

    # The JavaScript localization add-on publishes this loader.
    location ~ "^/[0-9a-f]{32}/weblate\.js$" {
        try_files $uri =404;

        types {
            application/javascript js;
        }
        default_type application/javascript;

        add_header X-Content-Type-Options nosniff always;
        # add_header Access-Control-Allow-Origin "https://www.example.com" always;

        expires 1h;
    }

    # Content-addressed Android artifacts never change at the same URL.
    location ~ "^/[0-9a-f]{32}/artifacts/[0-9a-f]{64}\\.arsc$" {
        try_files $uri =404;
        types { }
        default_type application/octet-stream;
        add_header X-Content-Type-Options nosniff always;
        add_header Content-Disposition "attachment" always;
        add_header Cache-Control "public, max-age=31536000, immutable";
        # add_header Access-Control-Allow-Origin "https://www.example.com" always;
    }

    # Other CDN files are translation files. Serve them conservatively so raw
    # formats are not interpreted as active browser content.
    # Manifest JSON files also use this one-hour cache policy.
    location / {
        try_files $uri =404;

        types {
        }
        default_type text/plain;

        add_header X-Content-Type-Options nosniff always;
        add_header Content-Disposition "attachment" always;
        # add_header Access-Control-Allow-Origin "https://www.example.com" always;

        expires 1h;
    }
}

Signing Git commits with GnuPG

All commits can be signed by the GnuPG key of the Weblate instance.

  • Turn on WEBLATE_GPG_IDENTITY. (Weblate will generate a GnuPG key when needed and will use it to sign all translation commits.)

    This feature needs GnuPG 2.1 or newer installed.

    You can find the key in the DATA_DIR and the public key is shown on the “About” page:

    ../_images/about-gpg.webp
  • Alternatively you can also import existing keys into Weblate, just set HOME=$DATA_DIR/home when invoking gpg.

Hint

The key material is cached by Weblate for a long period. In case you let Weblate generate a key with WEBLATE_GPG_IDENTITY and then import key with the same identity to use an existing key, purging redis cache is recommended to see the effect of such change.

Note

When sharing DATA_DIR between multiple hosts, please follow instructions at https://wiki.gnupg.org/NFS to make GnuPG signing work reliably.

Rate limiting

Changed in version 4.6: The rate limiting no longer applies to signed in superusers.

Several operations in Weblate are rate limited. Rate limits are evaluated independently for each scope. At most RATELIMIT_ATTEMPTS attempts are allowed within RATELIMIT_WINDOW seconds in one scope. That scope is then blocked for RATELIMIT_LOCKOUT; Weblate does not turn this into a sitewide temporary IP ban. Exceeding one scope, such as TRANSLATE or SEARCH, does not by itself block unrelated scopes such as LOGIN or SECOND_FACTOR. There are also settings specific to scopes, for example RATELIMIT_CONTACT_ATTEMPTS or RATELIMIT_TRANSLATE_ATTEMPTS. The table below is a full list of available scopes.

The following operations are subject to rate limiting:

Name

Scope

Allowed attempts

Ratelimit window

Lockout period

Registration

REGISTRATION

5

300

600

Sending message to admins

MESSAGE

2

300

600

Password authentication on sign-in

LOGIN

5

300

600

Password reset

PASSWORD_RESET

5

300

600

Second-factor authentication

SECOND_FACTOR

5

300

600

Sitewide search

SEARCH

6

60

60

Screenshot image text suggestions

OCR

6

60

60

Translating

TRANSLATE

30

60

600

Adding to glossary

GLOSSARY

30

60

600

Starting translation into a new language

LANGUAGE

2

300

600

Creating new project

PROJECT

5

600

600

Connecting a GitHub account

GITHUB_SETUP

100

3600

600

Loading component branches

COMPONENT_BRANCHES

30

60

60

Rendering a Markdown preview

MARKDOWN_PREVIEW

60

60

60

Within each scope, the rate limiting is based on sessions when user is signed in and on IP address if not.

Strict enforcement across concurrent workers requires a cache backend with atomic increment and decrement operations. The standard Configure cache configuration using Valkey or Redis provides these operations.

For signed-in users, Weblate records the first rejected request during each active scope lockout in the Activity, including the scope and request path. Repeated rejections during the same lockout do not create additional audit-log entries.

If a user fails to sign in AUTH_LOCK_ATTEMPTS times, password authentication will be turned off on the account until having gone through the process of having its password reset.

The settings can be also applied in the Docker container by adding WEBLATE_ prefix to the setting name, for example RATELIMIT_ATTEMPTS becomes WEBLATE_RATELIMIT_ATTEMPTS.

The API has separate rate limiting settings, see API rate limiting.