# Masonite Lang
<p align="center">
<img src="https://banners.beyondco.de/Masonite Lang.png?theme=light&packageManager=pip+install&packageName=masonite-lang&pattern=topography&style=style_1&description=Package description in one line displayed e.g. in README&md=1&showWatermark=1&fontSize=100px&images=https%3A%2F%2Fgblobscdn.gitbook.com%2Fspaces%2F-L9uc-9XAlqhXkBwrLMA%2Favatar.png">
</p>
<p align="center">
<a href="https://docs.masoniteproject.com">
<img alt="Masonite Package" src="https://img.shields.io/static/v1?label=Masonite&message=package&labelColor=grey&color=blue&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAA6gAwAEAAAAAQAAAA4AAAAATspU+QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAAnxJREFUKBVNUl1IVEEUPjPObdd1VdxWM0rMIl3bzbVWLSofVm3th0AhMakHHyqRiNSHEAq5b2HSVvoQRUiEECQUQkkPbRslRGigG8auoon2oPSjpev+3PWeZq7eaC5nDt93vplz5txDQJYpNxX4st4JFiwj9aCqmswUFQNS/A2YskrZJPYefkECC2GhQwAqvLYybwXrwBvq8HSNOXRO92+aH7nW8vc/wS2Z9TqneYt2KHjlf9Iv+43wFJMExzO0YE5OKe60N+AOW6OmE+WJTBrg23jjzWxMBauOlfyycsV24F+cH+zAXYUOGl+DaiDxfl245/W9OnVrSY+O2eqPkyz4sVvHoKp9gOihf5KoAVv3hkQgbj/ihG9fI3RixKcUVx7lJVaEc0vnyf2FFll+ny80ZHZiGhIKowWJBCEAKr+FSuNDLt+lxybSF51lo74arqs113dOZqwsptxNs5bwi7Q3q8npSC2AWmvjTncZf1l61e5DEizNn5mtufpsqk5+CZTuq00sP1wkNPv8jeEikVVlJso+GEwRtNs3QeBt2YP2V2ZI3Tx0e+7T89zK5tNASOLEytJAryGtkLc2PcBM5byyUWYkMQpMioYcDcchC6xN220Iv36Ot8pV0454RHLEwmmD7UWfIdX0zq3GjMPG5NKBtv5qiPEPekK2U51j1451BZoc3i+1ohSQ/UzzG5uYFFn2mwVUnO4O3JblXA91T51l3pB3QweDl7sNXMyEjbguSjrPcQNmwDkNc8CbCvDd0+xCC7RFi9wFulD3mJeXqxQevB4prrqgc0TmQ85NG/K43e2UwnMVAJIEBNfWRYR3HfnvivrIzMyo4Hgy+hfscvLo53jItAAAAABJRU5ErkJggg==">
</a>
<img alt="GitHub Workflow Status (branch)" src="https://img.shields.io/github/workflow/status/chris1ding1/lang/Test%20Application">
<img src="https://codecov.io/gh/chris1ding1/lang/branch/main/graph/badge.svg?token="/>
<img alt="PyPI" src="https://img.shields.io/pypi/v/lang">
<img src="https://img.shields.io/badge/python-3.11+-blue.svg" alt="Python Version">
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/chris1ding1/lang?include_prereleases">
<img alt="License" src="https://img.shields.io/github/license/chris1ding1/lang">
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>
## 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](https://docs.masoniteproject.com/).
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](https://discord.gg/TwKeFahmPZ)!
## Installation
```bash
pip install masonite-lang
```
## Configuration
Add LangProvider to your project in `config/providers.py`:
```python
# config/providers.py
# ...
from lang import LangProvider
# ...
PROVIDERS = [
# ...
# Third Party Providers
LangProvider,
# ...
]
```
Then you can publish the package resources (if needed) by doing:
```bash
python craft package:publish lang
```
Set your application locale in `.env`:
```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`):
```json
{
"welcome": "Welcome to our application"
}
```
## Usage
### python
```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:
```html
{{ __('not') }}
```
If the specified translation string does not exist, the __ function will return the translation string key.
## Contributing
Please read the [Contributing Documentation](CONTRIBUTING.md) here.
## Maintainers
- [Chris](https://www.github.com/chris1ding1)
## License
Masonite Lang is open-sourced software licensed under the [MIT license](LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/chris1ding1/masonite-lang",
"name": "masonite-lang",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Masonite, Python, Development",
"author": "Chris",
"author_email": "chris1ding1@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/04/49/c5281184940d5b28355e6a20d4807b8a3e591d726a0230d89a34d7b727e0/masonite_lang-1.1.1.tar.gz",
"platform": null,
"description": "# Masonite Lang\n\n<p align=\"center\">\n <img src=\"https://banners.beyondco.de/Masonite Lang.png?theme=light&packageManager=pip+install&packageName=masonite-lang&pattern=topography&style=style_1&description=Package description in one line displayed e.g. in README&md=1&showWatermark=1&fontSize=100px&images=https%3A%2F%2Fgblobscdn.gitbook.com%2Fspaces%2F-L9uc-9XAlqhXkBwrLMA%2Favatar.png\">\n</p>\n\n<p align=\"center\">\n <a href=\"https://docs.masoniteproject.com\">\n <img alt=\"Masonite Package\" src=\"https://img.shields.io/static/v1?label=Masonite&message=package&labelColor=grey&color=blue&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAA6gAwAEAAAAAQAAAA4AAAAATspU+QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAAnxJREFUKBVNUl1IVEEUPjPObdd1VdxWM0rMIl3bzbVWLSofVm3th0AhMakHHyqRiNSHEAq5b2HSVvoQRUiEECQUQkkPbRslRGigG8auoon2oPSjpev+3PWeZq7eaC5nDt93vplz5txDQJYpNxX4st4JFiwj9aCqmswUFQNS/A2YskrZJPYefkECC2GhQwAqvLYybwXrwBvq8HSNOXRO92+aH7nW8vc/wS2Z9TqneYt2KHjlf9Iv+43wFJMExzO0YE5OKe60N+AOW6OmE+WJTBrg23jjzWxMBauOlfyycsV24F+cH+zAXYUOGl+DaiDxfl245/W9OnVrSY+O2eqPkyz4sVvHoKp9gOihf5KoAVv3hkQgbj/ihG9fI3RixKcUVx7lJVaEc0vnyf2FFll+ny80ZHZiGhIKowWJBCEAKr+FSuNDLt+lxybSF51lo74arqs113dOZqwsptxNs5bwi7Q3q8npSC2AWmvjTncZf1l61e5DEizNn5mtufpsqk5+CZTuq00sP1wkNPv8jeEikVVlJso+GEwRtNs3QeBt2YP2V2ZI3Tx0e+7T89zK5tNASOLEytJAryGtkLc2PcBM5byyUWYkMQpMioYcDcchC6xN220Iv36Ot8pV0454RHLEwmmD7UWfIdX0zq3GjMPG5NKBtv5qiPEPekK2U51j1451BZoc3i+1ohSQ/UzzG5uYFFn2mwVUnO4O3JblXA91T51l3pB3QweDl7sNXMyEjbguSjrPcQNmwDkNc8CbCvDd0+xCC7RFi9wFulD3mJeXqxQevB4prrqgc0TmQ85NG/K43e2UwnMVAJIEBNfWRYR3HfnvivrIzMyo4Hgy+hfscvLo53jItAAAAABJRU5ErkJggg==\">\n </a>\n <img alt=\"GitHub Workflow Status (branch)\" src=\"https://img.shields.io/github/workflow/status/chris1ding1/lang/Test%20Application\">\n <img src=\"https://codecov.io/gh/chris1ding1/lang/branch/main/graph/badge.svg?token=\"/>\n <img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/lang\">\n <img src=\"https://img.shields.io/badge/python-3.11+-blue.svg\" alt=\"Python Version\">\n <img alt=\"GitHub release (latest by date including pre-releases)\" src=\"https://img.shields.io/github/v/release/chris1ding1/lang?include_prereleases\">\n <img alt=\"License\" src=\"https://img.shields.io/github/license/chris1ding1/lang\">\n <a href=\"https://github.com/psf/black\"><img alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"></a>\n</p>\n\n## Roadmap\n\n- [ ] Command: sorts translation files by key.\n- [ ] Supports nested translation keys.\n\n## Introduction\n\nPackage description in one line displayed e.g. in README\n\n## Features\n\n- _Add your package main features here_\n- _and here_\n\n## Official Masonite Documentation\n\nNew to Masonite ? Please first read the [Official Documentation](https://docs.masoniteproject.com/).\nMasonite strives to have extremely comprehensive documentation \ud83d\ude03. It would be wise to go through the tutorials there.\nIf you find any discrepencies or anything that doesn't make sense, be sure to comment directly on the documentation to start a discussion!\n\nHave questions or want to talk? Be sure to join the [Masonite Discord Community](https://discord.gg/TwKeFahmPZ)!\n\n## Installation\n\n```bash\npip install masonite-lang\n```\n\n## Configuration\n\nAdd LangProvider to your project in `config/providers.py`:\n\n```python\n# config/providers.py\n# ...\nfrom lang import LangProvider\n\n# ...\nPROVIDERS = [\n # ...\n # Third Party Providers\n LangProvider,\n # ...\n]\n```\n\nThen you can publish the package resources (if needed) by doing:\n\n```bash\npython craft package:publish lang\n```\n\nSet your application locale in `.env`:\n\n```env\nAPP_LOCALE=en\n```\n\ndefaults to 'en' if not set.\n\nCreate language files in the `/locales` directory:\n\n```\n/locales\n en.json\n es.json\n zh_CN.json\n```\n\nExample translation file (`en.json`):\n\n```json\n{\n \"welcome\": \"Welcome to our application\"\n}\n```\n\n## Usage\n\n### python\n\n```python\nfrom lang.facades import Lang\n\nLang.current_locale()\nLang.set_locale('en')\nLang.is_locale('en')\nLang.trans('trans')\n```\n\n### templates\n\nIn your templates, use the `__()` helper to display translated text:\n\n```html\n{{ __('not') }}\n```\n\nIf the specified translation string does not exist, the __ function will return the translation string key.\n\n## Contributing\n\nPlease read the [Contributing Documentation](CONTRIBUTING.md) here.\n\n## Maintainers\n\n- [Chris](https://www.github.com/chris1ding1)\n\n## License\n\nMasonite Lang is open-sourced software licensed under the [MIT license](LICENSE).\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Package description in one line displayed e.g. in README",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://github.com/chris1ding1/masonite-lang"
},
"split_keywords": [
"masonite",
" python",
" development"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4e86287e04f3fcc91552771a79b8856a4d2ac9988e878587873b7baccf513ef1",
"md5": "9ef8730c61355becd6533115c7aaa2f8",
"sha256": "f08fb70d18c2722e8eca6885bc67962e873688c1b18e34759015b18b9b306381"
},
"downloads": -1,
"filename": "masonite_lang-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9ef8730c61355becd6533115c7aaa2f8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7615,
"upload_time": "2025-02-01T03:20:24",
"upload_time_iso_8601": "2025-02-01T03:20:24.986015Z",
"url": "https://files.pythonhosted.org/packages/4e/86/287e04f3fcc91552771a79b8856a4d2ac9988e878587873b7baccf513ef1/masonite_lang-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0449c5281184940d5b28355e6a20d4807b8a3e591d726a0230d89a34d7b727e0",
"md5": "f6b7cd0016246fb44b6ec2b98646984d",
"sha256": "787458dd9b48ac0b570d1e3d9c1bf8738153077d31910b78ed981a6cce28b5eb"
},
"downloads": -1,
"filename": "masonite_lang-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f6b7cd0016246fb44b6ec2b98646984d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10849,
"upload_time": "2025-02-01T03:20:26",
"upload_time_iso_8601": "2025-02-01T03:20:26.471702Z",
"url": "https://files.pythonhosted.org/packages/04/49/c5281184940d5b28355e6a20d4807b8a3e591d726a0230d89a34d7b727e0/masonite_lang-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-01 03:20:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "chris1ding1",
"github_project": "masonite-lang",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "masonite",
"specs": [
[
"<",
"5"
],
[
">=",
"4"
]
]
},
{
"name": "masonite-orm",
"specs": [
[
"<",
"3"
],
[
">=",
"2"
]
]
}
],
"lcname": "masonite-lang"
}