Dodatki

Nowe w wersji 2.19.

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.

Podpowiedź

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

../_images/addons.png

Built-in add-ons

Tłumaczenie automatyczne

Nowe w wersji 3.9.

Add-on ID

weblate.autotranslate.autotranslate

Konfiguracja

mode

Tryb automatycznego tłumaczenia

filter_type

Filtr wyszukiwania

auto_source

Automatyczne tłumaczenie źródła

component

Komponenty

Włącz wkład do wspólnej pamięci tłumaczeniowej dla projektu, aby uzyskać dostęp do dodatkowych komponentów.

engines

Silniki tłumaczenia maszynowego

threshold

Ocena wyniku

Automatycznie tłumaczy ciągi przy użyciu tłumaczenia maszynowego lub innych komponentów.

Uruchomiono:

  • When new strings appear in a component.

  • Once in a month for every component, this can be configured using BACKGROUND_TASKS.

Lokalizacja JavaScript CDN

Nowe w wersji 4.2.

Add-on ID

weblate.cdn.cdnjs

Konfiguracja

threshold

Próg tłumaczenia

Próg uwzględniania tłumaczeń.

css_selector

Selektor CSS

Selektor CSS do wykrywania lokalizowalnych elementów.

cookie_name

Nazwa pliku cookie języka

Nazwa pliku cookie przechowującego preferencje językowe.

files

Wyodrębnianie ciągów z plików HTML

Lista nazw plików w bieżącym repozytorium lub zdalnych adresów URL do przeanalizowania w celu przetłumaczenia ciągów.

Publikuje tłumaczenia w content delivery network dla lokalizacji JavaScript lub HTML.

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.

Usuń puste ciągi

Nowe w wersji 4.4.

Add-on ID

weblate.cleanup.blank

Konfiguracja

This add-on has no configuration.

Usuwa ciągi bez tłumaczenia z plików tłumaczeń.

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).

Wyczyść pliki tłumaczenia

Add-on ID

weblate.cleanup.generic

Konfiguracja

This add-on has no configuration.

Zaktualizuj wszystkie pliki tłumaczeń tak, aby odpowiadały jednojęzykowemu plikowi podstawowemu. W przypadku większości formatów plików oznacza to usunięcie nieaktualnych kluczy tłumaczeń, których nie ma już w pliku podstawowym.

Dodawanie brakujących języków

Add-on ID

weblate.consistency.languages

Konfiguracja

This add-on has no configuration.

Zapewnia, że dla wszystkich komponentów w projekcie używany jest spójny zestaw języków.

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.

Podpowiedź

Auto-translate the newly added strings with Tłumaczenie automatyczne.

Wykrycie komponentów

Add-on ID

weblate.discovery.discovery

Konfiguracja

match

Wyrażenie regularne pasujące do plików tłumaczeń

file_format

Format pliku

name_template

Dostosuj nazwę składnika

base_file_template

Zdefiniuj jednojęzyczną bazową nazwę pliku

Pozostaw puste dla plików tłumaczeń dwujęzycznych.

new_base_template

Zdefiniuj plik szablonu dla nowych tłumaczeń

Nazwa pliku używanego do tworzenia nowych tłumaczeń. Dla Gettext wybierz plik .pot.

language_regex

Filtr języka

Wyrażenie regularne do filtrowania plików tłumaczeń podczas skanowania w poszukiwaniu maski pliku.

copy_addons

Klonuj dodatki z głównego komponentu do nowo utworzonych

remove

Usuń komponenty dla nieistniejących plików

confirm

Potwierdzam, że powyższe dopasowania wyglądają prawidłowo

Automatycznie dodaje lub usuwa komponenty projektu na podstawie zmian plików w systemie kontroli wersji.

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

Podpowiedź

Component discovery add-on uses Weblate wewnętrzne adresy URL. 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 Repozytorium kodu źródłowego field (in ManageSettingsVersion control system) of each respective component. This saves time with configuration and system resources too.

Zobacz także

Znaczniki szablonu

Edycja zbiorcza

Nowe w wersji 3.11.

Add-on ID

weblate.flags.bulk

Konfiguracja

q

Zapytanie

state

Stan do ustawienia

add_flags

Flagi tłumaczeń do dodania

remove_flags

Flagi tłumaczeń do usunięcia

add_labels

Etykiety do dodania

remove_labels

Etykiety do usunięcia

Zbiorcza edycja flag, etykiet lub stanów ciągów.

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.

Przykłady:

Label new strings automatically

Zapytanie wyszukiwania

NOT has:label

Etykiety do dodania

ostatnie

Marking all Pliki metadanych sklepu z aplikacjami changelog entries read-only

Zapytanie wyszukiwania

language:en AND key:changelogs/

Flagi tłumaczeń do dodania

read-only

Oznacz niezmienione tłumaczenia jako „Wymaga edycji”

Nowe w wersji 3.1.

Add-on ID

weblate.flags.same_edit

Konfiguracja

This add-on has no configuration.

Za każdym razem, gdy nowy przetłumaczalny ciąg jest importowany z VCS i pasuje do ciągu źródłowego, jest oznaczany jako wymagający edycji w Weblate. Szczególnie przydatne w przypadku formatów plików zawierających ciągi źródłowe nieprzetłumaczonych ciągów.

