The Notes application has been fully internationalized with support for multiple languages. All user-facing strings have been marked for translation using Qt's translation system.
- English (en) - Default language
- Italian (it) - Full translation included
main.py- Added i18n support, language detection, and translation loading- Added
--langparameter for manual language selection - Auto-detection from system locale
- Translation file loading from
i18n/directory
- Added
All GUI widgets updated with self.tr() for translatable strings:
gui/notebook_list.py- Notebook list widgetgui/note_list.py- Note list widgetgui/editor_widget.py- Note editor widget
Updated all comments and docstrings to English:
models/database.py- Database managementspeech/transcriber.py- Speech-to-text transcription
i18n/en.ts- English translation sourcei18n/it.ts- Italian translation sourcei18n/en.qm- English compiled (requires Qt tools)i18n/it.qm- Italian compiled (requires Qt tools)
update_translations.sh- Script to extract and compile translationscompile_translations.py- Fallback for systems without Qt toolsINSTALL.sh- Updated with translation compilation
README.md- Fully translated to English with i18n sectionpyproject.toml- Added translation notes
-
Language Detection:
- System locale is detected automatically (
QLocale.system()) - Can be overridden with
--langparameter
- System locale is detected automatically (
-
Translation Loading:
- Looks for
.qmfile ini18n/<lang>.qm - Loads and installs translator if found
- Falls back to English if translation not available
- Looks for
-
String Marking:
- All UI strings use
self.tr("String")for translation - Format strings use
.arg()method:self.tr("File '%1' saved").arg(filename)
- All UI strings use
# Auto-detect (default)
poetry run python main.py
# Force English
poetry run python main.py --lang en
# Force Italian
poetry run python main.py --lang itWhen you modify strings in the code:
# Extract strings and update .ts files
./update_translations.sh
# Or manually:
pylupdate6 main.py gui/*.py -ts i18n/en.ts i18n/it.ts
lrelease i18n/en.ts i18n/it.ts-
Copy an existing
.tsfile:cp i18n/en.ts i18n/es.ts # For Spanish -
Edit with Qt Linguist (recommended):
linguist i18n/es.ts
Or manually edit the XML file.
-
Compile the translation:
lrelease i18n/es.ts -qm i18n/es.qm
-
Test:
python main.py --lang es
All translatable strings are organized by context (class name):
- NotesApp - Main window strings
- NotebookList - Notebook management
- NoteList - Note list operations
- EditorWidget - Note editor interface
- Uses
QTranslatorclass .tsfiles are XML-based translation source files.qmfiles are compiled binary translation filespylupdate6extracts strings from Python codelreleasecompiles.tsto.qm
Format: self.tr("Text with %1 placeholder").arg(value)
Example:
self.tr("Notebook '%1' created!").arg(name)For translation compilation:
pylupdate6(included with PyQt6)lrelease(requires Qt tools package)- Ubuntu/Debian:
qttools5-dev-tools - Fedora:
qt6-qttools - Arch:
qt6-tools
- Ubuntu/Debian:
- All code comments and docstrings are now in English
- User-facing strings default to English
- Translation files can be edited without recompiling the application
- Missing translations fall back to English
- The application automatically detects the system language on first run