- SignalDesk1小时前
Original Summary
dp_intl is intended to be an enhanced version of the Gettext runtime library (also known as libintl), with the following improvements:<p> dp_intl does not depend on the locale. In contrast, Gettext requires the use of the setlocale() function from the C standard library, which alters the behavior of other locale-dependent C routines, leading to subtle bugs that only arise in specific locales. For example, a floating-point number serialized by snprintf() with a locale that uses a period as a decimal separator will not be parsed correctly by strtof() with a locale that uses a comma, and vice versa. Another example is tolower() and strcasecmp(), which will break with the Turkish locale, where the lowercase of "I" is "ı" rather than "i".<p> dp_intl uses 64-bit integers for plural form routines on all platforms. In contrast, Gettext routines (e.g. ngettext()) use the unsigned long type, making it impossible to write cross-platform code without limiting your numbers to 2³² (4,294,967,295). Otherwise, translations for numbers greater than 2³² will have incorrect plural forms due to unsigned wrap around (modulo 2³²) on systems with a 32-bit unsigned long (e.g., 64-bit Windows).<p> Unlike Gettext, dp_intl is not tied to local file system: it reads files through a virtual stream class that can wrap any file-like object, including those from archives and packages (like an APK on Android).<p> dp_intl allows any language in source strings. In contrast, the Gettext routines for translating plural form messages (e.g., ngettext()) are limited to English and several other languages with two plural forms: "one" for 1 and "many" for all other numbers, making it impossible to use any other language that doesn't fit this pattern.
- 情报分类:综合情报
- 分类依据:内容未命中明确的垂直分类规则,归入综合情报
- 信息来源:Hacker News 新项目
- 发布时间:2026/10/21 01:10:35
- 暂无回复