Podpowiedź

You might also want to tighthen the Niezmienione tłumaczenie check by adding strict-same flag to Flagi tłumaczeń.

Zobacz także

Stan tłumaczenia

Oznacz nowe ciągi źródłowe jako „Wymaga edycji”

Add-on ID

weblate.flags.source_edit

Konfiguracja

This add-on has no configuration.

Za każdym razem, gdy nowy źródłowy ciąg znaków jest importowany z VCS, jest oznaczany jako wymagający edycji w Weblate. W ten sposób można łatwo filtrować i edytować ciągi źródłowe napisane przez twórców oprogramowania.

Zobacz także

Stan tłumaczenia

Oznacz nowe tłumaczenia jako „Wymaga edycji”

Add-on ID

weblate.flags.target_edit

Konfiguracja

This add-on has no configuration.

Za każdym razem, gdy zaimportowany zostanie nowy łańcuch do przetłumaczenia z VCS, zostanie oznaczony jako wymagający edycji w Weblate. W ten sposób możesz łatwo filtrować i edytować tłumaczenia stworzone przez programistów.

Zobacz także

Stan tłumaczenia

Generator statystyk

Add-on ID

weblate.generate.generate

Konfiguracja

filename

Nazwa wygenerowanego pliku

template

Zawartość wygenerowanego pliku

Generuje plik zawierający szczegółowe informacje o stanie tłumaczenia.

Możesz używać szablonów Django zarówno w nazwie pliku, jak i treści, sprawdź Znaczniki szablonu żeby poznać szczegóły szablonów.

Na przykład wygenerowanie pliku podsumowania dla każdego tłumaczenia:

Nazwa wygenerowanego pliku

locale/{{ language_code }}.json

Zawartość
{
   "language": "{{ language_code }}",
   "strings": "{{ stats.all }}",
   "translated": "{{ stats.translated }}",
   "last_changed": "{{ stats.last_changed }}",
   "last_author": "{{ stats.last_author }}",
}

Zobacz także

Znaczniki szablonu

Generowanie pseudo lokalizacji

Add-on ID

weblate.generate.pseudolocale

Konfiguracja

source

Ciągi źródłowe

target

Tłumaczenie docelowe

prefix

Prefiks ciągu

suffix

Sufiks ciągu

Generuje tłumaczenie poprzez automatyczne dodanie prefiksu i sufiksu do ciągów źródłowych.

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.

Podpowiedź

You can use real languages for testing, but there are dedicated pseudolocales available in Weblate - en_XA and ar_XB.

Podpowiedź

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.

Komentarz współautora

Add-on ID

weblate.gettext.authors

Konfiguracja

This add-on has no configuration.

Zaktualizuj część komentarz w nagłówku pliku PO, aby zawierał nazwę autora i lata wkładu.

The PO file header will look like this:

# Michal Čihař <michal@cihar.com>, 2012, 2018, 2019, 2020.
# Pavel Borecki <pavel@example.com>, 2018, 2019.
# Filip Hron <filip@example.com>, 2018, 2019.
# anonymous <noreply@weblate.org>, 2019.

Zaktualizuj zmienną ALL_LINGUAS w pliku „konfiguracyjnym”

Add-on ID

weblate.gettext.configure

Konfiguracja

This add-on has no configuration.

Updates the ALL_LINGUAS variable in configure, configure.in or any configure.ac files, when a new translation is added.

Dostosuj wyjście gettext

Add-on ID

weblate.gettext.customize

Konfiguracja

width

Zawijanie długich linii

Domyślnie gettext zawija linie przy 77 znakach i nowych liniach. Z parametrem –no-wrap, zawija jest wykonywane tylko w nowych wierszach.

Umożliwia dostosowanie zachowania wyjścia gettext, na przykład zawijanie wierszy.

Oferuje następujące opcje:

  • Zawijaj wiersze po 77 znakach i w nowej linii

  • Kończący znak nowego wiersza

  • Bez zawijania linii

Informacja

By default gettext wraps lines at 77 characters and at newlines. With the --no-wrap parameter, wrapping is only done at newlines.

Aktualizuj plik LINGUAS

Add-on ID

weblate.gettext.linguas

Konfiguracja

This add-on has no configuration.

Aktualizuje plik LINGUAS, gdy dodawane jest nowe tłumaczenie.

Generuj pliki MO

Add-on ID

weblate.gettext.mo

Konfiguracja

path

Ścieżka wygenerowanego pliku MO

Jeśli nie zostanie określony, zostanie użyta lokalizacja pliku PO.

Automatycznie generuje plik MO dla każdego zmienionego pliku PO.

The location of the generated MO file can be customized and the field for it uses Znaczniki szablonu.

Zaktualizuj pliki PO, aby dopasować POT (msgmerge)

Add-on ID

weblate.gettext.msgmerge

Konfiguracja

previous

Zachowaj poprzednie msgids przetłumaczonych ciągów

no_location

Usuwanie lokalizacji przetłumaczonych ciągów

