Breiseáin a fhorbairt¶
Is bealach iad Breiseáin chun sreabhadh oibre logánaithe a shaincheapadh in Weblate.
- class weblate.addons.base.BaseAddon(storage: Addon)¶
Bunrang le haghaidh breiseáin Weblate.
- classmethod can_install(component: Component, user: User | None) bool¶
Seiceáil an bhfuil an breiseán comhoiriúnach leis an gcomhpháirt tugtha.
- component_update(component: weblate.trans.models.Component) None¶
Láimhseálaí imeachtaí le haghaidh nuashonrú comhpháirteanna.
- configure(configuration: dict[str, Any]) None¶
Sábháil cumraíocht.
- daily(component: weblate.trans.models.Component) None¶
Láimhseálaí imeachtaí go laethúil.
- classmethod get_add_form(user: User | None, *, component: Component | None = None, project: Project | None = None, **kwargs) BaseAddonForm | None¶
Seol ar ais an fhoirm chumraíochta chun an breiseán nua a chur leis.
- get_settings_form(user: User | None, **kwargs) BaseAddonForm | None¶
Seol ar ais an fhoirm chumraíochta don bhreiseán seo.
- post_add(translation: Translation) None¶
Láimhseálaí imeachtaí tar éis aistriúchán nua a chur leis.
- post_commit(component: weblate.trans.models.Component, store_hash: bool) None¶
Láimhseálaí imeachtaí tar éis athruithe a dhéanamh ar an stór.
- post_push(component: weblate.trans.models.Component) None¶
Láimhseálaí imeachtaí tar éis an taisc a bhrú suas an sruth.
- post_update(component: weblate.trans.models.Component, previous_head: str, skip_push: bool) None¶
Láimhseálaí imeachtaí tar éis an taisclainne a nuashonrú ó réamhtheachtacha.
- Paraiméadair:
previous_head (str) -- Is féidir CEANN an stór roimh nuashonrú, a bheith bán ar an gclón tosaigh.
skip_push (bool) -- Cibé ar cheart d'oibríocht an bhreiseáin scipeáil athruithe a bhrú in aghaidh an tsrutha. De ghnáth is féidir leat é seo a chur ar aghaidh chuig modhanna bunúsacha mar
commit_and_pushnócommit_pending.
- pre_commit(translation: Translation, author: str, store_hash: bool) None¶
Láimhseálaí an imeachta sula ndéantar athruithe ar an stór.
- pre_push(component: weblate.trans.models.Component) None¶
Láimhseálaí imeachtaí roimh an stór a bhrú suas an sruth.
- pre_update(component: weblate.trans.models.Component) None¶
Láimhseálaí imeachtaí sula ndéantar an stór a nuashonrú ó réamhtheachtacha.
- save_state() None¶
Sábháil faisnéis stáit an bhreiseáin.
- store_post_load(translation: Translation, store: TranslationFormat) None¶
Láimhseálaí imeachtaí tar éis comhad a pharsáil.
Faigheann sé sampla d'aicme formáid comhaid mar argóint.
Tá sé seo úsáideach chun paraiméadair aicme formáid comhaid a mhodhnú, mar shampla conas an comhad a shábháil a choigeartú.
- class weblate.addons.models.Addon¶
Réad ORM le haghaidh breiseán.
- class weblate.trans.models.Component¶
Réad ORM le haghaidh comhpháirte.
- class weblate.trans.models.Translation¶
Réad ORM le haghaidh aistriúcháin.
- class weblate.trans.models.Project¶
Réad ORM le haghaidh tionscadail.
- class weblate.trans.models.Unit¶
Réad ORM le haghaidh aonad.
- class weblate.trans.models.Change¶
Réad ORM le haghaidh athraithe.
- class weblate.trans.models.User¶
Réad ORM don úsáideoir.
- class weblate.trans.models.TranslationFormat¶
Fillteán comhad aistriúcháin.
- class weblate.trans.models.BaseAddonForm¶
Bunfhoirm chun breiseáin a chumrú.
Seo breiseán samplach:
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
from django.utils.translation import gettext_lazy
from weblate.addons.base import BaseAddon
from weblate.addons.events import AddonEvent
class ExampleAddon(BaseAddon):
# Filter for compatible components, every key is
# matched against property of component
compat = {"file_format": {"po", "po-mono"}}
# List of events add-on should receive
events: set[AddonEvent] = {
AddonEvent.EVENT_PRE_COMMIT,
}
# Add-on unique identifier
name = "weblate.example.example"
# Verbose name shown in the user interface
verbose = gettext_lazy("Example add-on")
# Detailed add-on description
description = gettext_lazy("This add-on does nothing it is just an example.")
# Callback to implement custom behavior
def pre_commit(self, translation, author: str, store_hash: bool) -> None:
return