Skip to main content

django-phrase

django-phrase is the official library for integrating Phrase Strings In-Context Editor with Django

:scroll: Documentation

Prerequisites

To use django-phrase with your application you have to:

Demo

You can find a demo project in the demo folder, just run follow the README.md in that folder

Installation

NOTE: You can not use the old version of the ICE with integration versions of >2.0.0, you have to instead use 1.x.x versions as before

via pip

pip install django-phrase

Configure

Add phrase to the list of installed apps::

    INSTALLED_APPS = (
        'phrase',
    )

Add the following template snippets to your layout file templates/base_generic.html or equivalent

    {% load phrase_i18n %}
    {% phrase_javascript %}

Then use {% load phrase_i18n %} in your templates, e.g. demo/ice_demo/templates/index.html

And the following config to your settings.py

    # Phrase In-Context Editor settings
    PHRASE_ENABLED = True
    PHRASE_ACCOUNT_ID = "YOUR_ACCOUNT_ID"  # Set your own account id
    PHRASE_PROJECT_ID = "YOUR_PROJECT_ID"  # Set your own project id
    PHRASE_DATACENTER = "eu"  # Choose your datacenter 'eu' | 'us'
    PHRASE_PREFIX = "{{__"
    PHRASE_SUFFIX = "__}}"

You can find the Project-ID in the Project overview in the PhraseApp Translation Center. You can find the Account-ID in the Organization page in the PhraseApp Translation Center.

If this does not work for you, you can also integrate the JavaScript snippet manually.

Old version of the ICE is not available since version 2.0.0. If you still would rather use the old version, please go back to 1.x.x versions.

Using the US Datacenter with ICE

In addition to the settings in your settings.py, set the US datacenter to enable the ICE to work with the US endpoints.

    # Phrase In-Context Editor settings
    PHRASE_ENABLED = True
    PHRASE_ACCOUNT_ID = "YOUR_ACCOUNT_ID"  # Set your own account id
    PHRASE_PROJECT_ID = "YOUR_PROJECT_ID"  # Set your own project id
    PHRASE_DATACENTER = "us"  # Choose your datacenter 'eu' | 'us'
    PHRASE_PREFIX = "{{__"
    PHRASE_SUFFIX = "__}}"

How does it work

When PHRASE_ENABLED = True this package modifies the returning values from translation functions to present a format which the ICE can read.

Test

Run unit tests:

python manage.py test

:white_check_mark: Commits & Pull Requests

We welcome anyone who wants to contribute to our codebase, so if you notice something, feel free to open a Pull Request! However, we ask that you please use the Conventional Commits specification for your commit messages and titles when opening a Pull Request.

Example: chore: Update README

:question: Issues, Questions, Support

Please use GitHub issues to share your problem, and we will do our best to answer any questions or to support you in finding a solution.

:memo: Changelog

Detailed changes for each release are documented in the changelog.

Metadata

Release files for django-phrase 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-phrase 2.1.2
File Size Uploaded
django_phrase-2.1.2.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-phrase 2.1.2
File Interpreter ABI Platform
django_phrase-2.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.0 kB

Release files / django_phrase-2.1.2.tar.gz

Download URL django_phrase-2.1.2.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
45bafed8a32ce5749888d9cc1b0ff560f58d0dfd835b374ce9d2bc6256296571
BLAKE2b-256 checksum
How to use checksums
a80de8d7e7fc89cdbd2e1f907ad17e904eaa24f74120f0cc63ec036647de8d1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / django_phrase-2.1.2-py3-none-any.whl

Download URL django_phrase-2.1.2-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cfd8d6136b63ee9656cb165babd61122ea0c9ea1e60c1a7cbab546d15b35a81
BLAKE2b-256 checksum
How to use checksums
befd13ac14ab7e6421f8a5bf5861a613ecabb7f9c4e174a7b656282c642bca0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

2.1.2 This release

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.1.0

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page