Instalacja na Debianie i Ubuntu#

Wymagania sprzętowe#

Weblate powinien działać bez problemów na każdym współczesnym sprzęcie, poniżej przedstawiono minimalną konfigurację wymaganą do uruchomienia Weblate na jednym hoście (Weblate, baza danych i serwer sieciowy):

  • 3 GB of RAM

  • 2 rdzenie procesora

  • 1 GB miejsca

Im więcej pamięci, tym lepiej - wykorzystywana jest do buforowania na wszystkich poziomach (system plików, baza danych i Weblate).

Wiele użytkowników jednocześnie zwiększa liczbę potrzebnych rdzeni procesora. W przypadku setek elementów tłumaczenia zalecane jest co najmniej 4 GB pamięci RAM.

Typowe użycie magazynu bazy danych wynosi około 300 MB na 1 milion hostowanych słów. Miejsce do magazynowania potrzebne do sklonowanych repozytoriów jest różna, ale Weblate stara się zachować ich minimalny rozmiar, wykonując płytkie klonowanie.

Informacja

Rzeczywiste wymagania dotyczące instalacji Weblate różnią się znacznie w zależności od rozmiaru zarządzanych tłumaczeń.

Podpowiedź

For systems with less memory than recommended, Single-process Celery setup is recommended.

Instalacja#

Wymagania systemowe#

Install the dependencies needed to build the Python modules (see Wymagania dotyczące oprogramowania):

apt install -y \
   libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev \
   libffi-dev libcairo-dev gir1.2-pango-1.0 libgirepository1.0-dev \
   libacl1-dev libssl-dev libpq-dev libjpeg-dev build-essential \
   python3-gdbm python3-dev python3-pip python3-virtualenv virtualenv git

Install wanted optional dependencies depending on features you intend to use (see Zależności ythona):

apt install -y \
   libldap2-dev libldap-common libsasl2-dev \
   libxmlsec1-dev

Optionally install software for running production server, see Uruchamianie serwera, Konfiguracja bazy danych dla Weblate, Zadania w tle korzystające z Celery. Depending on size of your installation you might want to run these components on dedicated servers.

Instrukcja instalacji lokalnej:

# Web server option 1: NGINX and uWSGI
apt install -y nginx uwsgi uwsgi-plugin-python3

# Web server option 2: Apache with ``mod_wsgi``
apt install -y apache2 libapache2-mod-wsgi-py3

# Caching backend: Redis
apt install -y redis-server

# Database server: PostgreSQL
apt install -y postgresql postgresql-contrib

# SMTP server
apt install -y exim4

# Gettext for the msgmerge add-on
apt install -y gettext

Moduły Pythona#

Podpowiedź

We’re using virtualenv to install Weblate in a separate environment from your system. If you are not familiar with it, check virtualenv User Guide.

  1. Utwórz virtualenv dla Weblate:

    virtualenv ~/weblate-env
    
  2. Utwórz virtualenv dla Weblate:

    . ~/weblate-env/bin/activate
    
  3. Zainstaluj Weblate wraz ze wszystkimi opcjonalnymi zależnościami:

    # Install Weblate with all optional dependencies
    pip install "Weblate[all]"
    

    Please check Zależności ythona for fine-tuning of optional dependencies.

    Informacja

    On some Linux distributions running Weblate fails with libffi error:

    ffi_prep_closure(): bad user_data (it seems that the version of the libffi library seen at runtime is different from the 'ffi.h' file seen at compile-time)
    

    This is caused by incompatibility of binary packages distributed via PyPI with the distribution. To address this, you need to rebuild the package on your system:

    pip install --force-reinstall --no-binary :all: cffi
    

Konfigurowanie Weblate#

Informacja

The following assumes the virtualenv used by Weblate is activated (by executing . ~/weblate-env/bin/activate). If not, specify the full path to the weblate command as ~/weblate-env/bin/weblate.

  1. Copy the file ~/weblate-env/lib/python3.9/site-packages/weblate/settings_example.py to ~/weblate-env/lib/python3.9/site-packages/weblate/settings.py.

  2. Adjust the values in the new settings.py file to your liking. You will need to provide at least the database credentials and Django secret key, but you will want more changes for production setup, see Dostosowywanie konfiguracji.

  3. Create the database and its structure for Weblate (the example settings use PostgreSQL, check Konfiguracja bazy danych dla Weblate for a production-ready setup):

    weblate migrate
    

    Zobacz także

    migrate

  4. Create an administrator user account admin, generate its password, and copy it to the clipboard; remember to save it for later use:

    weblate createadmin
    

    Podpowiedź

    If you previously missed/lost the admin password, you can generate a new one with the following command:

    weblate createadmin --update
    

    Zobacz także

    createadmin

  5. Collect the static files for your web server (see Uruchamianie serwera and Obsługa plików statycznych):

    weblate collectstatic
    
  6. Compress the JavaScript and CSS files (optional, see Kompresowanie zasobów klienta):

    weblate compress
    
  7. Start the Celery workers. This is not necessary for development purposes, but strongly recommended otherwise. Zadania w tle korzystające z Celery has more info:

    ~/weblate-env/lib/python3.9/site-packages/weblate/examples/celery start
    
  8. Start the development server (Uruchamianie serwera details a production setup):

    weblate runserver
    

Po instalacji#

Congratulations, your Weblate server is now running and you can start using it.

  • You can now access Weblate on http://localhost:8000/.

  • Sign in with admin credentials obtained during installation or register with new users.

  • You can now run Weblate commands using weblate command when Weblate virtualenv is active, see Polecenia zarządzania.

  • You can stop the test server with Ctrl+C.

  • Review potential issues with your installation either on /manage/performance/ URL (see Raport wydajności) or using weblate check --deploy, see Instalacja produkcyjna.

Dodawanie tłumaczenia#

  1. Open the admin interface (http://localhost:8000/create/project/) and create the project you want to translate. See Konfiguracja projektu for more details.

    All you need to specify here is the project name and its website.

  2. Create a component which is the real object for translation - it points to the VCS repository, and selects which files to translate. See Konfiguracja komponentu for more details.

    The important fields here are: Nazwa komponentu, Repozytorium kodu źródłowego, and Maska pliku for finding translatable files. Weblate supports a wide range of formats including GNU gettext PO (Portable Object), Zasoby z ciągami Androida, Ciągi Apple iOS, Właściwości Java, Format stringsdict or Format Fluent, see Obsługiwane formaty plików for more details.

  3. Once the above is completed (it can be lengthy process depending on the size of your VCS repository, and number of messages to translate), you can start translating.