-
Notifications
You must be signed in to change notification settings - Fork 28
Description
I propose to convert hardcoded user-facing strings in the Synapse library to resourcestring declarations. This change would enable seamless localization of the library using the standard GNU GetText toolchain (or any other Pascal i18n system that works with resource strings), without breaking existing projects or adding runtime overhead by default.
Current Problem:
Currently, all user-visible strings (like error descriptions in TBlockSocket.GetErrorDesc) are hardcoded as string literals. This makes it impossible to use standard Delphi/FPC internationalization tools (like rstconv, dxgettext) to extract and translate these strings for applications targeting a global audience.
Proposed Solution:
-
Declare all library messages as resourcestring in their respective units (or in a dedicated resource string unit).
-
Use these resourcestring identifiers in the code instead of literals.
Key Advantages:
-
Zero Impact on Existing Code: This is a compile-time change. The resourcestring is stored in the program's resources and at runtime behaves like a regular string variable. All existing code will continue to work exactly as before, receiving English text.
-
Native GNU GetText Support: Once strings are declared as resourcestring, standard tools can automatically extract them into .po files for translation with GetText. This is the standard, widely adopted approach in the Pascal ecosystem.
-
No New Dependencies or APIs: The library doesn't need to introduce any new translation functions, callbacks, or objects. The entire mechanism relies on a core language feature.
-
Maintainer-Friendly: Translations become the concern of the end-application developer. The Synapse library itself does not need to manage or distribute language files.