paps/paps-0.6.6-lcctype.patch

48 lines
1.2 KiB
Diff

diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
--- paps-0.6.6.orig/src/paps.c 2006-06-20 04:17:28.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-06-20 04:24:27.000000000 +0900
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
+#include <locale.h>
#define BUFSIZE 1024
#define DEFAULT_FONT_FAMILY "Monospace"
@@ -188,6 +188,26 @@
return retval;
}
+static PangoLanguage *
+get_language(void)
+{
+ PangoLanguage *retval;
+ gchar *lang = g_strdup (setlocale (LC_CTYPE, NULL));
+ gchar *p;
+
+ p = strchr (lang, '.');
+ if (p)
+ *p = 0;
+ p = strchr (lang, '@');
+ if (p)
+ *p = 0;
+
+ retval = pango_language_from_string (lang);
+ g_free (lang);
+
+ return retval;
+}
+
int main(int argc, char *argv[])
{
gboolean do_landscape = FALSE, do_rtl = FALSE, do_justify = FALSE, do_draw_header = FALSE;
@@ -269,7 +289,7 @@
pango_context = paps_get_pango_context (paps);
/* Setup pango */
- pango_context_set_language (pango_context, pango_language_from_string ("en_US"));
+ pango_context_set_language (pango_context, get_language ());
pango_context_set_base_dir (pango_context, pango_dir);
/* create the font description */