Installation sur macOS

Exigences matérielles

Weblate should run on any contemporary hardware without problems, the following is the minimal configuration required to run Weblate on a single host (Weblate, database and webserver):

  • 3 GB of RAM

  • 2 CPU cores

  • 1 GB of storage space

The more memory the better - it is used for caching on all levels (filesystem, database and Weblate).

Many concurrent users increases the amount of needed CPU cores. For hundreds of translation components at least 4 GB of RAM is recommended.

The typical database storage usage is around 300 MB per 1 million hosted words. Storage space needed for cloned repositories varies, but Weblate tries to keep their size minimal by doing shallow clones.

Note

Actual requirements for your installation of Weblate vary heavily based on the size of the translations managed in it.

Indication

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

Installation

Exigences du système

Installez les dépendances nécessaires à la construction des modules Python (voir Exigences logicielles) :

# Workaround for https://github.com/xmlsec/python-xmlsec/issues/254
wget -O /tmp/libxmlsec1.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/7f35e6ede954326a10949891af2dba47bbe1fc17/Formula/libxmlsec1.rb
brew install --formula /tmp/libxmlsec1.rb
brew pin libxmlsec1

brew install python pango cairo gobject-introspection glib libyaml pkg-config zstd xxhash
pip install virtualenv

Note

Using older libxmlsec is needed until https://github.com/xmlsec/python-xmlsec/issues/254 is addressed.

Optionally install software for running production server, see Exécuter un serveur, Database setup for Weblate, Background tasks using Celery. Depending on size of your installation you might want to run these components on dedicated servers.

The local installation instructions:

# Web server option 1: NGINX and uWSGI
brew install nginx uwsgi

# Web server option 2: Apache with ``mod_wsgi``
brew install httpd

# Caching backend: Redis
brew install redis

# Database server: PostgreSQL
brew install postgresql

# Gettext for the msgmerge add-on
brew install gettext

Modules Python

Indication

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. Create the virtualenv for Weblate:

    virtualenv ~/weblate-env
    
  2. Activate the virtualenv for Weblate:

    . ~/weblate-env/bin/activate
    
  3. Install Weblate including all optional dependencies:

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

    Please check Dépendances python for fine-tuning of optional dependencies.

    Note

    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
    

Configurer Weblate

Note

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 Ajuster la configuration.

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

    weblate migrate
    

    Voir aussi

    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
    

    Indication

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

    weblate createadmin --update
    

    Voir aussi

    createadmin

  5. Collect the static files for your web server (see Exécuter un serveur and Serving static files):

    weblate collectstatic
    
  6. Compress the JavaScript and CSS files (optional, see Compressing client assets):

    weblate compress
    
  7. Start the Celery workers. This is not necessary for development purposes, but strongly recommended otherwise. Background tasks using Celery has more info:

    ~/weblate-env/lib/python3.9/site-packages/weblate/examples/celery start
    
  8. Start the development server (Exécuter un serveur details a production setup):

    weblate runserver
    

Après installation

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 Commandes de gestion.

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

  • Review potential issues with your installation either on /manage/performance/ URL (see Rapport de performance) or using weblate check --deploy, see Configuration de production.

Ajouter une traduction

  1. Open the admin interface (http://localhost:8000/create/project/) and create the project you want to translate. See Configuration du projet 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 Configuration des composants for more details.

    The important fields here are: Nom du composant, Dépôt du code source, and Masque de fichier for finding translatable files. Weblate supports a wide range of formats including GNU gettext PO (Portable Object), Ressources de chaînes Android, Chaînes Apple iOS, Propriétés Java, Format Stringsdict or Format Fluent, see Formats de fichiers pris en charge 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.