Skip to main content

About tgext.langdomain

tgext.langdomain is a TurboGears2 extension that supports detecting the user language from the domain it is connecting from.

Installing

tgext.langdomain can be installed from pypi:

pip install tgext.langdomain

should just work for most of the users.

Enabling

To enable tgext.langdomain put inside your application config/app_cfg.py the following:

import tgext.langdomain
tgext.langdomain.plugme(base_config)

or you can use tgext.pluggable when available:

from tgext.pluggable import plug
plug(base_config, 'tgext.langdomain')

Options

langdomain will force the language of the current request based on: Top Level Domain, SubDomain and param unless there is already a language stored into the session.

By default none of those behaviours is enabled

When plugging langdomain the following options to turn on behaviours are available:

param -> Name of the GET param used to force language, True means lang.

tld -> Dict of tld that map to a language

EXAMPLE:

plug(app_cfg, 'tgext.langdomain',
     tld={
       'com': 'en',
       'it': 'it'
})

subdomain -> Dict of subdomains that map to a language

EXAMPLE:

plug(app_cfg, 'tgext.langdomain',
     subdomain={
       'en': 'en',
       'it': 'it'
})

When requests are performed like it.server.net it will lookup it inside the subdomain dictionary and net inside the tld dictionary.

Release files for tgext.langdomain 0.0.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 tgext.langdomain 0.0.1
File Size Uploaded
tgext.langdomain-0.0.1.tar.gz 3.5 kB Details

Release files / tgext.langdomain-0.0.1.tar.gz

Download URL tgext.langdomain-0.0.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3ab19653e80c09221812288735e3a2c2d329a550f875db2297a5cc6bc75d4743
BLAKE2b-256 checksum
How to use checksums
2becaede2093933aac2468ca56c59173b5725529ae8c3f49308ec5dbc299af18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

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