Skip to main content

This is a django implementation of next js exported i18next files. The package helps you use exported next js i18next multilanguage files without writing any url or views with django on its backend. Useage is simple.

  1. Implement next js i18next multilanguage with static props. For example we are using 'en', 'ru', 'es', 'it','fr','ar' and 'ar' languages in i18next.
  2. Export next js file in a banch inside backend project then direct django staticfiles directory to out folder.
  3. Import the package and write the languages that you exported in nextjs-i18 as written below.
# urls.py
from django-nextjs-i18 import i18_language_list


i18=i18_language_list(default='en',others=['ru','es','it','fr','ar'])
template_path=i18.template_path

app_name='home'

urlpatterns = [
# Home
    template_path('', '.html', name='home'),
# FAQ
    template_path('faq/', '/faq.html', name='faq'),
# Terms And Conditions
    template_path('termsandconditions/', '/termsandconditions.html', name='terms_and_conditions'),
# About
    template_path('about', '/about.html', name='about'),
]

urlpatterns=i18.urlpatterns(urlpatterns)

This code generates 6 urls for each template_path that you write in urlpatterns. So you can enter 127.0.0.1:8000 for default('en' in this example) language. Then 127.0.0.1:8000/ru for 'ru' - Russian version and 127.0.0.1:8000/es for 'es' - Spanish version. and etc.

You can also use method_path for more custom views

def myfunctionview(request, static_path):
    print(static_path) # It will create 6 views and urls in our case(en, ru es,'it','fr','ar') but you can create as many as you want
    return render(request, static_path+'/home.html')

method_path=i18.template_path

urlpatterns = [
# Home
    method_path('', myfunctionview, name='home'),
]

Release files for django-nextjs-i18 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 django-nextjs-i18 0.0.1
File Size Uploaded
django-nextjs-i18-0.0.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-nextjs-i18 0.0.1
File Interpreter ABI Platform
django_nextjs_i18-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / django-nextjs-i18-0.0.1.tar.gz

Download URL django-nextjs-i18-0.0.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2decf1d18fc7f50932f2ff08a7c201d535647c428dfbd3fa1816ad1bd75ff0b5
BLAKE2b-256 checksum
How to use checksums
098b6006ba95307bd24d09095684d9c6678a01fe005403547aec359fc84f1038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / django_nextjs_i18-0.0.1-py3-none-any.whl

Download URL django_nextjs_i18-0.0.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56cbab317b87668a90f9c1c4bba5b689fada826ed6ddc7f7390cf1572b7de77f
BLAKE2b-256 checksum
How to use checksums
59c544597561c466d7e111359c00598e4e7dab6e1c313f58dadf88b802d62694
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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