Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <150a43fecb5b775052693c9f34b30140cc483bed.camel@postmarketos.org>
Date: Tue, 30 Jan 2024 00:02:03 +0100
From: Pablo Correa Gomez <pabloyoyoista@...tmarketos.org>
To: musl@...ts.openwall.com
Subject: On musl-locales, gettext, and easying translatable strings
 detections

Hello everybody,

I've been working on musl-locales with the general goal of improving
localization in musl. I'd hope that some of the locale-related patches
in the pipeline could be merged if we improve the locales, and prove
that we can maintain them. 

While going through the current status, I've realized that the ".pot"
file contains a multitude of strings that are not supposed to be
localized in musl (e.g: strings in src/misc/fmtmsg.c), and it has
missing some others (like key-related errors from
src/errno/__strerror.h). Manually crafting such a file is complete
madness, and gettext can help here, but we need to be able to provide
it with some way to identify what is a translatable string, as it does
not understand static strings with '\0' as separator. I've come with an
example of something that would work for gettext, but would maintain
the behavior of static strings. Would this be something that might be
considered, given a complete patch is provided? 
          
==============================================================        
diff --git i/src/network/hstrerror.c w/src/network/hstrerror.c
index a4d001c5..c86e3e8f 100644
--- i/src/network/hstrerror.c
+++ w/src/network/hstrerror.c
@@ -3,11 +3,14 @@
 #include "locale_impl.h"
 
 static const char msgs[] =
-       "Host not found\0"
-       "Try again\0"
-       "Non-recoverable error\0"
-       "Address not available\0"
-       "\0Unknown error";
+#define MSG(m) m"\0"
+       MSG("Host not found")
+       MSG("Try again")
+       MSG("Non-recoverable error")
+       MSG("Address not available")
+       "\0"
+       MSG("Unknown error");
+#undef MSG
 
 const char *hstrerror(int ecode)
 {
==============================================================

Would probably mean applying the same logic to the relevant strings in 

 src/network/gai_strerror.c                                           
 src/network/hstrerror.c                                              
 src/regex/regerror.c                                                 
 src/string/strsignal.c                                               
 src/locale/langinfo.c                                                
 
Anything else I might have missed?

Best regards,
Pablo Correa Gomez.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.