Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/properties/ev-properties-view.c
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>2006-12-21 00:44:53 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2006-12-21 00:44:53 (GMT)
commitb6b3c53f47e4e3f03b572591a584d817dfba44f7 (patch)
treea65566ee8cdffb7232fdfe0c07c0228311fdeaeb /properties/ev-properties-view.c
parent6cc40fe44384df3cb2a6c43b8823d0d940254039 (diff)
Check for NL_MEASUREMENT. Fixes bug #376469. Thanks to Damien Carbery
2006-12-21 Nickolay V. Shmyrev <nshmyrev@yandex.ru> * configure.ac: * properties/ev-properties-view.c: (ev_get_default_user_units), (ev_regular_paper_size): Check for NL_MEASUREMENT. Fixes bug #376469. Thanks to Damien Carbery <damien.carbery@sun.com> and Yevgen Muntyan <muntyan@tamu.edu>.
Diffstat (limited to 'properties/ev-properties-view.c')
-rw-r--r--properties/ev-properties-view.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/properties/ev-properties-view.c b/properties/ev-properties-view.c
index 98aecb5..1b8f1fb 100644
--- a/properties/ev-properties-view.c
+++ b/properties/ev-properties-view.c
@@ -31,7 +31,10 @@
#include <time.h>
#include <sys/time.h>
#include <string.h>
+
+#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
#include <langinfo.h>
+#endif
typedef enum
{
@@ -240,17 +243,51 @@ struct regular_paper_size {
{ 432.0f, 279.0f, 3.0f, 3.0f, "Ledger" }
};
+typedef enum {
+ EV_UNIT_INCH,
+ EV_UNIT_MM
+} EvUnit;
+
+static EvUnit
+ev_get_default_user_units (void)
+{
+ /* Translate to the default units to use for presenting
+ * lengths to the user. Translate to default:inch if you
+ * want inches, otherwise translate to default:mm.
+ * Do *not* translate it to "predefinito:mm", if it
+ * it isn't default:mm or default:inch it will not work
+ */
+ gchar *e = _("default:mm");
+
+#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
+ gchar *imperial = NULL;
+
+ imperial = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
+ if (imperial && imperial[0] == 2 )
+ return EV_UNIT_INCH; /* imperial */
+ if (imperial && imperial[0] == 1 )
+ return EV_UNIT_MM; /* metric */
+#endif
+
+ if (strcmp (e, "default:inch")==0)
+ return EV_UNIT_INCH;
+ else if (strcmp (e, "default:mm"))
+ g_warning ("Whoever translated default:mm did so wrongly.\n");
+ return EV_UNIT_MM;
+}
+
static char *
ev_regular_paper_size (const EvDocumentInfo *info)
{
const struct regular_paper_size *size;
+ EvUnit unit;
char *exact_size = NULL;
- char *imperial = NULL;
char *str = NULL;
int i;
-
- imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
- if ( imperial && imperial[0] == 2 )
+
+ unit = ev_get_default_user_units ();
+
+ if (unit == EV_UNIT_INCH)
/* Imperial measurement (inches) */
exact_size = g_strdup_printf( _("%.2f x %.2f in"),
info->paper_width / 25.4f,