fuzzy

Użyj dopasowania rozmytego

Updates all PO files (as configured by Maska pliku) to match the POT file (as configured by Szablon dla nowych tłumaczeń) 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.

Zatwierdzenie Squash Git

Add-on ID

weblate.git.squash

Konfiguracja

squash

Wykonaj squashing

append_trailers

Dołącz zwiastun do komunikatu o zatwierdzenia

Linie zwiastuna to linie, które wyglądają podobnie do nagłówków wiadomości e-mail RFC 822, na końcu wolnej formy wiadomości zatwierdzenia, takiej jak «Współautor: …».

commit_message

Komentarze do zatwierdzanych zmian

Ten komunikat zatwierdzenia jest używany zamiast połączonych komunikatów zatwierdzania.

Zatwierdzenie Squash Git przed wprowadzeniem zmian.

Git commits can be squashed prior to pushing changes in one of the following modes:

Nowe w wersji 3.4.

  • Wszystkie w jednym

  • Dla języka

  • Według pliku

Nowe w wersji 3.5.

  • Dla autora

Oryginalne komunikaty zatwierdzenia są zachowywane, ale autorstwo zostaje utracone, chyba że wybrano dla autora opcję :guilabel:`Per author`lub dostosowano komunikat zatwierdzenia, aby go uwzględnić.

Nowe w wersji 4.1.

Oryginalne komunikaty zatwierdzania można opcjonalnie zastąpić niestandardową wiadomością zatwierdzenia.

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.

Dostosuj wyjście JSON

Add-on ID

weblate.json.customize

Konfiguracja

sort_keys

Sortuj klucze JSON

indent

Wcięcie JSON

Pozwala na dostosowanie zachowania wyjścia JSON, na przykład wcięcie lub sortowanie.

Formaty właściwości pliku Java

Add-on ID

weblate.properties.sort

Konfiguracja

This add-on has no configuration.

Sortuje plik właściwości Java.

Usuwanie skasowanych komentarzy

Nowe w wersji 3.7.

Add-on ID

weblate.removal.comments

Konfiguracja

age

Dni do zachowania

Ustaw przedział czasowy na usunięcie komentarzy.

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.

Usuwanie sugestii

Nowe w wersji 3.7.

Add-on ID

weblate.removal.suggestions

Konfiguracja

age

Dni do zachowania

votes

Próg głosowania

Próg do usunięcia. To pole nie ma wpływu na wyłączone głosowanie.

Ustaw przedział czasowy na usunięcie sugestii.

Can be very useful in connection with suggestion voting (see Ocena koleżeńska) to remove suggestions which don’t receive enough positive votes in a given timeframe.

Zaktualizuj pliki RESX

Nowe w wersji 3.9.

Add-on ID

weblate.resx.update

Konfiguracja

This add-on has no configuration.

Zaktualizuj wszystkie pliki tłumaczeń, aby pasowały do jednojęzycznego pliku podstawowego. Nieużywane ciągi są usuwane, a nowe są dodawane jako kopie ciągu źródłowego.

Podpowiedź

Use Wyczyść pliki tłumaczenia if you only want to remove stale translation keys.

Dostosuj wyjście YAML

Nowe w wersji 3.10.2.

Add-on ID

weblate.yaml.customize

Konfiguracja

indent

Wcięcie YAML

width

Zawijanie długich linii

line_break

Podział wierszy

Umożliwia dostosowanie zachowania wyjściowego YAML, na przykład długość linii lub nowe linie.

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 addon metadata, and then implement a callback to do the processing.

Zobacz także

Tworzenie dodatków

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 © 2012 - 2021 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
"""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 addon 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"

Aby uzyskać instrukcje instalacji, zobacz Custom quality checks, addons and auto-fixes.

The script is executed with the current directory set to the root of the VCS repository for any given component.

Dodatkowo dostępne są następujące zmienne środowiskowe:

WL_VCS

Używany system kontroli wersji.

WL_REPO

Adres URL repozytorium nadrzędnego.

WL_PATH

Ścieżka bezwzględna do repozytorium VCS.

WL_BRANCH

Nowe w wersji 2.11.

Gałąź repozytorium skonfigurowana w bieżącym składniku.

WL_FILEMASK

Maska pliku dla bieżącego komponentu.

WL_TEMPLATE

Nazwa pliku szablonu dla tłumaczeń jednojęzycznych (może być pusta).

WL_NEW_BASE

Nowe w wersji 2.14.

Nazwa pliku użytego do tworzenia nowych tłumaczeń (może być pusta).

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

Nowe w wersji 3.9.

Component slug used to construct URL.

WL_PROJECT_SLUG

Nowe w wersji 3.9.

Project slug used to construct URL.

WL_COMPONENT_NAME

Nowe w wersji 3.9.

Nazwa komponentu.

WL_PROJECT_NAME

Nowe w wersji 3.9.

Nazwa projektu.

WL_COMPONENT_URL

Nowe w wersji 3.9.

URL komponentu.

WL_ENGAGE_URL

Nowe w wersji 3.9.

Adres URL zaangażowania projektu.

Zobacz także

Konfiguracja komponentu

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.