Nim is going towards 1.0 but would you plan to add internationalization-friendly tools/functions in stdlib? Nim forces me to scratch my head every time I need to parse/handle strings with Cyrillic. GLib and GTK underlies almost every Linux application, all of them works good with all languages. Wouldn't this be a good idea to take some API ideas from GLib?
I agree that localization support is important and that we should have something in the stdlib for it.
Perhaps you could find the time implement a localization module for the stdlib?
I agree that localization support is important and that we should have something in the stdlib for it.
Perhaps you could find the time implement a localization module for the stdlib?
It would be nice if this PR will be accepted but I have no idea now it should be implemented. Easy but probably unportable way - using gettext from glibc, but what about Windows? And how should translations be installed?
One interesting solution I see - using power of macros in Nim. Parse po-files in compile time and make (perfect?) hash table for it that will be included statically into executable. This will follow Nim's spirit - no external deps and portable executable. But handling plural forms and encodings by hands will bring troubles (something what looks like nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n) especially Ukrainian that has 4 plural forms.
It definitely needs a comments from contributors before implementation.
UPD: Looking at glibc internals shows that gettext uses balanced tree for string search and little plural forms evaluation engine and it also supports po (text) and gmo (binary) formats. We could use a macro that compiles plural form expression to C and probably critbit tree. But external domains support is under question.