Implementing UI translation in SumatraPDF, a C++ Windows application
19 hours ago
- #win32
- #software-localization
- #open-source
- SumatraPDF is a free, open-source PDF/eBook/Comic Book viewer for Windows with a translated UI supporting 72 languages.
- The translation system involves marking strings in source files with _TRA() or _TRN() macros, which are then extracted via a script.
- Translations are managed via a custom web app called AppTranslator, designed to be simple and efficient, without requiring a database.
- The C++ implementation embeds translations in the executable, using a linear scan for lookup, which is efficient enough for the purpose.
- Dialog resizing for different languages is handled by DialogSizer to accommodate varying string lengths.
- The system evolved from manual email submissions to a web-based solution, with considerations for future GitHub-based translation workflows.
- The author considered but rejected traditional methods like per-language .rc files, XML, and GNU gettext for being less efficient or user-friendly.