Tillegg¶
Add-ons provide ways to customize and automate the translation workflow. Admins can add and manage add-ons from the Manage ↓ Add-ons menu of each respective translation project or component. Add-ons can be also installed site-wide in Håndteringsgrensesnitt.
Hint
You can also configure add-ons using API,
DEFAULT_ADDONS, or install_addon.
Events that trigger add-ons¶
Add-on installation¶
Triggered when add-on is being installed.
Component update¶
Triggered whenever a change happens in a component such as:
Strings are changed in the repository.
A string is added.
A new translation is added.
Daily¶
Triggered daily, but add-ons usually split the daily load between components depending on BACKGROUND_TASKS.
Event change¶
Triggered after a Change event is created.
Repository post-add¶
Triggered just after the new translation is added and committed.
Repository post-commit¶
Triggered just after the changes are committed.
Repository post-push¶
Triggered just after the repository is pushed upstream.
Repository post-update¶
Triggered whenever new changes are pulled from the upstream repository.
Repository pre-commit¶
Triggered just before the changes are committed.
Repository pre-push¶
Triggered just before the repository is pushed upstream.
Repository pre-update¶
Triggered just before the repository update is attempted.
Storage post-load¶
Triggered when file is parsed by Weblate.
Unit post-save¶
Triggered just after the string is saved.
Unit pre-create¶
Triggered just after the newly created string is saved.
Built-in add-ons¶
Automatisk oversettelse¶
- Add-on ID:
weblate.autotranslate.autotranslate- Oppsett:
modeAutomatisk oversettelsesmodus
Available choices:
suggest– Add as suggestiontranslate– Add as translationfuzzy– Add as «Needing edit»filter_typeSøkefilter
Please note that translating all strings will discard all existing translations.
Available choices:
all– All stringsnottranslated– Untranslated stringstodo– Unfinished stringsfuzzy– Strings marked for editcheck:inconsistent– Failing check: Inconsistentcheck:translated– Failing check: Has been translatedauto_sourceSource of automated translations
Available choices:
others– Other translation componentsmt– Machine translationcomponentKomponent
Enter slug of a component to use as source, keep blank to use all components in the current project.
enginesMaskinoversettelsesmotorer
thresholdPoengsumsterskel
- Triggers:
Oversetter strenger automatisk ved hjelp av maskinoversettelse eller andre komponenter.
JavaScript-lokaliseringsinnholdsleveransenettverk¶
Added in version 4.2.
- Add-on ID:
weblate.cdn.cdnjs- Oppsett:
thresholdOversettelsesterskel
The percentage of translated strings that must be present for translation to be included.
css_selectorCSS-velger
CSS-velger for å oppdage lokaliserbare elementer.
cookie_nameNavn på språkinformasjonskapsel
Navn på informasjonskapselen som lagrer språkinnstillinger.
filesHent ut strenger fra HTML-filer
Liste over filnavn i gjeldende kodelager eller eksterne nettadresser å analysere for oversettbare strenger.
- Triggers:
Add-on installation, Daily, Repository post-commit, Repository post-update
Legger oversettelser i innholdsleveringsnettverk for bruk i JavaScript- eller HTML-lokalisering.
Can be used to localize static HTML pages, or to load localization in the JavaScript code.
Generates a unique URL for your component you can include in HTML pages to localize them. See Translating HTML and JavaScript using Weblate CDN for more details.
Merknad
This add-on requires additional configuration on the Weblate server.
LOCALIZE_CDN_PATH configures where generated files will be
written (on a filesystem), and LOCALIZE_CDN_URL defines where
they will be served (URL). Serving of the files is not done by Weblate and
has to be set up externally (typically using a CDN service).
This add-on is configured on Hosted Weblate and serves the files
via https://weblate-cdn.com/.
Fjern tomme strenger¶
Added in version 4.4.
- Add-on ID:
weblate.cleanup.blank- Oppsett:
This add-on has no configuration.
- Triggers:
Add-on installation, Repository post-commit, Repository post-update
Fjerner strenger uten oversettelse fra oversettelsesfiler.
Use this to not have any empty strings in translation files (for example if your localization library displays them as missing instead of falling back to the source string).
Rydd opp i oversettelsesfiler¶
- Add-on ID:
weblate.cleanup.generic- Oppsett:
This add-on has no configuration.
- Triggers:
Add-on installation, Repository post-update, Repository pre-commit
Oppdater alle oversettelsesfiler for å stemme overens med den enkeltspråkelige basisfila. For de fleste filformater, betyr dette fjerning av ubrukte oversettelsesnøkler, som ikke lenger finnes i basisfila.
For formats containing additional content besides translation strings (such as HTML files, Windows RC files, or OpenDocument Format) this also brings the translation file in sync with the base file.
Legg til manglende språk¶
- Add-on ID:
weblate.consistency.languages- Oppsett:
This add-on has no configuration.
- Triggers:
Sikrer at samme liste med språk anvendes for alle komponenter i et prosjekt.
Missing languages are checked once every 24 hours, and when new languages are added in Weblate.
Unlike most others, this add-on affects the whole project.
Hint
Auto-oversett nylig tillagt streng med Automatisk oversettelse.
Komponentoppdagelse¶
- Add-on ID:
weblate.discovery.discovery- Oppsett:
matchRegulært uttrykk å jamføre oversettelsesfiler mot
file_formatFilformat
name_templateTilpass komponentnavnet
base_file_templateDefiner ettspråklig basisfilnavn
La stå tom for tospråklige oversettelsesfiler.
new_base_templateDefiner basisfil for nye oversettelser
Navnet på filen brukt til å opprette nye oversettelser. For gettext velg .pot fil.
intermediate_templateMellomliggende språkfil
Filnavn for mellomliggende oversettelsesfil. I de fleste fall er dette en oversettesesfil som kommer fra utviklere, og brukes for opprettelse av de egentlige kildestrengene.
language_regexSpråkfilter
Regulært uttrykk å filtrere oversettelsesfiler mot ved skanning for filmaske.
copy_addonsKlon tillegg fra hovedkomponenten til de nylig opprettede
removeFjerner komponenter for ikke-eksisterende filer
confirmJeg bekrefter at ovennevnte treff ser ut til å stemme
- Triggers:
Legger automatisk til eller fjerner prosjektkomponenter basert på filendringer i versjonskontrollsystemet.
The matching is done using regular expressions enabling complex configuration, but some knowledge is required to do so. Some examples for common use cases can be found in the add-on help section.
The regular expression to match translation files has to contain two named groups to match component and language. All named groups in the regular expression can be used as variables in the template fields.
You can use Django template markup in all filename fields, for example:
{{ component }}Komponentfilnavns-treff
{{ component|title }}Komponentfilnavn med stor forbokstav
{{ path }}: {{ component }}Custom match group from the regular expression
Once you hit Save, a preview of matching components will be presented, from where you can check whether the configuration actually matches your needs:
Component discovery examples¶
One folder per language¶
Én mappe per språk, inneholdende oversettelsesfiler for komponenter.
- Regular expression:
(?P<language>[^/.]*)/(?P<component>[^/]*)\.po- Matching files:
cs/application.pocs/website.pode/application.pode/website.po
Gettext locales layout¶
Vanlig struktur for lagring av gettext-PO-filer.
- Regular expression:
locale/(?P<language>[^/.]*)/LC_MESSAGES/(?P<component>[^/]*)\.po- Matching files:
locale/cs/LC_MESSAGES/application.polocale/cs/LC_MESSAGES/website.polocale/de/LC_MESSAGES/application.polocale/de/LC_MESSAGES/website.po
Complex filenames¶
Bruker både komponent- og språk-navn i filnavn.
- Regular expression:
src/locale/(?P<component>[^/]*)\.(?P<language>[^/.]*)\.po- Matching files:
src/locale/application.cs.posrc/locale/website.cs.posrc/locale/application.de.posrc/locale/website.de.po
Repeated language code¶
Bruker språk i både sti og filnavn.
- Regular expression:
locale/(?P<language>[^/.]*)/(?P<component>[^/]*)/(?P=language)\.po- Matching files:
locale/cs/application/cs.polocale/cs/website/cs.polocale/de/application/de.polocale/de/website/de.po
Split Android strings¶
Android-ressursstrenger, inndelt i flere filer.
- Regular expression:
res/values-(?P<language>[^/.]*)/strings-(?P<component>[^/]*)\.xml- Matching files:
res/values-cs/strings-about.xmlres/values-cs/strings-help.xmlres/values-de/strings-about.xmlres/values-de/strings-help.xml
Matching multiple paths¶
Multi-module Maven project with Java properties translations.
- Regular expression:
(?P<originalHierarchy>.+/)(?P<component>[^/]*)/src/main/resources/ApplicationResources_(?P<language>[^/.]*)\.properties- Component name:
{{ originalHierarchy }}: {{ component }}- Matching files:
parent/module1/submodule/src/main/resources/ApplicationResources_fr.propertiesparent/module1/submodule/src/main/resources/ApplicationResource_es.propertiesparent/module2/src/main/resources/ApplicationResource_de.propertiesparent/module2/src/main/resources/ApplicationResource_ro.properties
Hint
Component discovery add-on uses Weblate internal URLs. It’s a convenient way to share
VCS setup between multiple components. Linked components use the local repository of
the main component set up by filling weblate://project/main-component
into the Kodelager for kildekode field (in Manage ↓ Settings ↓
Version control system) of each respective component.
This saves time with configuration and system resources too.
Se også
Masseredigering¶
- Add-on ID:
weblate.flags.bulk- Oppsett:
qSøk etter
stateTilstand å sette
Available choices:
-1– Do not change10– Needs editing20– Translated30– Approvedadd_flagsOversettelsesflagg å legge til
remove_flagsOversettelsesflagg å fjerne
add_labelsEtiketter å legge til
remove_labelsEtiketter å fjerne
- Triggers:
Masseredigering av flagg, etiketter, eller tilstand for strenger.
Examples:
Search query |
|
|---|---|
Etiketter å legge til |
recent |
Search query |
|
|---|---|
Oversettelsesflagg å legge til |
|
Search query |
|
|---|---|
Oversettelsesflagg å legge til |
|
Merk uendrede oversettelser som «Trenger handling»¶
- Add-on ID:
weblate.flags.same_edit- Oppsett:
This add-on has no configuration.
- Triggers:
Hver gang en ny oversettbar streng importeres fra VKS og den samsvarer med en kildestreng, blir dens behov for redigering flagget som sådan i Weblate. Spesielt nyttig for filformater som inkluderer kildestrenger for uoversatte strenger.
Hint
You might also want to tighthen the Uendret oversettelse check by adding
strict-same flag to Oversettelsflagg.
Se også
Merk nye kildestrenger som «Trenger handling»¶
- Add-on ID:
weblate.flags.source_edit- Oppsett:
This add-on has no configuration.
- Triggers:
Når en ny kildestreng importeres fra versjonskontrollsystemet, blir den markert som «Trenger redigering». På denne måten kan du enkelt filtrere og redigere kildestrenger skrevet av utviklerne.
Se også
Merk nye oversettelser som «Trenger handling»¶
- Add-on ID:
weblate.flags.target_edit- Oppsett:
This add-on has no configuration.
- Triggers:
Hver gang en ny oversettbar streng tas inn fra versjonskontrollsystemet, markeres den i Weblate med at den trenger handling. På denne måten kan du enkelt filtrere og endre oversettelser laget av utviklerne.
Se også
Fill read-only strings with source¶
Added in version 4.18.
- Add-on ID:
weblate.generate.fill_read_only- Oppsett:
This add-on has no configuration.
- Triggers:
Fills in translation of read-only strings with source string.
Statistikkgenerator¶
- Add-on ID:
weblate.generate.generate- Oppsett:
filenameNavn på generert fil
templateInnhold i den genererte fila
- Triggers:
Genererer en fil med detaljert info om oversettelsen.
You can use a Django template in both filename and content, see Template markup for a detailed markup description.
For example generating a summary file for each translation:
- Navn på generert fil
locale/{{ language_code }}.json- Innhold
{ "language": "{{ language_code }}", "strings": "{{ stats.all }}", "translated": "{{ stats.translated }}", "last_changed": "{{ stats.last_changed }}", "last_author": "{{ stats.last_author }}", }
Se også
Prefill translation with source¶
Added in version 4.11.
- Add-on ID:
weblate.generate.prefill- Oppsett:
This add-on has no configuration.
- Triggers:
Fyller inn oversettelsesstrenger med kildestreng.
All untranslated strings in the component will be filled with the source string, and marked as needing edit. Use this when you can not have empty strings in the translation files.
Generering av pseudolokalitet¶
Added in version 4.5.
- Add-on ID:
weblate.generate.pseudolocale- Oppsett:
sourceKildestrenger
targetMåloversettelse
Alle strenger i denne oversettelsen vil bli overskrevet
prefixPrepended static text
var_prefixPrepended variable text
suffixAppended static text
var_suffixAppended variable text
var_multiplierVariable text multiplier
How many times to repeat the variable text depending on the length of the source string.
include_readonlyInkluder skrivebeskyttede strenger
- Triggers:
Genererer en oversettelse automatisk ved å legge til innledning og endelse i kildestrenger.
Pseudolocales are useful to find strings that are not prepared for localization. This is done by altering all translatable source strings to make it easy to spot unaltered strings when running the application in the pseudolocale language.
Finding strings whose localized counterparts might not fit the layout is also possible.
Using the variable parts makes it possible to look for strings which might not
fit into the user interface after the localization - it extends the text based
on the source string length. The variable texts are repeated by length of the
text multiplied by the multiplier. For example Hello world with variable
text _ and variable multiplier of 1 becomes Hello world___________ -
the text is repeated once for each character in the source string.
The strings will be generated using following pattern:
Prepended static text Prepended variable text Source string Appended variable text Appended static text
Hint
You can use real languages for testing, but there are dedicated pseudolocales available in Weblate - en_XA and ar_XB.
Hint
You can use this add-on to start translation to a new locale of an existing language or similar language. Once you add the translation to the component, follow to the add-on. Example: If you have fr and want to start fr_CA translation, simply set fr as the source, fr_CA as the target, and leave the prefix and suffix blank.
Uninstall the add-on once you have the new translation filled to prevent Weblate from changing the translations made after the copying.
Bidragsytere i kommentar¶
- Add-on ID:
weblate.gettext.authors- Oppsett:
This add-on has no configuration.
- Triggers:
Oppdaterer kommentardelen i PO-filers topptekst med bidragsyternavn og antall år med bidrag.
PO-filhodet vil se slik ut:
# Michal Čihař <michal@weblate.org>, 2012, 2018, 2019, 2020.
# Pavel Borecki <pavel@example.com>, 2018, 2019.
# Filip Hron <filip@example.com>, 2018, 2019.
# anonymous <noreply@weblate.org>, 2019.
Oppdater ALL_LINGUAS-variabel i «configure»-filen¶
- Add-on ID:
weblate.gettext.configure- Oppsett:
This add-on has no configuration.
- Triggers:
Updates the ALL_LINGUAS variable in configure, configure.in or any
configure.ac files, when a new translation is added.
Tilpass gettext-utdata¶
- Add-on ID:
weblate.gettext.customize- Oppsett:
widthLinjebrying av lange linjer
Som standard bryter gettext linjer ved 77 tegn og ved linjeskift. Med parameteren –no-wrap brytes det bare ved linjeskift.
Available choices:
77– Wrap lines at 77 characters and at newlines (xgettext default)65535– Only wrap lines at newlines (like ’xgettext –no-wrap’)-1– No line wrapping- Triggers:
Tillater tilpasning av gettext-utdataoppførsel, for eksempel linjebryting.
Det gir følgende valg:
Linjebryt på 77 tegn og ved nylinjer
Kun linjebryt ved linjeskift
Ingen linjebryting
Merknad
By default gettext wraps lines at 77 characters and at newlines.
With the --no-wrap parameter, wrapping is only done at newlines.
Oppdater LINGUAS-fil¶
- Add-on ID:
weblate.gettext.linguas- Oppsett:
This add-on has no configuration.
- Triggers:
Oppdater LINGUAS-filen når nye oversettelser legges til.
Generer MO-filer¶
- Add-on ID:
weblate.gettext.mo- Oppsett:
pathSti for generert MO-fil
Hvis ikke angitt, vil plasseringen for PO-filen brukes.
fuzzyInclude strings needing editing
Strenger som trenger redigering (fuzzy) er typisk ikke klare til bruk som oversettelser.
- Triggers:
Lager en MO-fil for hver endret PO-fil automatisk.
The location of the generated MO file can be customized and the field for it uses Template markup.
Merknad
If a translation is removed, its PO file will be deleted from the repository, but the MO file generated by this add-on will not. The MO file must be removed from the upstream manually.
Oppdater PO-filer til å samsvare med POT (msgmerge)¶
- Add-on ID:
weblate.gettext.msgmerge- Oppsett:
previousBehold tidligere msgid-er for oversatte strenger
no_locationFjern plasseringer av oversatte strenger
fuzzyBruk fuzzy jamføring
- Triggers:
Updates all PO files (as configured by Filmaske) to match the POT file (as configured by Mal for nye oversettelser) using msgmerge.
Most msgmerge command-line options can be set up through the add-on configuration.
Slå sammen historikk¶
- Add-on ID:
weblate.git.squash- Oppsett:
squashSammenslåing av historikk
Available choices:
all– All commits into onelanguage– Per languagefile– Per fileauthor– Per authorappend_trailersLegg til trailere til historikk
Sluttlinjer er linjer som ligner på RFC 822 e-postoverskrifter, på slutten av den ellers frie formdelen av en innsjekksmelding, for eksempel ’Co-authored-by: …’.
commit_messageInnsjekksmelding
Innsendelsesmeldingen vil brukes istedenfor den helhetlige innsendelsesmeldingen fra de moste innsendelsene.
- Triggers:
Slå sammen historikken før endringene overføres.
Git commits can be squashed prior to pushing changes in one of the following modes:
Alle innslag slås sammen til ett
Per språk
Per fil
Per forfatter
Original commit messages are kept, but authorship is lost unless Per author is selected, or the commit message is customized to include it.
The original commit messages can optionally be overridden with a custom commit message.
Trailers (commit lines like Co-authored-by: …) can optionally be removed
from the original commit messages and appended to the end of the squashed
commit message. This also generates proper Co-authored-by: credit for every
translator.
Tilpass JSON-utdata¶
Endret i version 5.12: Avoid spaces after separators option added.
- Add-on ID:
weblate.json.customize- Oppsett:
sort_keysSorter JSON-nøkler
use_compact_separatorsAvoid spaces after separators
indentJSON-innrykk
styleJSON-innrykksstil
Available choices:
spaces– Spacestabs– Tabs- Triggers:
Allows adjusting JSON output behavior, for example indentation, sorting or compact formatting using minimal whitespace.
Formater Java-egenskapsfila¶
- Add-on ID:
weblate.properties.sort- Oppsett:
case_sensitiveEnable case-sensitive key sorting
- Triggers:
Formaterer og sorterer Java-egenskapsfila.
Consolidates newlines to Unix ones.
Uppercase formatting of Unicode escape sequences (in case they are present).
Strips blank lines and comments.
Sorts the strings by the keys.
Drops duplicate strings.
Fjerning av gamle kommentarer¶
- Add-on ID:
weblate.removal.comments- Oppsett:
ageDager å beholde
- Triggers:
Sett tidsramme for fjerning av kommentarer.
This can be useful to remove old comments which might have become outdated. Use with care as comments getting old does not mean they have lost their importance.
Fjerning av gamle forslag¶
- Add-on ID:
weblate.removal.suggestions- Oppsett:
ageDager å beholde
votesStemmeterskel
Terskel for fjerning. Dette feltet har ingen effekt når avstemming er avskrudd.
- Triggers:
Sett tidsramme for fjerning av forslag.
Can be very useful in connection with suggestion voting (see Peer review) to remove suggestions which don’t receive enough positive votes in a given timeframe.
Oppdater RESX-filer¶
- Add-on ID:
weblate.resx.update- Oppsett:
This add-on has no configuration.
- Triggers:
Oppdater alle oversettelsesfiler for å stemme overens med den enkeltspråkelige basisfila oppstrøms. Ubrukte strenger fjernes, og nye legges til som kopier av kildestrengen.
Hint
Use Rydd opp i oversettelsesfiler if you only want to remove stale translation keys.
Slack Webhooks¶
Added in version 5.12.
- Add-on ID:
weblate.webhook.slack- Oppsett:
webhook_urlWebhook URL
eventsChange events
Available choices:
0– Resource updated1– Translation completed2– Translation changed3– Comment added4– Suggestion added5– Translation added6– Automatically translated7– Suggestion accepted8– Translation reverted9– Translation uploaded13– Source string added14– Component locked15– Component unlocked17– Changes committed18– Changes pushed19– Repository reset20– Repository merged21– Repository rebased22– Repository merge failed23– Repository rebase failed24– Parsing failed25– Translation removed26– Suggestion removed27– Translation replaced28– Repository push failed29– Suggestion removed during cleanup30– Source string changed31– String added32– Bulk status changed33– Visibility changed34– User added35– User removed36– Translation approved37– Marked for edit38– Component removed39– Project removed41– Project renamed42– Component renamed43– Moved component45– Contributor joined46– Announcement posted47– Alert triggered48– Language added49– Language requested50– Project created51– Component created52– User invited53– Repository notification received54– Translation replaced file by upload55– License changed56– Contributor license agreement changed57– Screenshot added58– Screenshot uploaded59– String updated in the repository60– Add-on installed61– Add-on configuration changed62– Add-on uninstalled63– String removed64– Comment removed65– Comment resolved66– Explanation updated67– Category removed68– Category renamed69– Category moved70– Saving string failed71– String added in the repository72– String updated in the upload73– String added in the upload74– Translation updated by source upload75– Component translation completed76– Applied enforced check77– Propagated change78– File uploaded79– Extra flags updated- Triggers:
Sends notification to a Slack channel based on selected events.
Advarsel
The notification content might show HTML tags. This is a known issue that will be soon addressed; see https://github.com/WeblateOrg/weblate/issues/15056.
Hint
To obtain a webhook URL, follow the steps outlined in the Slack Incoming Webhooks documentation
Webhook¶
Added in version 5.11.
- Add-on ID:
weblate.webhook.webhook- Oppsett:
webhook_urlWebhook URL
secretSecret
A Base64 encoded string
eventsChange events
Available choices:
0– Resource updated1– Translation completed2– Translation changed3– Comment added4– Suggestion added5– Translation added6– Automatically translated7– Suggestion accepted8– Translation reverted9– Translation uploaded13– Source string added14– Component locked15– Component unlocked17– Changes committed18– Changes pushed19– Repository reset20– Repository merged21– Repository rebased22– Repository merge failed23– Repository rebase failed24– Parsing failed25– Translation removed26– Suggestion removed27– Translation replaced28– Repository push failed29– Suggestion removed during cleanup30– Source string changed31– String added32– Bulk status changed33– Visibility changed34– User added35– User removed36– Translation approved37– Marked for edit38– Component removed39– Project removed41– Project renamed42– Component renamed43– Moved component45– Contributor joined46– Announcement posted47– Alert triggered48– Language added49– Language requested50– Project created51– Component created52– User invited53– Repository notification received54– Translation replaced file by upload55– License changed56– Contributor license agreement changed57– Screenshot added58– Screenshot uploaded59– String updated in the repository60– Add-on installed61– Add-on configuration changed62– Add-on uninstalled63– String removed64– Comment removed65– Comment resolved66– Explanation updated67– Category removed68– Category renamed69– Category moved70– Saving string failed71– String added in the repository72– String updated in the upload73– String added in the upload74– Translation updated by source upload75– Component translation completed76– Applied enforced check77– Propagated change78– File uploaded79– Extra flags updated- Triggers:
Sends notifications to external services based on selected events, following the Standard Webhooks specification.
The request payload complies with the Weblate Messaging schema.
The OpenAPI description can also be found at /api/docs/.
Sample request body:
{
"change_id": 99,
"action": "Translation changed",
"timestamp": "2019-08-24T14:15:22Z",
"target": "Nazdar svete!",
"old": "Nazdar!",
"source": "Hello, world",
"url": "/translate/project-slug/component-slug/cs/?checksum=46add148a53cab6f",
"author": "author-username",
"user": "user-username",
"project": "project-slug",
"component": "component-slug",
"translation": "cs"
}
Sample request body with categories:
{
"change_id": 8910,
"action": "Component renamed",
"timestamp": "2025-06-11T07:15:09Z",
"target": ["new-name"],
"old": ["component-slug"],
"url": "/projects/project-slug/parent-category/child-category/sub-category/component-slug/",
"user": "testuser",
"project": "project-slug",
"component": "component-slug",
"category": [
"sub-category",
"child-category",
"parent-category"
]
}
Sample request headers:
{
"webhook-id": "7f1c5477f6275a69af7b83236c20cb1a",
"webhook-timestamp": "1748505623.044281",
"webhook-signature": "v1,Ceo5qEr07ixe2NLpvHk3FH9bwy/WavXrAFQ/9tdO6mc="
}
The webhook-signature is a space separated list of HMAC signatures generated using the secret string,
the request payload, the webhook-timestamp, and the webhook-id. This ensures the authenticity
and integrity of the webhook request.
To verify a request, you can use the Webhook.verify method from the standardwebhooks library
or an implementation of the «Standard Webhooks Specification».
Customize XML output¶
Added in version 4.15.
- Add-on ID:
weblate.xml.customize- Oppsett:
closing_tagsInclude closing tag for blank XML tags
- Triggers:
Allows adjusting XML output behavior, for example closing tags.
Tilpass YAML-utdata¶
- Add-on ID:
weblate.yaml.customize- Oppsett:
indentYAML-innrykk
widthLinjebrying av lange linjer
Available choices:
80– Wrap lines at 80 chars100– Wrap lines at 100 chars120– Wrap lines at 120 chars180– Wrap lines at 180 chars65535– No line wrappingline_breakLinjeskift
Available choices:
dos– DOS (\r\n)unix– UNIX (\n)mac– MAC (\r)- Triggers:
Tillater justering av YAML-utdataoppførsel, for eksempel linjelegde eller -brytning.
Customizing list of add-ons¶
The list of add-ons is configured by WEBLATE_ADDONS.
To add another add-on, simply include the absolute class name in this setting.
Writing add-on¶
You can write your own add-ons too, create a subclass of
weblate.addons.base.BaseAddon to define the add-on metadata, and
then implement a callback to do the processing.
Se også
Executing scripts from add-on¶
Add-ons can also be used to execute external scripts. This used to be integrated in Weblate, but now you have to write some code to wrap your script with an add-on.
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Example pre commit script."""
from django.utils.translation import gettext_lazy
from weblate.addons.events import AddonEvent
from weblate.addons.scripts import BaseScriptAddon
class ExamplePreAddon(BaseScriptAddon):
# Event used to trigger the script
events: set[AddonEvent] = {
AddonEvent.EVENT_PRE_COMMIT,
}
# Name of the addon, has to be unique
name = "weblate.example.pre"
# Verbose name and long description
verbose = gettext_lazy("Execute script before commit")
description = gettext_lazy("This add-on executes a script.")
# Script to execute
script = "/bin/true"
# File to add in commit (for pre commit event)
# does not have to be set
add_file = "po/{{ language_code }}.po"
Installasjonsinstruks er å finne på Custom quality checks, add-ons and auto-fixes.
The script is executed with the current directory set to the root of the VCS repository for any given component.
Additionally, the following environment variables are available:
- WL_VCS¶
Versjonskontrollsystem brukt.
- WL_REPO¶
Upstream repository URL.
- WL_PATH¶
Absolutt sti til VKS-kodelager.
- WL_BRANCH¶
Repository branch configured in the current component.
- WL_FILEMASK¶
Filmaske for nåværende komponent.
- WL_TEMPLATE¶
Filnavn for mal for enkeltspråklige oversettelser (kan stå tomt).
- WL_NEW_BASE¶
Filename of the file used for creating new translations (can be empty).
- WL_FILE_FORMAT¶
File format used in current component.
- WL_LANGUAGE¶
Language of currently processed translation (not available for component-level hooks).
- WL_PREVIOUS_HEAD¶
Previous HEAD after update (only available after running the post-update hook).
- WL_COMPONENT_SLUG¶
Component slug used to construct URL.
- WL_PROJECT_SLUG¶
Project slug used to construct URL.
- WL_COMPONENT_NAME¶
Komponentnavn.
- WL_PROJECT_NAME¶
Prosjektnavn.
- WL_COMPONENT_URL¶
Komponent-nettadresse.
- WL_ENGAGE_URL¶
Project engage URL.
Se også
Post-update repository processing¶
Can be used to update translation files when the VCS upstream source changes. To achieve this, please remember Weblate only sees files committed to the VCS, so you need to commit changes as a part of the script.
For example with Gulp you can do it using following code:
#! /bin/sh
gulp --gulpfile gulp-i18n-extract.js
git commit -m 'Update source strings' src/languages/en.lang.json
Pre-commit processing of translations¶
Use the commit script to automatically change a translation before it is committed to the repository.
It is passed as a single parameter consisting of the filename of a current translation.
Add-on activity logging¶
Add-on activity log keeps track of the add-on execution and can be used to keep track of add-on activity.
The logs can be pruned after a certain time interval by configuring the ADDON_ACTIVITY_LOG_EXPIRY.