Kiegészítők

Új a(z) 2.19 verzióban.

Add-ons provide ways to customize and automate the translation workflow. Admins can add and manage add-ons from the ManageAdd-ons menu of each respective translation component.

Tipp

You can also configure add-ons using API, DEFAULT_ADDONS, or install_addon.

../_images/addons.png

Built-in add-ons

Automatikus fordítás

Új a(z) 3.9 verzióban.

Add-on ID:

weblate.autotranslate.autotranslate

Beállítások:

mode

Automatikus fordítási mód

Available choices:

suggest – Add as suggestion

translate – Add as translation

fuzzy – Add as „Needing edit”

filter_type

Keresési szűrő

Vegye figyelembe, hogy az összes szöveg fordítása elveti az összes meglévő fordítást.

Available choices:

all – All strings

nottranslated – Untranslated strings

todo – Unfinished strings

fuzzy – Strings marked for edit

check:inconsistent – Failing check: Inconsistent

auto_source

Automatikus fordítások forrása

Available choices:

others – Other translation components

mt – Machine translation

component

Összetevők

Adja meg a forrásként használandó összetevő keresőbarát webcímét, hagyja üresen a jelenlegi projekt összes összetevőjének használatához.

engines

Gépi fordítómotorok

threshold

Pontszá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:

threshold

Fordítási küszöbszint

Küszöbszint a fordítások beszámításához.

css_selector

CSS-kiválasztó

CSS-kiválasztó a honosítható elemek felismeréséhez.

cookie_name

Nyelvi süti neve

A süti neve, amely a nyelvi beállítást tárolja.

files

Szövegek kinyerése HTML-fájlokból

A jelenlegi tárolóban vagy távoli webcímeken lévő feldolgozandó fájlnevek listája a lefordítható szövegekhez.

Triggers:

daily, repository post-commit, repository post-update

Fordításokat tesz közzé a tartalomszolgáltató hálózatba, a JavaScript vagy a HTML lokalizációjához.

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

Konzisztens nyelvkészletet biztosít a projekt összes összetevője számára.

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:

match

Reguláris kifejezés a fordítási fájlok illesztéséhez

file_format

Fájlformátum

name_template

Az összetevő nevének személyre szabása

base_file_template

Az egynyelvű alapfájlnév meghatározása

Hagyja üresen a többnyelvű fordítási fájloknál.

new_base_template

Az 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_template

Kö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_regex

Nyelvszűrő

A fordítási fájlok szűréséhez használt reguláris kifejezés a fájlmaszk keresésekor.

copy_addons

Kiegészítők klónozása a fő összetevőből az újonnan létrehozottba

remove

Nem létező fájlok összetevőinek eltávolítása

confirm

Megerő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.

Triggered each time the VCS is updated, and otherwise similar to the import_project management command. This way you can track multiple translation components within one VCS.

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.

Once you hit Save, a preview of matching components will be presented, from where you can check whether the configuration actually matches your needs:

../_images/addon-discovery.png

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 ManageSettingsVersion control system) of each respective component. This saves time with configuration and system resources too.

Lásd még

Template markup

Tömeges szerkesztés

Új a(z) 3.11 verzióban.

Add-on ID:

weblate.flags.bulk

Beállítások:

q

Lekérdezés

state

Beállítandó állapot

Available choices:

-1 – Do not change

10 – Needs editing

20 – Translated

30 – Approved

add_flags

Hozzáadandó fordítási jelzők

remove_flags

Eltávolítandó fordítási jelzők

add_labels

Hozzáadandó címkék

remove_labels

Eltávolítandó címkék

Triggers:

component update

Szövegek jelzőinek, címkéinek vagy állapotának 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:

Label new strings automatically

Search query

NOT has:label

Hozzáadandó címkék

recent

Marking all App store metaadatfájlok changelog strings read-only

Search query

language:en AND key:changelogs/

Hozzáadandó fordítási jelzők

read-only

Változatlan fordítások megjelölése, hogy „Szerkesztést igényel”

