Kiegészítők#
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 component.
Tipp
You can also configure add-ons using API,
DEFAULT_ADDONS, or install_addon.
Built-in add-ons#
Automatikus fordítás#
- Add-on ID:
weblate.autotranslate.autotranslate- Beállítások:
modeAutomatikus fordítási mód
Available choices:
suggest– Add as suggestiontranslate– Add as translationfuzzy– Add as „Needing edit”filter_typeKeresési szűrő
Ne feledje, hogy az összes szöveg fordítása elveti az összes meglévő fordítást.
Available choices:
all– All stringsnottranslated– Untranslated stringstodo– Unfinished stringsfuzzy– Strings marked for editcheck:inconsistent– Failing check: Inconsistentauto_sourceAutomatikus fordítások forrása
Available choices:
others– Other translation componentsmt– Machine translationcomponentÖsszetevő
Adja meg a forrásként használandó összetevő keresőbarát URL-ét. Hagyja üresen a jelenlegi projektben lévő összes összetevő használatához.
enginesGépi fordítómotorok
thresholdPontszámküszöb
- Triggers:
component update, daily
Automatikusan lefordítja a szövegeket gépi fordítás vagy egyéb összetevők használatával.
It is triggered:
When new strings appear in a component.
Once in a month for every component, this can be configured using
BACKGROUND_TASKS.
JavaScript honosítási CDN#
Új a(z) 4.2 verzióban.
- Add-on ID:
weblate.cdn.cdnjs- Beállítások:
thresholdFordítási küszöbszint
Küszöbszint a fordítások beszámításához.
css_selectorCSS-kiválasztó
CSS-kiválasztó a honosítható elemek felismeréséhez.
cookie_nameNyelvi süti neve
A süti neve, amely a nyelvi beállítást tárolja.
filesSzövegek kinyerése HTML-fájlokból
A jelenlegi tárolóban vagy távoli URL-eken lévő feldolgozandó fájlnevek listája a lefordítható szövegekhez.
- Triggers:
daily, repository post-commit, repository post-update
Közzéteszi a fordításokat a tartalomkézbesítési hálózatban a JavaScript vagy HTML honosításokban való használathoz.
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.
Üres szövegek eltávolítása#
Új a(z) 4.4 verzióban.
- Add-on ID:
weblate.cleanup.blank- Beállítások:
This add-on has no configuration.
- Triggers:
repository post-commit, repository post-update
Eltávolítja a fordítás nélküli szövegeket a fordítási fájlokból.
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).
Fordítási fájlok kitisztítása#
- Add-on ID:
weblate.cleanup.generic- Beállítások:
This add-on has no configuration.
- Triggers:
repository pre-commit, repository post-update
Az összes fordítási fájl frissítése, hogy megegyezzen az egynyelvű alapfájllal. A legtöbb fájlformátumnál ez az alapfájlban többé nem létező, elavult fordítási kulcsok eltávolítását jelenti.
Hiányzó nyelvek hozzáadása#
- Add-on ID:
weblate.consistency.languages- Beállítások:
This add-on has no configuration.
- Triggers:
daily, repository post-add
Azt biztosítja, hogy következetes nyelvkészlet legyen használva egy projekten belüli összes összetevőben.
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.
Tipp
Auto-translate the newly added strings with Automatikus fordítás.
Összetevő felfedezése#
- Add-on ID:
weblate.discovery.discovery- Beállítások:
matchReguláris kifejezés a fordítási fájlok illesztéséhez
file_formatFájlformátum
name_templateAz összetevő nevének személyre szabása
base_file_templateAz egynyelvű alapfájlnév meghatározása
Hagyja üresen a többnyelvű fordítási fájloknál.
new_base_templateAz alapfájl meghatározása új fordításokhoz
Új fordítások létrehozásához használt fájl fájlneve. A gettext esetén válassza a .pot fájlt.
intermediate_templateKözbülső nyelvi fájl
A közbülső fordítási fájl fájlneve. A legtöbb esetben ez a fejlesztők által biztosított fordítási fájl, és a tényleges forrásszövegek létrehozásakor van használva.
language_regexNyelvszűrő
Reguláris kifejezés a fordítási fájlok szűréséhez a fájlmaszk keresésekor.
copy_addonsKiegészítők klónozása a fő összetevőből az újonnan létrehozottakba
removeNem létező fájlok összetevőinek eltávolítása
confirmMegerősítem, hogy a fenti illesztések helyesnek tűnnek
- Triggers:
repository post-update
Automatikusan hozzáadja vagy eltávolítja a projekt összetevőit a verziókövető rendszerben történt fájlváltoztatások alapján.
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 }}Összetevő fájlnevének illesztése
{{ component|title }}Összetevő fájlneve, az első betű nagybetűvel
{{ 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#
Nyelvenként egy mappa, amely az összetevő fordításai fájljait tartalmazza.
- Regular expression:
(?P<language>[^/.]*)/(?P<component>[^/]*)\.po- Matching files:
cs/application.pocs/website.pode/application.pode/website.po
Gettext locales layout#
Szokásos szerkezet a gettext PO-fájlok tárolásához.
- 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#
Az összetevő és a nyelv nevének használata a fájlnéven belül.
- 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#
Nyelv használata az útvonalban és a fájlnévben.
- 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 erőforrásszövegek, több fájlra felosztva.
- 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#
Többmodulos Maven projekt Java properties fájlokban található fordításokkal.
- 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
Tipp
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 Forráskód tárolója field (in Manage ↓ Settings ↓
Version control system) of each respective component.
This saves time with configuration and system resources too.
Lásd még
Tömeges szerkesztés#
- Add-on ID:
weblate.flags.bulk- Beállítások:
qLekérdezés
stateBeállítandó állapot
Available choices:
-1– Do not change10– Needs editing20– Translated30– Approvedadd_flagsHozzáadandó fordítási jelzők
remove_flagsEltávolítandó fordítási jelzők
add_labelsHozzáadandó címkék
remove_labelsEltávolítandó címkék
- Triggers:
component update
Szövegek jelzőinek, címkéinek vagy állapotainak tömeges szerkesztése.
Automate labeling by starting out with the search query NOT has:label
and add labels till all strings have all required labels.
Other automated operations for Weblate metadata can also be done.
Examples:
Search query |
|
|---|---|
Hozzáadandó címkék |
recent |
Search query |
|
|---|---|
Hozzáadandó fordítási jelzők |
|
Változatlan fordítások megjelölése, hogy „Szerkesztést igényel”#
- Add-on ID:
weblate.flags.same_edit- Beállítások:
This add-on has no configuration.
- Triggers:
unit post-create
Amikor új lefordítható szöveg kerül importálásra a verziókövető rendszerből, és az megegyezik egy forrásszöveggel, akkor az szerkesztést igénylőként lesz megjelölve a Weblate-ben. Ez különösen olyan fájlformátumoknál hasznos, amelyek forrásszövegeket tartalmaznak a lefordítatlan szövegekhez.
Tipp
You might also want to tighthen the Változatlan fordítások check by adding
strict-same flag to Fordítási jelzők.
Lásd még
Új forrásszövegek megjelölése, hogy „Szerkesztést igényel”#
- Add-on ID:
weblate.flags.source_edit- Beállítások:
This add-on has no configuration.
- Triggers:
unit post-create
Amikor új forrásszöveget importálnak a verziókövető rendszerből, akkor az meg lesz jelölve, hogy szerkesztést igényel a Weblate-ben. Ily módon egyszerűen szűrheti és szerkesztheti a fejlesztők által írt forrásszövegeket.
Lásd még
Új fordítások megjelölése, hogy „Szerkesztést igényel”#
- Add-on ID:
weblate.flags.target_edit- Beállítások:
This add-on has no configuration.
- Triggers:
unit post-create
Amikor új lefordítható szöveget importálnak a verziókövető rendszerből, akkor az meg lesz jelölve, hogy szerkesztést igényel a Weblate-ben. Ily módon egyszerűen szűrheti és szerkesztheti a fejlesztők által létrehozott fordításokat.
Lásd még
Csak olvasható szövegek kitöltése a forrással#
Új a(z) 4.18 verzióban.
- Add-on ID:
weblate.generate.fill_read_only- Beállítások:
This add-on has no configuration.
- Triggers:
component update, daily
Kitölti a csak olvasható szövegek fordítását a forrásszöveggel.
Statisztika-előállító#
- Add-on ID:
weblate.generate.generate- Beállítások:
filenameElőállított fájl neve
templateElőállított fájl tartalma
- Triggers:
repository pre-commit
Részletes információkat tartalmazó fájlt állít elő a fordítás állapotáról.
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:
- Előállított fájl neve
locale/{{ language_code }}.json- Tartalom
{ "language": "{{ language_code }}", "strings": "{{ stats.all }}", "translated": "{{ stats.translated }}", "last_changed": "{{ stats.last_changed }}", "last_author": "{{ stats.last_author }}", }
Lásd még
Fordítás előzetes kitöltése a forrással#
Új a(z) 4.11 verzióban.
- Add-on ID:
weblate.generate.prefill- Beállítások:
This add-on has no configuration.
- Triggers:
component update, daily
Kitölti a fordítási szövegeket a forrásszövegekkel.
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.
Pszeudo területi beállítás előállítása#
Új a(z) 4.5 verzióban.
- Add-on ID:
weblate.generate.pseudolocale- Beállítások:
sourceForrásszövegek
targetCélfordítás
Az ebben a fordításban lévő összes szöveg felül lesz írva
prefixRögzített szövegelőtag
var_prefixVáltozó szövegelőtag
suffixRögzített szövegutótag
var_suffixVáltozó szövegutótag
var_multiplierVáltozó részismétlő
Hányszor ismétlődjön a változó rész a forrásszöveg hosszának függvényében.
include_readonlyCsak olvasható szövegek felvétele
- Triggers:
component update, daily
Előállít egy fordítást úgy, hogy automatikusan előtagot és utótagot ad hozzá a forrásszövegekhez.
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 parts are repeated by length of the
text multiplied by the multiplier. For example Hello world with variable
suffix _ and variable multiplier of 1 becomes Hello world___________ -
the suffix is repeated once for each character in the source string.
A szövegek a következő minta használatával lesznek előállítva:
Fixed string prefix Variable string prefix Source string Variable string suffix Fixed string suffix
Tipp
You can use real languages for testing, but there are dedicated pseudolocales available in Weblate - en_XA and ar_XB.
Tipp
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.
Közreműködők a megegyezésben#
- Add-on ID:
weblate.gettext.authors- Beállítások:
This add-on has no configuration.
- Triggers:
repository pre-commit
Frissíti a PO-fájl fejlécének megjegyzés részét a közreműködők neveinek és a közreműködések éveinek felvételéhez.
The PO file header will look like this:
# 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.
Az ALL_LINGUAS változó frissítése a „configure” fájlban#
- Add-on ID:
weblate.gettext.configure- Beállítások:
This add-on has no configuration.
- Triggers:
repository post-add, daily
Updates the ALL_LINGUAS variable in configure, configure.in or any
configure.ac files, when a new translation is added.
A gettext kimenet személyre szabása#
- Add-on ID:
weblate.gettext.customize- Beállítások:
widthHosszú sorok tördelése
Alapértelmezetten a gettext tördeli a sorokat a 77. karakternél és az új soroknál. A –no-wrap paraméterrel csak az új soroknál végez tördelést.
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:
storage post-load
Lehetővé teszi a gettext kimenet viselkedésének személyre szabását, például a sortörést.
It offers the following options:
Sorok tördelése a 77. karakternél és az új soroknál
Sortörés csak soremeléseknél
Nincs sortörés
Megjegyzés
By default gettext wraps lines at 77 characters and at newlines.
With the --no-wrap parameter, wrapping is only done at newlines.
LINGUAS-fájl frissítése#
- Add-on ID:
weblate.gettext.linguas- Beállítások:
This add-on has no configuration.
- Triggers:
repository post-add, daily
Frissíti a LINGUAS-fájlt, ha új fordítást adnak hozzá.
MO-fájlok előállítása#
- Add-on ID:
weblate.gettext.mo- Beállítások:
pathElőállított MO-fájl útvonala
Ha nincs megadva, akkor a PO-fájl helye lesz használva.
- Triggers:
repository pre-commit
Automatikusan előállít egy MO-fájlt minden megváltoztatott PO-fájlhoz.
The location of the generated MO file can be customized and the field for it uses Template markup.
Megjegyzés
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.
PO-fájlok frissítése, hogy egyezzenek a POT-fájllal (msgmerge)#
- Add-on ID:
weblate.gettext.msgmerge- Beállítások:
previousLefordított szövegek korábbi üzenetazonosítóinak megtartása
no_locationLefordított szövegek helyeinek eltávolítása
fuzzyZavaros illesztés használata
- Triggers:
repository post-update
Updates all PO files (as configured by Fájlmaszk) to match the POT file (as configured by Sablon az új fordításokhoz) using msgmerge.
Triggered whenever new changes are pulled from the upstream repository. Most msgmerge command-line options can be set up through the add-on configuration.
Git véglegesítések összevonása#
- Add-on ID:
weblate.git.squash- Beállítások:
squashVéglegesítések összevonása
Available choices:
all– All commits into onelanguage– Per languagefile– Per fileauthor– Per authorappend_trailersZárósorok hozzáfűzése az összevont véglegesítésüzenethez
A zárósorok az RFC 822-es e-mail-fejlécekhez hasonló sorok a véglegesítésüzenet egyébként szabad szöveges részének végén, mint például „Co-authored-by: …”.
commit_messageVéglegesítésüzenet
Ez a véglegesítésüzenet lesz használva az összevont véglegesítésekből származó egyesített véglegesítésüzenetek helyett.
- Triggers:
repository post-commit
Git véglegesítések összevonása a változtatások felküldése előtt.
Git commits can be squashed prior to pushing changes in one of the following modes:
Minden véglegesítést egybe
Nyelvenként
Fájlonként
Szerzőnként
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.
JSON kimenet személyre szabása#
- Add-on ID:
weblate.json.customize- Beállítások:
sort_keysJSON kulcsok rendezése
indentJSON behúzása
styleJSON behúzási stílusa
Available choices:
spaces– Spacestabs– Tabs- Triggers:
storage post-load
Lehetővé teszi a JSON kimenet viselkedésének beállítását, például a behúzást vagy a rendezést.
A Java properties fájl formázása#
- Add-on ID:
weblate.properties.sort- Beállítások:
This add-on has no configuration.
- Triggers:
repository pre-commit
Megformázza és rendezi a Java properties fájlt.
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.
Elavult megjegyzés eltávolítása#
- Add-on ID:
weblate.removal.comments- Beállítások:
ageNapok a megtartáshoz
- Triggers:
daily
Időkeret beállítása a megjegyzések eltávolításához.
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.
Elavult javaslat eltávolítása#
- Add-on ID:
weblate.removal.suggestions- Beállítások:
ageNapok a megtartáshoz
votesSzavazási küszöbszint
Küszöbszint az eltávolításhoz. Ennek a mezőnek nincs hatása a szavazások kikapcsolásával.
- Triggers:
daily
Időkeret beállítása a javaslatok eltávolításához.
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.
RESX-fájlok frissítése#
- Add-on ID:
weblate.resx.update- Beállítások:
This add-on has no configuration.
- Triggers:
repository post-update
Az összes fordítási fájl frissítése, hogy megegyezzen a távoli tároló egynyelvű alapfájljával. A nem használt szövegek eltávolításra kerülnek, és az újak hozzá lesznek adva a forrásszöveg másolataiként.
Tipp
Use Fordítási fájlok kitisztítása if you only want to remove stale translation keys.
XML kimenet személyre szabása#
Új a(z) 4.15 verzióban.
- Add-on ID:
weblate.xml.customize- Beállítások:
closing_tagsZáró címke felvétele az üres XML-címkéknél
- Triggers:
storage post-load
Lehetővé teszi az XML kimenet viselkedésének beállítását, például a záró címkéket.
YAML kimenet személyre szabása#
- Add-on ID:
weblate.yaml.customize- Beállítások:
indentYAML behúzása
widthHosszú sorok tördelése
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_breakSortörések
Available choices:
dos– DOS (\r\n)unix– UNIX (\n)mac– MAC (\r)- Triggers:
storage post-load
Lehetővé teszi a YAML kimenet viselkedésének beállítását, például a sor hosszát vagy az új sorokat.
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.
Lásd még
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 EVENT_PRE_COMMIT
from weblate.addons.scripts import BaseScriptAddon
class ExamplePreAddon(BaseScriptAddon):
# Event used to trigger the script
events = (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"
For installation instructions see 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#
Version control system used.
- WL_REPO#
Upstream repository URL.
- WL_PATH#
Absolute path to VCS repository.
- WL_BRANCH#
Repository branch configured in the current component.
- WL_FILEMASK#
File mask for current component.
- WL_TEMPLATE#
Filename of template for monolingual translations (can be empty).
- 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#
Component name.
- WL_PROJECT_NAME#
Project name.
- WL_COMPONENT_URL#
Component URL.
- WL_ENGAGE_URL#
Project engage URL.
Lásd még
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.