Skip to main content

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

Project description

Masonite Lang

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

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

Usage

Basic Setup

Set your application locale in .env:

APP_LOCALE=en

defaults to 'en' if not set.

Translation Files

Create language files in the /lang directory:

/lang
    en.json
    es.json
    zh_CN.json

Example translation file (en.json):

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

Using Translations

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

{{ __('welcome') }}

If the specified translation string does not exist, the __ function will return the translation string key. So, using the example above, the __ function would return welcome if the translation string does not exist.

Contributing

Please read the Contributing Documentation here.

Maintainers

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

masonite_lang-0.0.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

masonite_lang-0.0.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file masonite_lang-0.0.2.tar.gz.

File metadata

  • Download URL: masonite_lang-0.0.2.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for masonite_lang-0.0.2.tar.gz
Algorithm Hash digest
SHA256 20705d79adddc8000c5463851b12740d9bc3d820bf1b0444a77239b8f94eb5b1
MD5 97a7d9fe0028238d7a35d2f6272abe9f
BLAKE2b-256 6593493cf404e5e2dcd40cc77a7627a2906d5084574cf787730ca471426c2e5c

See more details on using hashes here.

File details

Details for the file masonite_lang-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: masonite_lang-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for masonite_lang-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 21371af9c50f9d28aee9ed2d9185bd7da17725f2ae7d6f127fbd9096bb54d444
MD5 2d27540c49ea2d555d0570a650049d13
BLAKE2b-256 401f991731128b71802f06b0ec260bc2cbd22f48dcce38bbaab6a273c89c2a16

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page