Skip to main content

django-fakemessages - Generate fake language files for your Django Project

CI tests codecov Documentation MIT License

Introduction

Looking for missing translations in your Django project? Let's censor what is done and see what remains!

Resources

Requirements

  • Django >=3.2
  • Python >=3.8
  • Translate-toolkit >=3.8.5

How to

  1. Install

    $ pip install "django-fakemessages"
    
  2. Register fakemessage in your list of Django applications:

    INSTALLED_APPS = [
        # ...
        "fakemessages",
        # ...
    ]
    
  3. Update your settings:

    if DEBUG:
        """Add our fake language to Django"""
        from django.conf.locale import LANG_INFO
    
        FAKE_LANGUAGE_CODE = "kl"
    
        LANG_INFO[FAKE_LANGUAGE_CODE] = {
            "bidi": False,
            "code": FAKE_LANGUAGE_CODE,
            "name": "▮▮▮▮▮▮▮▮",
            "name_local": "🖖 ▮▮▮▮▮▮▮",
        }
        LANGUAGES.append((FAKE_LANGUAGE_CODE, "🖖 ▮▮▮▮▮▮▮"))
    
  4. 🎉 Voila!

Contribute

Principles

  • Simple for developers to get up-and-running
  • Consistent style (black, ruff)
  • Future-proof (pyupgrade)
  • Full type hinting (mypy)

Coding style

We use pre-commit to run code quality tools. Install pre-commit however you like (e.g. pip install pre-commit with your system python) then set up pre-commit to run every time you commit with:

> pre-commit install

You can then run all tools:

> pre-commit run --all-files

It includes the following:

  • poetry for dependency management
  • Ruff, black and pyupgrade linting
  • mypy for type checking
  • Github Actions for builds and CI

There are default config files for the linting and mypy.

Tests

Tests package

The package tests themselves are outside of the main library code, in a package that is itself a Django app (it contains models, settings, and any other artifacts required to run the tests (e.g. urls).) Where appropriate, this test app may be runnable as a Django project - so that developers can spin up the test app and see what admin screens look like, test migrations, etc.

Running tests

The tests themselves use pytest as the test runner. If you have installed the poetry evironment, you can run them thus:

$ poetry run pytest

or

$ poetry shell
(django-fakemessages-py3.10) $ pytest

CI

  • .github/workflows/lint.yml: Defines and ensure coding rules on Github.

  • .github/workflows/test.yml: Runs tests on all compatible combinations of Django (3.2+) & Python (3.8+) in a Github matrix.

  • .github/workflows/coverage.yml: Calculates the coverage on an up to date version.

Metadata

Release files for django-fakemessages 0.0.1

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-fakemessages 0.0.1
File Size Uploaded
django_fakemessages-0.0.1.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-fakemessages 0.0.1
File Interpreter ABI Platform
django_fakemessages-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / django_fakemessages-0.0.1.tar.gz

Download URL django_fakemessages-0.0.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ebce43290f0e89d530191e21c96d6adde3b4c8e2046c3c2d7300f9440080b837
BLAKE2b-256 checksum
How to use checksums
d44a69171a815d64b67d7eb9e3347b3d7844f353571ba5edd61be4f1b78ff589
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.5 Darwin/22.3.0

Release files / django_fakemessages-0.0.1-py3-none-any.whl

Download URL django_fakemessages-0.0.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddeb6243f76d6cac064e09f8e23deeec2180779f77c5ef5c748d5ea572799c30
BLAKE2b-256 checksum
How to use checksums
b7cd0def5485ad3c072f001421c0615367e98cd970a40aef942e84d55d338cbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.5 Darwin/22.3.0

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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