StashCast now supports multiple languages! The UI language and video subtitle language are configured via the LANGUAGE_CODE environment variable.
Add to your .env file:
# Set language code ('en' for English, 'es' for Spanish)
LANGUAGE_CODE=esCurrently supported with full translations:
en/en-us- English (default)es- Español (Spanish)pt- Português (Portuguese)
Adding more languages:
Additional languages can be added by creating translation files (.po) and compiling them. See the "Creating Translations" section below for instructions on how to contribute translations for other languages.
The LANGUAGE_CODE setting controls:
- All text in the web interface (buttons, labels, messages)
- Admin interface language
- RSS feed titles and descriptions
- Status messages and error messages
The same LANGUAGE_CODE setting also controls:
- Video subtitle download language - yt-dlp will download subtitles/transcripts in your specified language
- Automatic subtitle generation (if available)
When you set LANGUAGE_CODE=es, for example:
- The UI will display in Spanish
- Videos will download Spanish subtitles (if available)
- Summaries will be generated from Spanish transcripts
- Generate message files for the language you want to add (e.g., Spanish):
python manage.py makemessages -l esThis creates locale/es/LC_MESSAGES/django.po
- Translate the strings in the
.pofile:
msgid "Add URL"
msgstr "Añadir URL"
msgid "Download media from any URL"
msgstr "Descargar medios desde cualquier URL"- Compile the translations:
python manage.py compilemessagesThis creates locale/es/LC_MESSAGES/django.mo
- Test your translations:
export LANGUAGE_CODE=es
python manage.py runserverWhen new strings are added to the codebase:
# Update all translation files with new strings
python manage.py makemessages -a
# Compile after translating
python manage.py compilemessagesstashcast/
├── locale/
│ ├── en/
│ │ └── LC_MESSAGES/
│ │ ├── django.po # English strings (reference)
│ │ └── django.mo # Compiled (generated)
│ ├── es/
│ │ └── LC_MESSAGES/
│ │ ├── django.po # Spanish translations
│ │ └── django.mo # Compiled (generated)
│ └── fr/
│ └── LC_MESSAGES/
│ ├── django.po # French translations
│ └── django.mo # Compiled (generated)
Django uses standard language codes:
- Two-letter codes:
en,es,fr,de - Regional variants:
en-us,en-gb,pt-br,zh-hans
StashCast automatically extracts the primary language code for subtitle downloads:
en-us→ subtitles inenzh-hans→ subtitles inzh-hanspt-br→ subtitles inpt
- All user-facing text wrapped in
{% trans %}or{% blocktrans %}tags - Page titles, buttons, labels, descriptions, messages
- Model field choices (status messages, media types)
- Form labels and help text
- View messages and notifications
- Error messages
- Media content (titles, descriptions from sources)
- User-entered data
- URLs and technical identifiers
- Code and configuration
When combined with proper subtitle support, i18n makes StashCast accessible to:
- Non-English speakers - full UI in their language
- Deaf/hard-of-hearing users - subtitles in their language
- Learning users - content with transcripts for comprehension
We welcome translation contributions! To add a new language:
- Fork the repository
- Generate the message file:
python manage.py makemessages -l <lang_code> - Translate strings in
locale/<lang_code>/LC_MESSAGES/django.po - Compile:
python manage.py compilemessages - Test your translations
- Submit a pull request
Please ensure translations are:
- Accurate and natural in the target language
- Consistent in terminology
- Properly formatted (maintain placeholders like
%(name)s) - Culturally appropriate
- Compile messages:
python manage.py compilemessages - Restart the server: Changes require a restart
- Check LANGUAGE_CODE: Verify it's set correctly in your
.env - Clear browser cache: Sometimes needed for static content
- Check LANGUAGE_CODE: Should match your preferred subtitle language
- Not all videos have subtitles: Some sources don't provide subtitles in all languages
- Automatic subtitles: yt-dlp will fallback to auto-generated subtitles if available
- Some strings may not be translated yet
- Contribute translations to help complete the language pack!
In stashcast/settings.py:
# Language code from environment variable
LANGUAGE_CODE = os.environ.get('LANGUAGE_CODE', 'en-us')
# Supported languages
LANGUAGES = [
('en', 'English'),
('es', 'Español'),
# ... more languages
]
# Translation files location
LOCALE_PATHS = [
BASE_DIR / 'locale',
]
# Subtitle language for yt-dlp (derived from LANGUAGE_CODE)
STASHCAST_SUBTITLE_LANGUAGE = LANGUAGE_CODE.split('-')[0]In media/service/download.py:
ydl_opts = {
'writesubtitles': True,
'writeautomaticsub': True,
'subtitleslangs': [settings.STASHCAST_SUBTITLE_LANGUAGE],
# ... other options
}