Modul Weblate opsional¶
Beberapa modul opsional tersedia untuk pengaturan Anda.
Eksportir Git¶
Memberikan Anda akses hanya baca ke repositori Git yang mendasarinya menggunakan HTTP(S).
Pemasangan¶
Tambahkan
weblate.gitexportke aplikasi yang terpasang disettings.py:INSTALLED_APPS += ("weblate.gitexport",)
Ekspor repositori yang ada dengan memigrasikan basis data Anda setelah pemasangan:
weblate migrate
Petunjuk
Eksportir Git diaktifkan di gambar Docker resmi kami. Untuk mematikannya, gunakan:
WEBLATE_REMOVE_APPS=weblate.gitexport
Penggunaan¶
Modul ini secara otomatis terhubung ke Weblate dan mengatur URL repositori yang diekspor di Konfigurasi komponen. Repositori dapat diakses di bagian /git/ dari URL Weblate, misalnya https://example.org/git/weblate/main/.
Repositori untuk proyek yang tersedia untuk umum dapat dikloning tanpa autentikasi:
git clone 'https://example.org/git/weblate/main/'
Akses untuk menelusuri repositori dengan akses terbatas (dengan Privat kontrol akses atau saat REQUIRE_LOGIN diaktifkan) memerlukan token API yang dapat diperoleh di profil pengguna Anda:
git clone 'https://user:KEY@example.org/git/weblate/main/'
Catatan
Weblate serves the Git repository itself, but it does not serve Git LFS
objects. For repositories using Git LFS, clone from the upstream repository
and add Weblate as another remote. If you only need Git-tracked files, you
can clone from Weblate with GIT_LFS_SKIP_SMUDGE=1 to skip downloading
Git LFS objects.
Petunjuk
Secara bawaan, anggota atau grup Pengguna dan pengguna anonim memiliki akses ke repositori untuk proyek publik melalui peran Akses repositori dan Pengguna daya.
Penagihan¶
Ini digunakan pada Hosted Weblate untuk mendefinisikan paket tagihan, melacak faktur, dan batas penggunaan.
Pemasangan¶
1. Add weblate.billing to installed apps in
settings.py:
INSTALLED_APPS += ("weblate.billing",)
Jalankan migrasi basis data untuk secara opsional memasang struktur basis data tambahan untuk modul:
weblate migrate
Pembuatan dan penugasan paket tagihan¶
Pertama, Anda perlu membuat paket penagihan untuk mengaktifkan penagihan. Buka bagian Administrasi (direpresentasikan oleh ikon kunci inggris) dan buka layar Alat. Dari sana, lanjutkan ke Antarmuka admin Django.
Di antarmuka admin Django, cari bagian tAGIHAN dan tambahkan paket tagihan. Misalnya, Anda dapat menambahkan paket Gratis tanpa biaya.
Jika Anda ingin menetapkan paket tagihan ke proyek yang ada, ini juga dapat dilakukan dalam antarmuka admin Django menggunakan opsi Tagihan pelanggan.
Terakhir, antarmuka admin Django menyediakan opsi Faktur untuk mencatat pembayaran pelanggan Anda.
Penggunaan¶
Setelah pemasangan, Anda dapat mengontrol tagihan di antarmuka admin. Pengguna yang mengaktifkan tagihan akan mendapatkan tab Tagihan baru di Profil pengguna mereka.
The billing module additionally allows users to create new projects and components without being superusers (see Menambahkan proyek dan komponen terjemahan). This is possible when following conditions are met:
Tagihan berada dalam batas yang dikonfigurasikan (setiap penggunaan berlebihan mengakibatkan pemblokiran pembuatan proyek/komponen) dan dibayar (jika harganya bukan nol)
The user has Add projects to workspace permission for the workspace covered by the billing plan.
Upon project creation user is able to choose which workspace should contain the project. Projects created in a workspace with billing count against the billing plan assigned to that workspace. Users with the Edit workspace settings permission can view and pay the billing plan; billing notification e-mails are sent to these users. See Penagihan for details.
Modul hukum¶
Ini digunakan pada Hosted Weblate untuk menyediakan dokumen hukum yang diperlukan. Formulir ini dilengkapi dengan dokumen kosong, dan Anda diharapkan untuk mengisi templat berikut dalam dokumen tersebut:
legal/documents/tos.htmlDokumen persyaratan layanan
legal/documents/privacy.htmlDokumen kebijakan privasi
legal/documents/summary.htmlIkhtisar singkat tentang ketentuan layanan dan kebijakan privasi
legal/documents/contracts.htmlSubcontractor information
The legal module embeds these templates inside Weblate and uses
legal/documents/tos.html for terms of service confirmation. This is
separate from LEGAL_URL and PRIVACY_URL, which are meant
for linking to externally hosted legal documents from the footer when the
legal module is not enabled. When the legal module is enabled, Weblate links to
the internal legal pages by default.
Saat mengubah dokumen ketentuan layanan, harap sesuaikan LEGAL_TOS_DATE sehingga pengguna dipaksakan untuk menyetujui dokumen yang diperbarui.
Catatan
Legal documents for the Hosted Weblate service operated by Weblate s.r.o. are available in this Git repository: <https://github.com/WeblateOrg/wllegal/tree/main/wllegal/templates/legal/documents>.
The bundled terms of service and related legal documents are specific to that service and are not intended for general use. They might still come in handy as a starting point if adjusted to meet your needs.
Pemasangan¶
1. Add weblate.legal to installed apps in
settings.py:
INSTALLED_APPS += ("weblate.legal",)
# Optional:
# Social auth pipeline to confirm TOS upon registration/subsequent sign in
SOCIAL_AUTH_PIPELINE += ("weblate.legal.pipeline.tos_confirm",)
# Middleware to enforce TOS confirmation of signed in users
MIDDLEWARE += [
"weblate.legal.middleware.RequireTOSMiddleware",
]
Jalankan migrasi basis data untuk secara opsional memasang struktur basis data tambahan untuk modul:
weblate migrate
Sunting dokumen hukum di map
weblate/legal/templates/legal/agar sesuai dengan layanan Anda.
Petunjuk
In Docker deployments, enable the legal module using
WEBLATE_LEGAL_INTEGRATION instead of editing
settings.py. Use tos-confirm to enable the legal module and
terms of service confirmation enforcement, or wllegal to additionally
load the hosted legal document templates used by services operated by
Weblate s.r.o. These templates are not intended for general use. To provide
your own templates in Docker, place them in
/app/data/python/customize/templates/legal/documents, see
Mengganti logo dan berkas statis lainnya.
Recreate the Docker container after changing environment variables, for example using docker compose up -d. Restarting an existing container does not apply changed environment values.
Penggunaan¶
Setelah pemasangan dan penyuntingan, dokumen hukum ditampilkan di UI Weblate.
The legal document templates are regular Django templates. Text is translated
only when you use Django translation tags such as {% translate %} or
{% blocktranslate %}; plain HTML text is shown as written.
Legal pages and the sign-in and registration overview provide terms_url and
privacy_url variables for linking to the terms of service and privacy
policy documents.
By default, legal document wrappers use the tos CSS class. This class
automatically numbers h2 headings, paragraphs with item, subitem,
or subsubitem classes, and top-level ordered list items. If your legal
text already contains numbering, set LEGAL_DOCUMENT_CSS_CLASS to an
empty string to disable this styling.
Use LEGAL_HIDDEN_DOCUMENTS to hide optional legal pages such as
subcontractors from the legal menu. Hidden pages return a 404 response when
requested directly. If terms or privacy is hidden, links using
terms_url or privacy_url fall back to LEGAL_URL or
PRIVACY_URL when configured, otherwise the link is omitted.
To use externally hosted legal documents with terms confirmation, configure
LEGAL_HIDDEN_DOCUMENTS to hide terms and privacy and set
LEGAL_URL and PRIVACY_URL. The confirmation page then
links to those external documents without requiring a
legal/documents/tos.html template override.
Avatar¶
Avatar diunduh dan disimpan di sisi server untuk mengurangi kebocoran informasi ke situs yang menyediakannya secara bawaan. Dukungan bawaan untuk mengambil avatar dari alamat surel yang dikonfigurasikan untuknya dapat dimatikan menggunakan ENABLE_AVATARS.
Weblate saat ini mendukung:
Lihat juga
CDN lokalisasi¶
The CDN lokalisasi JavaScript and CDN berkas terjemahan add-ons
write files to LOCALIZE_CDN_PATH; Weblate does not serve them.
Configure the web server or CDN serving LOCALIZE_CDN_URL as a
public, read-only static file host.
Treat every published CDN file as public. The add-on specific UUID in the URL is not an access-control mechanism. Do not enable CDN add-ons for components that contain private strings, unreleased product text, customer data, internal URLs, API examples, repository paths, translator comments, or file-format metadata that should not be exposed.
The CDN berkas terjemahan add-on publishes raw translation files in formats supported by Weblate. Some formats can be interpreted by browsers or other clients as HTML, SVG, XML, JavaScript, YAML, or application-specific configuration. Serve the CDN from a dedicated domain that is separate from Weblate and from the application consuming the translations. Do not share authentication cookies with the CDN domain.
Recommended server configuration:
Serve only the directory configured by
LOCALIZE_CDN_PATH; do not expose Weblate repositories, backups, media, configuration, or the whole data directory.Disable directory listing.
Use HTTPS and make the CDN host read-only from the web server.
Send X-Content-Type-Options with
nosniff.Configure conservative MIME types. Serve unknown translation formats as text/plain or application/octet-stream; only serve
weblate.jsas JavaScript.For raw translation formats that are not intended to be rendered in a browser, consider adding Content-Disposition with
attachment.Configure
Access-Control-Allow-Originonly for sites that need browser access to the files.Set cache lifetimes that match your update expectations, and purge CDN caches when stale translations must disappear quickly.
The following nginx snippet serves only the configured CDN directory and applies conservative defaults for raw translation files:
#
# nginx configuration for the Weblate localization CDN
#
# You will want to change:
#
# - server_name to match the host configured in LOCALIZE_CDN_URL
# - root to match LOCALIZE_CDN_PATH
# - Access-Control-Allow-Origin to the sites that need browser access
# - TLS configuration if HTTPS is not terminated before nginx
#
server {
listen 80;
server_name cdn.example.com;
# LOCALIZE_CDN_PATH
root /home/weblate/data/l10n-cdn;
autoindex off;
disable_symlinks on;
location = / {
return 404;
}
# The JavaScript localization add-on publishes this loader.
location ~ "^/[0-9a-f]{32}/weblate\.js$" {
try_files $uri =404;
types {
application/javascript js;
}
default_type application/javascript;
add_header X-Content-Type-Options nosniff always;
# add_header Access-Control-Allow-Origin "https://www.example.com" always;
expires 1h;
}
# Other CDN files are translation files. Serve them conservatively so raw
# formats are not interpreted as active browser content.
location / {
try_files $uri =404;
types {
}
default_type text/plain;
add_header X-Content-Type-Options nosniff always;
add_header Content-Disposition "attachment" always;
# add_header Access-Control-Allow-Origin "https://www.example.com" always;
expires 1h;
}
}
Menandatangani komit Git dengan GnuPG¶
Semua komit dapat ditandatangani dengan kunci GnuPG dari instansi Weblate.
Nyalakan
WEBLATE_GPG_IDENTITY. (Weblate akan menghasilkan kunci GNUPG saat dibutuhkan dan akan menggunakannya untuk menandatangani semua komit terjemahan.)Fitur ini membutuhkan GnuPG 2.1 atau yang lebih baru dipasang.
Anda dapat menemukan kunci dalam
DATA_DIRdan kunci publik ditampilkan pada halaman "Tentang ":
Atau Anda juga dapat mengimpor kunci yang ada ke dalam Weblate, cukup atur
HOME=$DATA_DIR/homesaat meminta gpg.
Petunjuk
Materi kunci disimpan dalam penyimpanan oleh Weblate untuk jangka waktu yang lama. Jika Anda mengizinkan Weblate menghasilkan kunci dengan WEBLATE_GPG_IDENTITY lalu mengimpor kunci dengan identitas yang sama untuk menggunakan kunci yang sudah ada, disarankan untuk membersihkan penyimpanan redis guna melihat dampak perubahan tersebut.
Catatan
Saat berbagi DATA_DIR antara beberapa hos, silakan ikuti petunjuk di https://wiki.gnupg.org/NFS untuk membuat penandatanganan GnuPG bekerja dengan andal.
Lihat juga
Pembatasan akses¶
Berubah pada versi 4.6: Pembatasan akses tidak lagi berlaku untuk penandatanganan super pengguna.
Beberapa operasi di Weblate terbatas. Paling banyak RATELIMIT_ATTEMPTS percobaan diizinkan di dalam RATELIMIT_WINDOW detik. Pengguna kemudian diblokir untuk RATELIMIT_LOCKOUT. Ada juga pengaturan khusus untuk cakupan, misalnya ratelimit_contact_attempts atau ratelimit_translate_attempts. Tabel di bawah ini adalah daftar lengkap cakupan yang tersedia.
Operasi berikut ini tunduk pada pembatasan akses:
Nama |
Cakupan |
Percobaan yang diizinkan |
Jendela batas akses |
Periode penguncian |
|---|---|---|---|---|
Pendaftaran |
|
5 |
300 |
600 |
Mengirim pesan ke admin |
|
2 |
300 |
600 |
Autentikasi kata sandi saat masuk |
|
5 |
300 |
600 |
Autentikasi faktor kedua |
|
5 |
300 |
600 |
Pencarian seluruh situs |
|
6 |
60 |
60 |
Menerjemahkan |
|
30 |
60 |
600 |
Menambahkan ke glosarium |
|
30 |
60 |
600 |
Memulai terjemahan ke bahasa baru |
|
2 |
300 |
600 |
Membuat proyek baru |
|
5 |
600 |
600 |
Pembatasan akses didasarkan pada sesi saat pengguna masuk dan pada alamat IP jika tidak.
Jika pengguna gagal masuk AUTH_LOCK_ATTEMPTS kali, autentikasi kata sandi akan dimatikan pada akun tersebut hingga proses pengaturan ulang kata sandi selesai.
Pengaturan juga dapat diterapkan dalam kontainer Docker dengan menambahkan prefiks WEBLATE_ ke nama pengaturan, misalnya RATELIMIT_ATTEMPTS menjadi WEBLATE_RATELIMIT_ATTEMPTS.
API memiliki pengaturan pembatasan akses terpisah, lihat Pembatasan akses API.