Socket
Socket
Sign inDemoInstall

django_i18nize

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    django_i18nize

Django i18nize extends the i18nize python client. Template tag for rendering translation and Management command for fetching translations is added.


Maintainers
1

Readme

django_i18nize

Django i18nize extends the i18nize python client. This package contains template tag for rendering translation and management command for fetching translations.

  • Website: http://www.i18nize.com
  • Python client: https://github.com/iktw/i18nize
  • JavaScript client: https://github.com/iktw/i18nize-javascript

Installation

pip install django_i18nize

Example configuration (settings.py)

DJANGO_I18NIZE_CONFIG = {
    "project_id": "852c3729-6098-410e-ad9e-9783958bbc2d",
    "live": False,
    'destination_dir': os.path.realpath(os.path.join(REPO_DIR, 'staticfiles', 'locale'))
}

Example 1: Template tag with simple translations (Uses the django language)

<p>
    {% i18n_switch "hello" %}
</p>

Example 2: Template tag example with custom language:

<p>
    {% i18n_switch "hello" "sv" %}
</p>

Example 3: Template tag example with values

Passed view context:
	context = {
		'values': {
			'name': 'John Doe'
		}
	}

Your translation at www.i18nize.com:

"Hello {{name}}!"

Inside your django template:
<p>
    {% i18n_switch "greet_person" "en" values %}
</p>

Example 4: Usage within your python code

from django_i18nize.utils import get_translation as _

# Simple translation (Uses the django language)
text = _('hello')

# Translation with custom language
text = _('hello', language='sv')

# Translation with custom values, remember that your key should be injected within your translation.
# For example, your translated key at www.i18nize.com should be "Hello {{name}}!"
text = _('greeting', values={"name": "John Doe"})

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc