Skip to main content

Masonite Lang

Masonite Package GitHub Workflow Status (branch) PyPI Python Version GitHub release (latest by date including pre-releases) License Code style: black

Roadmap

  • Command: sorts translation files by key.
  • Supports nested translation keys.

Introduction

Package description in one line displayed e.g. in README

Features

  • Add your package main features here
  • and here

Official Masonite Documentation

New to Masonite ? Please first read the Official Documentation. Masonite strives to have extremely comprehensive documentation 😃. It would be wise to go through the tutorials there. If you find any discrepencies or anything that doesn't make sense, be sure to comment directly on the documentation to start a discussion!

Have questions or want to talk? Be sure to join the Masonite Discord Community!

Installation

pip install masonite-lang

Configuration

Add LangProvider to your project in config/providers.py:

# config/providers.py
# ...
from lang import LangProvider

# ...
PROVIDERS = [
    # ...
    # Third Party Providers
    LangProvider,
    # ...
]

Then you can publish the package resources (if needed) by doing:

python craft package:publish lang

Set your application locale in .env:

APP_LOCALE=en

defaults to 'en' if not set.

Create language files in the /locales directory:

/locales
    en.json
    es.json
    zh_CN.json

Example translation file (en.json):

{
    "welcome": "Welcome to our application"
}

Usage

python

from lang.facades import Lang

Lang.current_locale()
Lang.set_locale('en')
Lang.is_locale('en')
Lang.trans('trans')

templates

In your templates, use the __() helper to display translated text:

{{ __('not') }}

If the specified translation string does not exist, the __ function will return the translation string key.

Contributing

Please read the Contributing Documentation here.

Maintainers

License

Masonite Lang is open-sourced software licensed under the MIT license.

Metadata

Release files for masonite-lang 1.1.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 masonite-lang 1.1.1
File Size Uploaded Provenance Actions
masonite_lang-1.1.1.tar.gz 10.8 kB Without provenance Details for masonite_lang-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for masonite-lang 1.1.1
File Interpreter ABI Platform Actions
masonite_lang-1.1.1-py3-none-any.whl Python 3 none any Details for masonite_lang-1.1.1-py3-none-any.whl

Total release size: 18.5 kB

Release files / masonite_lang-1.1.1.tar.gz

Download URL masonite_lang-1.1.1.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
787458dd9b48ac0b570d1e3d9c1bf8738153077d31910b78ed981a6cce28b5eb
BLAKE2b-256 checksum
How to use checksums
0449c5281184940d5b28355e6a20d4807b8a3e591d726a0230d89a34d7b727e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / masonite_lang-1.1.1-py3-none-any.whl

Download URL masonite_lang-1.1.1-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f08fb70d18c2722e8eca6885bc67962e873688c1b18e34759015b18b9b306381
BLAKE2b-256 checksum
How to use checksums
4e86287e04f3fcc91552771a79b8856a4d2ac9988e878587873b7baccf513ef1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for masonite-lang 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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