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

Set your application locale in .env:

APP_LOCALE=en

defaults to 'en' if not set.

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"
}

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.

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-1.1.0.tar.gz (10.8 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-1.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for masonite_lang-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d6e7ad72d4307e95c02592f898ffc68335e5bb170bb77083631b70b03473d6ec
MD5 c24fac55ac45ad3e5b0d3c858ec6e090
BLAKE2b-256 543f9ed97e97136d549587dc12232ca73b598e0663530fc4f0bfe6aa18ecce89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: masonite_lang-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f0ecd52cfc7be3a9ad72684f87c51d76b67bd6376f9d1bda4af1fa653af519f
MD5 a1bbbd2c44c526da881b613d66999ccf
BLAKE2b-256 00295d72d18c54b9de26e73734cf203d8edc13a9b703a856175ecc05e1362f89

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