Complementos¶
Nuevo en la versión 2.19.
Addons provide ways to customize translation workflow. They can be installed in the translation component view, and work behind the scenes. Addon management is available from the Manage ↓ Addons menu of each respective translation component for admins.
Built-in addons¶
Traducción automática¶
Nuevo en la versión 3.9.
Traduce automáticamente las cadenas mediante traducción automática u otros componentes.
This addon is triggered automatically when new strings appear in a component.
CDN de regionalización de JavaScript¶
Nuevo en la versión 4.2.
Añade un CDN para la regionalización de JavaScript o HTML.
It can be used to localize static HTML pages or used to load localization in the JavaScript code.
Upon installation the addon generates unique URL for your component which you can include in the HTML documents to get them localized. See Translating HTML and JavaScript using Weblate CDN for more details.
Limpieza de archivos de traducción¶
Actualice todos los archivos de traducción para que coincidan con el archivo base monolingüe. Para la mayoría de los formatos de archivo, esto significa quitar las claves de traducción obsoletas que ya no están presentes en el archivo base.
Consistencia del idioma¶
Garantiza que todos los componentes de un proyecto tengan traducciones en todos los idiomas añadidos para traducción.
It creates empty translations in languages that have unadded components.
Missing languages are checked once every 24 hours and when a new language is added in Weblate.
Unlike most others, this addon affects the whole project.
Consejo
Auto-translate the newly added strings with Traducción automática.
Descubrimiento de componentes¶
Añade o quita automáticamente componentes del proyecto en función de los cambios de los archivos en el sistema de control de versiones.
It is triggered on every VCS update, and otherwise similar to the import_project
management command. This way you can track multiple translation
components within one VCS.
Create one main component least likely to disappear in the future, and others will employ URL internos de Weblate to it as a VCS configuration, and configure it to find all components in it.
The matching is done using regular expressions, where power is a tradeoff for complexity in configuration. Some examples for common use cases can be found in the addon 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:
Ver también
Edición en masa¶
Nuevo en la versión 3.11.
Edite indicadores, etiquetas o estados de manera masiva.
Automating the labeling of new strings can be useful (start out with search query NOT
has:label
and add desired labels till all strings are properly labeled).
You can also carry out any other automated operations for Weblate metadata.
Ver también
Marcar traducciones sin cambios como «Necesitan edición»¶
Nuevo en la versión 3.1.
Cada vez que se importa una cadena traducible nueva desde el VCS y corresponde a una cadena de origen, se marca como necesaria la edición en Weblate. Esto es útil sobre todo para aquellos formatos de archivo que incluyen todas las cadenas, incluso las no traducidas.
Marcar cadenas de origen nuevas como «Necesitan edición»¶
Cuando se importa una cadena de origen nueva desde el VCS, se marca como necesaria la edición en Weblate. De esta manera usted puede filtrar y editar cadenas de origen escritas por los desarrolladores con facilidad.
Marcar traducciones nuevas como «Necesitan edición»¶
Cuando se importa una cadena traducible nueva desde el VCS, se marca como necesaria la edición en Weblate. De esta manera usted puede filtrar y editar las traducciones creadas por los desarrolladores con facilidad.
Generador de estadísticas¶
Genera un archivo con información detallada sobre la traducción.
You can use Django template in both filename and content, see Template markup for a detailed markup description.
For example generating summary file for each translation:
- Nombre del archivo generado
locale/{{ language_code }}.json
- Content
{ "language": "{{ language_code }}", "strings": "{{ stats.all }}", "translated": "{{ stats.translated }}", "last_changed": "{{ stats.last_changed }}", "last_author": "{{ stats.last_author }}", }
Ver también
Contribuidores en comentarios¶
Actualiza el comentario en la cabecera del archivo PO para incluir los nombres de los contribuidores y los años de las contribuciones.
The PO file header will contain a list of contributors and years contributed:
# 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.
Actualizar variable ALL_LINGUAS en el archivo «configure»¶
Updates the ALL_LINGUAS variable in configure
, configure.in
or any
configure.ac
files, when a new translation is added.
Personalizar la salida de gettext¶
Permite la personalización del comportamiento de salida de gettext, por ejemplo, ajuste de líneas.
It offers the following options:
Wrap lines at 77 characters and at newlines
Ajustar renglones únicamente en los saltos
No ajustar renglones
Nota
By default gettext wraps lines at 77 characters and for newlines.
With the --no-wrap
parameter, it wraps only at newlines.
Actualizar archivo LINGUAS¶
Actualiza el archivo LINGUAS al añadir una traducción nueva.
Generar archivos MO¶
Genera automáticamente un archivo MO por cada archivo PO modificado.
Actualizar archivos PO para que coincidan con POT (msgmerge)¶
Actualiza todos los archivos PO para que coincidan con el archivo POT usando msgmerge. Esto se activa cada vez que se extraen nuevos cambios del repositorio original.
Concentrar consignas de Git¶
Concentrar las consignas de Git antes de enviar los cambios.
You can choose one of following modes:
Nuevo en la versión 3.4.
Todas las consignas en una sola
Por idioma
Por archivo
Nuevo en la versión 3.5.
Por autor
Original commit messages are kept, but authorship is lost unless «Per author» is selected, or the commit message is customized to include it.
Nuevo en la versión 4.1.
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.
Personalizar la salida de JSON¶
Permite ajustar el comportamiento de salida de JSON, por ejemplo, sangría o clasificación.
Formatos del archivo de propiedades Java¶
Ordena el archivo de propiedades de Java.
Retiro de comentarios obsoletos¶
Nuevo en la versión 3.7.
Fijar un plazo para el borrado de los comentarios.
Esto puede resultar útil para quitar los comentarios antiguos que pueden ya no ser aplicables. Utilícela con cuidado, pues el hecho de que un comentario sea antiguo no necesariamente denota que ha perdido importancia.
Retiro de sugerencias obsoletas¶
Nuevo en la versión 3.7.
Fijar un plazo para el borrado de sugerencias.
This can be very useful in connection with suggestion voting (see Revisión por pares) to remove suggestions which don’t receive enough positive votes in a given timeframe.
Actualizar archivos RESX¶
Nuevo en la versión 3.9.
Actualiza todos los archivos de traducción para que coincidan con el archivo de base monolingüe original. Las cadenas no utilizadas se retiran y las nuevas se añaden como copias de las cadenas de origen.
Consejo
Use Limpieza de archivos de traducción if you only want to remove stale translation keys.
Personalizar salida de YAML¶
Nuevo en la versión 3.10.2.
Permite ajustar el comportamiento de salida de YAML, como la longitud de los renglones y los saltos.
Customizing list of addons¶
The list of addons is configured by WEBLATE_ADDONS
.
To add another addon, simply include class absolute name in this setting.
Writing addon¶
You can write your own addons too, all you need to do is subclass BaseAddon
,
define the addon metadata and implement a callback which will do the processing.
Here is an example addon:
#
# Copyright © 2012 - 2020 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/>.
#
from django.utils.translation import gettext_lazy as _
from weblate.addons.base import BaseAddon
from weblate.addons.events import EVENT_PRE_COMMIT
class ExampleAddon(BaseAddon):
# Filter for compatible components, every key is
# matched against property of component
compat = {"file_format": {"po", "po-mono"}}
# List of events addon should receive
events = (EVENT_PRE_COMMIT,)
# Addon unique identifier
name = "weblate.example.example"
# Verbose name shown in the user interface
verbose = _("Example addon")
# Detailed addon description
description = _("This addon does nothing it is just an example.")
# Callback to implement custom behavior
def pre_commit(self, translation, author):
return
Executing scripts from addon¶
Addons 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 addon.
#
# Copyright © 2012 - 2020 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"
For installation instructions see Comprobaciones de calidad, complementos y correcciones automáticas personalizadas.
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
¶ Sistema de control de versiones utilizado.
-
WL_REPO
¶ Upstream repository URL.
-
WL_PATH
¶ Absolute path to VCS repository.
-
WL_BRANCH
¶ Nuevo en la versión 2.11.
Rama del repositorio configurada en el componente actual.
-
WL_FILEMASK
¶ Filemask for current component.
-
WL_TEMPLATE
¶ Nombre de archivo de plantilla para traducciones monolingües (puede quedar vacío).
-
WL_NEW_BASE
¶ Nuevo en la versión 2.14.
Nombre del archivo utilizado para crear traducciones nuevas (puede quedar vacío).
-
WL_FILE_FORMAT
¶ Formato de archivo utilizado en el componente actual.
-
WL_LANGUAGE
¶ Idioma de la traducción procesada actualmente (no disponible para actuadores a nivel componente).
-
WL_PREVIOUS_HEAD
¶ Previous HEAD on update (available only when running post update hook).
-
WL_COMPONENT_SLUG
¶ Nuevo en la versión 3.9.
Component slug used to construct URL.
-
WL_PROJECT_SLUG
¶ Nuevo en la versión 3.9.
Project slug used to construct URL.
-
WL_COMPONENT_NAME
¶ Nuevo en la versión 3.9.
Nombre del componente.
-
WL_PROJECT_NAME
¶ Nuevo en la versión 3.9.
Nombre del proyecto.
-
WL_COMPONENT_URL
¶ Nuevo en la versión 3.9.
URL del componente.
-
WL_ENGAGE_URL
¶ Nuevo en la versión 3.9.
URL de participación del proyecto.
Ver también
Post update repository processing¶
Post update repository processing can be used to update translation files when the VCS upstream source changes. To achieve this, please remember that 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 make changes to the translation before it is committed to the repository.
It is passed as a single parameter consisting of the filename of a current translation.