🚀
ShipWithDjango Documentation
  • Welcome to ShipWithDjango Documentation
  • When and How to use ShipWithDjango?
  • Getting Started
    • Obtaining a license
    • Downloading ShipWithDjango
    • Running locally
    • Next steps
  • Platform
    • Default Configuration
    • Subnavigation
  • Theme
    • Tailwind CSS
    • Configuration
  • Secret Management
    • Default Configuration
    • Setting your environment variables
    • Third-party providers
      • Infisical
      • AWS Secrets Manager
      • Azure Key Vault
    • Order of retrieval
  • Authentication
    • Default Configuration
    • GitHub
    • LinkedIn
  • Emailing
    • Default Configuration
    • Using SendGrid
    • Using SMTP
    • Using the task queue for sending emails
  • Payments & Billing
    • Billing
    • Stripe
  • OpenAI/Dall-E
    • Default Configuration
  • API
    • Django REST framework
    • Built-in API utilities
    • Postman
  • Logging
    • Default Configuration
    • Using Sentry
    • Using Better Stack
  • Localization
    • Translations
Powered by GitBook
On this page
  • Configuration Details
  • Adding More Languages
  1. Localization

Translations

PreviousUsing Better Stack

Last updated 9 months ago

ShipWithDjango simplifies the process of managing translations through the use of Django Rosetta, a powerful tool that provides a fully functional graphical interface for handling your application's translations. This means you can easily manage your translations without needing to directly edit .mo and .po files. For more details about Django Rosetta, you can visit the .

Configuration Details

Source Language

The SOURCE_LANGUAGE_CODE and SOURCE_LANGUAGE_NAME settings define the primary language of your application, which serves as the source language for all translations.

SOURCE_LANGUAGE_CODE = 'en-us'
SOURCE_LANGUAGE_NAME = 'English'

Rosetta Messages Per Page

The ROSETTA_MESSAGES_PER_PAGE setting controls how many translation messages are displayed per page in the Rosetta interface. Adjusting this number can help you manage the volume of translations you work with at one time.

ROSETTA_MESSAGES_PER_PAGE = 100

Translating Languages

  • ROSETTA_LANGUAGES: This setting lists the languages that can be translated from the source language using the admin panel. Note that these languages are only available in the admin panel for translation purposes and are not visible to users on the front end. If you want these languages to be selectable by users, you need to add them to the LANGUAGES setting.

    ROSETTA_LANGUAGES = []
  • LANGUAGES: This setting defines the languages available for users to select on the front end of your application. Languages listed here will also be available for translation in the admin panel.

    LANGUAGES = [
        ('en-us', 'English')
    ]

Translation Service API Keys

If you use external translation services, ShipWithDjango supports integration with various providers through API keys. These services can assist in automating or improving the accuracy of your translations.

  • Yandex Translate: Set the YANDEX_TRANSLATE_KEY to use Yandex's translation services.

  • Azure Translator: Set the AZURE_CLIENT_SECRET to integrate with Microsoft's Azure Translator service.

  • DeepL: Set the DEEPL_AUTH_KEY to use the DeepL translation service.

YANDEX_TRANSLATE_KEY = None  # See http://api.yandex.com/translate/
AZURE_CLIENT_SECRET = None  # See https://learn.microsoft.com/en-us/azure/ai-services/translator/
DEEPL_AUTH_KEY = None  # See https://www.deepl.com/pro#developerr

Adding More Languages

To add more languages for translation:

  1. For Admin Translation Only: Add the language codes to ROSETTA_LANGUAGES. These languages will be available in the Rosetta interface but not on the front end.

    ROSETTA_LANGUAGES = [
        ('es', 'Spanish'),
        ('fr', 'French'),
    ]
  2. For User Selection: Add the language codes to LANGUAGES. This will make them available both in the Rosetta interface and on the front end for users to select.

    LANGUAGES = [
        ('en-us', 'English'),
        ('es', 'Spanish'),
        ('fr', 'French'),
    ]

Django Rosetta documentation