Új a(z) 3.1 verzióban.

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ült importálásra a verziókezelő 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 az összes szöveget tartalmazzák, még akkor is ha azok nincsenek lefordítva.

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

Translation states

Ú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

Translation states

Ú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

Translation states

Statisztika-előállító

Add-on ID:

weblate.generate.generate

Beállítások:

filename

Előállított fájl neve

template

Előá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

Template markup

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.

Pseudolocale generáció

Új a(z) 4.5 verzióban.

Add-on ID:

weblate.generate.pseudolocale

Beállítások:

source

Forrásszövegek

target

Célfordítás

Az összes fordítás felül lesz írva

prefix

Kötött szövegelőtag

var_prefix

Változó szövegelőtag

suffix

Kötött szövegutótag

var_suffix

Változó szövegutótag

var_multiplier

Vá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_readonly

Írásvédett szövegek belevétele

Triggers:

component update, daily

Előállít egy fordítást úgy, hogy automatikusan előtagot és utótagot ad hozzá a forrás karakterláncokhoz.

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 alapján 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ében lévő megjegyzés részt 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:

width

Hosszú sorok tördelése

Alapértelmezetten a gettext tördeli a sorokat a 77. karakternél és a soremeléseknél. A –no-wrap paraméterrel csak a soremeléseknél tördel.

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:

path

Előá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.

PO-fájlok frissítése, hogy egyezzenek a POT-fájllal (msgmerge)

Add-on ID:

weblate.gettext.msgmerge

Beállítások:

previous

Lefordított szövegek korábbi üzenetazonosítóinak megtartása

no_location

Lefordított szövegek helyeinek eltávolítása

fuzzy

Zavaros 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:

squash

Véglegesítések összevonása

Available choices:

all – All commits into one

language – Per language

file – Per file

author – Per author

append_trailers

Zárósorok hozzáfűzése az összevont véglegesítési üzenethez

A zárósorok az RFC 822-es e-mail-fejlécekhez hasonlóak és a véglegesítésüzenet egyébként szabad szöveges részének végén szerepelnek, mint például „Co-authored-by: …”.

commit_message

Vé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_keys

JSON kulcsok rendezése

indent

JSON behúzása

style

JSON behúzási stílusa

Available choices:

spaces – Spaces

tabs – 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

Formá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

Új a(z) 3.7 verzióban.

Add-on ID:

weblate.removal.comments

Beállítások:

age

Napok 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

Új a(z) 3.7 verzióban.

Add-on ID:

weblate.removal.suggestions

Beállítások:

age

Napok a megtartáshoz

votes

Szavazá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

Új a(z) 3.9 verzióban.

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_tags

Záró címke belevétele az üres XML címkéknél

Triggers:

storage post-load

Allows adjusting XML output behavior, for example closing tags instead of self- closing tags for empty tags.

YAML kimenet személyre szabása

Új a(z) 3.10.2 verzióban.

Add-on ID:

weblate.yaml.customize

Beállítások:

indent

YAML behúzása

width

Hosszú sorok tördelése

Available choices:

80 – Wrap lines at 80 chars

100 – Wrap lines at 100 chars

120 – Wrap lines at 120 chars

180 – Wrap lines at 180 chars

65535 – No line wrapping

line_break

Sortö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

Developing add-ons

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 as _

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 descrption
    verbose = _("Execute script before commit")
    description = _("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

Új a(z) 2.11 verzióban.

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

Új a(z) 2.14 verzióban.

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

Új a(z) 3.9 verzióban.

Component slug used to construct URL.

WL_PROJECT_SLUG

Új a(z) 3.9 verzióban.

Project slug used to construct URL.

WL_COMPONENT_NAME

Új a(z) 3.9 verzióban.

Component name.

WL_PROJECT_NAME

Új a(z) 3.9 verzióban.

Project name.

WL_COMPONENT_URL

Új a(z) 3.9 verzióban.

Component URL.

WL_ENGAGE_URL

Új a(z) 3.9 verzióban.

Project engage URL.

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.