f4a46a
diff -up libpaper-1.1.24+nmu3/lib/paper.c.useglibcfallback libpaper-1.1.24+nmu3/lib/paper.c
f4a46a
--- libpaper-1.1.24+nmu3/lib/paper.c.useglibcfallback	2010-04-24 08:12:11.000000000 -0400
f4a46a
+++ libpaper-1.1.24+nmu3/lib/paper.c	2014-04-22 15:58:33.120039001 -0400
f4a46a
@@ -20,6 +20,9 @@
f4a46a
 
f4a46a
 #include <unistd.h>
f4a46a
 
f4a46a
+#include <locale.h>
f4a46a
+#include <langinfo.h>
f4a46a
+
f4a46a
 #include "paper.h"
f4a46a
 
f4a46a
 struct paper {
f4a46a
@@ -108,6 +111,27 @@ in PAPERCONFVAR, fall-back to the old be
f4a46a
 }
f4a46a
 
f4a46a
 const char* defaultpapername(void) {
f4a46a
+#if defined(LC_PAPER) && defined(_GNU_SOURCE)
f4a46a
+
f4a46a
+#define NL_PAPER_GET(x)         \
f4a46a
+  ((union { char *string; unsigned int word; })nl_langinfo(x)).word
f4a46a
+
f4a46a
+#define PT_TO_MM(v) (unsigned int)((v * 2.54 * 10 / 72) + 0.5)
f4a46a
+
f4a46a
+    const struct paper* pp;
f4a46a
+
f4a46a
+    unsigned int w = NL_PAPER_GET(_NL_PAPER_WIDTH);
f4a46a
+    unsigned int h = NL_PAPER_GET(_NL_PAPER_HEIGHT);
f4a46a
+
f4a46a
+    for (pp = paperfirst(); pp; pp = papernext(pp)) {
f4a46a
+	if (
f4a46a
+             PT_TO_MM(pp->pswidth) == w &&
f4a46a
+             PT_TO_MM(pp->psheight) == h
f4a46a
+           ) {
f4a46a
+	    return pp->name;
f4a46a
+	}
f4a46a
+    }
f4a46a
+#endif
f4a46a
     return PAPERSIZE;
f4a46a
 }
f4a46a
 
f4a46a
diff -up libpaper-1.1.24+nmu3/man/paperconf.1.in.useglibcfallback libpaper-1.1.24+nmu3/man/paperconf.1.in
f4a46a
--- libpaper-1.1.24+nmu3/man/paperconf.1.in.useglibcfallback	2014-04-22 15:58:33.121038995 -0400
f4a46a
+++ libpaper-1.1.24+nmu3/man/paperconf.1.in	2014-04-22 16:00:15.973428376 -0400
f4a46a
@@ -48,10 +48,12 @@ looking in order at the
f4a46a
 .B @PAPERSIZEVAR@
f4a46a
 environment variable, at the contents of the file specified by the
f4a46a
 .B @PAPERCONFVAR@
f4a46a
-environment variable, at the contents of
f4a46a
+environment variable, at the contents of the file
f4a46a
 .B @PAPERCONF@
f4a46a
-or by using
f4a46a
-.B letter
f4a46a
+, consulting the values controlled by the
f4a46a
+.B LC_PAPER
f4a46a
+locale setting, or by using
f4a46a
+.B @PAPERSIZE@
f4a46a
 as a fall-back value if none of the other alternatives are successful.
f4a46a
 By default, width and height of the paper are printed in PostScript points.
f4a46a
 .SH OPTIONS
f4a46a
diff -up libpaper-1.1.24+nmu3/src/paperconf.c.useglibcfallback libpaper-1.1.24+nmu3/src/paperconf.c
f4a46a
--- libpaper-1.1.24+nmu3/src/paperconf.c.useglibcfallback	2012-05-03 15:05:12.000000000 -0400
f4a46a
+++ libpaper-1.1.24+nmu3/src/paperconf.c	2014-04-22 15:58:33.121038995 -0400
f4a46a
@@ -13,6 +13,7 @@
f4a46a
 #include <errno.h>
f4a46a
 
f4a46a
 #include <paper.h>
f4a46a
+#include <locale.h>
f4a46a
 
f4a46a
 
f4a46a
 /* needed for GNU/Hurd */
f4a46a
@@ -99,6 +100,8 @@ int main(int argc, char** argv)
f4a46a
 
f4a46a
     const char* progname;
f4a46a
 
f4a46a
+    setlocale(LC_ALL, "");
f4a46a
+
f4a46a
     progname = strrchr(*argv, '/');
f4a46a
     if (progname) {
f4a46a
 	++progname;