From 9e419db77aeecc20c73df1d7342db1d7d9f32c22 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 21 Nov 2006 04:21:51 +0000 Subject: [PATCH] * Prefer exact keymap locale matches to substring matches. --- debian/changelog | 1 + locale.inc | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 6ca439e..549f03f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ gfxboot-theme-ubuntu (0.3.0) UNRELEASED; urgency=low * Add Swiss French keymap (closes: Malone #67355). * Pass any country code found in ll_CC form in the "lang" file through to Linux. Make sure to strip off the country internally when required. + * Prefer exact keymap locale matches to substring matches. -- Colin Watson Sun, 29 Oct 2006 21:11:47 +0000 diff --git a/locale.inc b/locale.inc index 4cbb6f0..2fce147 100644 --- a/locale.inc +++ b/locale.inc @@ -43,9 +43,11 @@ /config.keymap.locale exch def /setkeymap.found false def + + % Look for an exact match first. keymaps { dup .km.locales get { - config.keymap.locale exch strstr 0 ne { + config.keymap.locale exch eq { dup /config.keymap exch def /setkeymap.found true def exit } if } forall @@ -53,6 +55,19 @@ setkeymap.found { exit } if } forall + % If that didn't work, try a substring match. + setkeymap.found not { + keymaps { + dup .km.locales get { + config.keymap.locale exch strstr 0 ne { + dup /config.keymap exch def /setkeymap.found true def exit + } if + } forall + pop + setkeymap.found { exit } if + } forall + } if + % if we couldn't find anything, try without the country setkeymap.found not { config.keymap.locale "_" strstr dup 0 ne {