gok r2641 - in trunk: . gok



Author: gerdk
Date: Mon Feb 16 10:57:41 2009
New Revision: 2641
URL: http://svn.gnome.org/viewvc/gok?rev=2641&view=rev

Log:
2009-02-16  Gerd Kohlberger  <gerdk svn gnome org>

	* gok/gok-keyboard.c: Add 'no-level' flags to avoid empty msgids
	in .po files. See bug #567105 for details.



Modified:
   trunk/ChangeLog
   trunk/gok/gok-keyboard.c

Modified: trunk/gok/gok-keyboard.c
==============================================================================
--- trunk/gok/gok-keyboard.c	(original)
+++ trunk/gok/gok-keyboard.c	Mon Feb 16 10:57:41 2009
@@ -602,18 +602,21 @@
 					const gchar *level3_string)
 {
 	GokKey *pKey = pKeyboard->pKeyFirst;
-	gboolean has_level_1 = level1_string && *level1_string;
-	gboolean has_level_2 = level2_string && *level2_string;
-	gboolean has_level_3 = level3_string && *level3_string;
-
-	if (!(level0_string && g_utf8_validate (level0_string, -1, NULL)) || 
-	    (level1_string && !g_utf8_validate (level1_string, -1, NULL)) || 
-	    (level2_string && !g_utf8_validate (level2_string, -1, NULL)) || 
-	    (level3_string && !g_utf8_validate (level3_string, -1, NULL))) 
+	gboolean has_level_1, has_level_2, has_level_3;
+
+	if (!g_utf8_validate (level0_string, -1, NULL) ||
+	    !g_utf8_validate (level1_string, -1, NULL) ||
+	    !g_utf8_validate (level2_string, -1, NULL) ||
+	    !g_utf8_validate (level3_string, -1, NULL))
 	{
 		return;
 	}
 
+	has_level_1 = *level1_string != '\0';
+	/* check for 'no-level' flag */
+	has_level_2 = *level2_string && !g_str_equal (level2_string, "no-level-2");
+	has_level_3 = *level3_string && !g_str_equal (level3_string, "no-level-3");
+
 	if (pKey)
 	{
 	    while (pKey->pKeyNext)
@@ -646,14 +649,14 @@
 			gok_keylabel_new (pKey, utf8_char, 1, 0, NULL);
 			level1_string = g_utf8_find_next_char (level1_string, NULL);
 		}
-		if (*level2_string)
+		if (has_level_2 && *level2_string)
 		{
 			/* FIXME: get the appropriate modifiers and mod masks! */
 			utf8_char [g_unichar_to_utf8 (g_utf8_get_char (level2_string), utf8_char)] = '\0';
 			gok_keylabel_new (pKey, utf8_char, 2, 0, NULL);
 			level2_string = g_utf8_find_next_char (level2_string, NULL);
 		}
-		if (*level3_string)
+		if (has_level_3 && *level3_string)
 		{
 			utf8_char [g_unichar_to_utf8 (g_utf8_get_char (level3_string), utf8_char)] = '\0';
 			gok_keylabel_new (pKey, utf8_char, 3, 0, NULL);
@@ -843,16 +846,27 @@
 						 * correspond to uppercase versions of characters in the 'level 0' string.
 						 */
 						C_("level 1", "ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"3$%^&*()_+{}:@~<>?"),
-						/* Not used in C locale: this string can contain a third set of characters
+						/* 
+						 * Not used in C locale: this string can contain a third set of characters
 						 * at another 'shift level'.  It can be used to provide a second/alternate
 						 * glyph/character set for the locale, separately or in conjunction with
 						 * 'level 3'.  At the translator's discretion, accented characters can be
 						 * placed here and in 'level 3' as well. 
+						 *
+						 * Important: Do not translate "no-level-2". This string is intended as a
+						 * placeholder to signal GOK that 'level 2' is not used. If your locale doesn't
+						 * require 'level 2' characters, set the msgstr to "no-level-2".
+						 */
+						C_("level 2", "no-level-2"),
+						/* 
+						 * For locales which need an even larger character set, or offer uppercase versions
+						 * of the 'level2' characters, add them to 'level 3'
+						 *
+						 * Important: Do not translate "no-level-3". This string is intended as a
+						 * placeholder to signal GOK that 'level 3' is not used. If your locale doesn't
+						 * require 'level 3' characters, set the msgstr to "no-level-3".
 						 */
-						C_("level 2", ""),
-						/* For locales which need an even larger character set, or offer uppercase versions
-						 * of the 'level2' characters, add them to 'level 3' */
-						C_("level 3", "")); 
+						C_("level 3", "no-level-3")); 
 
 	if (!gok_main_get_login ()) 
 	{
@@ -903,9 +917,18 @@
 						C_("freq-level 1", "ETAONRISHDLFCMUGYPWBVKXJQZ~! #$%^&*()_+|{}:\"><>?"),
 						/* 
 						 * Seldom-used or alternate characters can appear in levels 2 and 3 if necessary.
+						 *
+						 * Important: Do not translate "no-level-2". This string is intended as a
+						 * placeholder to signal GOK that 'level 2' is not used. If your locale doesn't
+						 * require 'level 2' characters, set the msgstr to "no-level-2".
+						 */
+						C_("freq-level 2", "no-level-2"),
+						/*
+						 * Important: Do not translate "no-level-3". This string is intended as a
+						 * placeholder to signal GOK that 'level 3' is not used. If your locale doesn't
+						 * require 'level 3' characters, set the msgstr to "no-level-3".
 						 */
-						C_("freq-level 2", ""),
-						C_("freq-level 3", "")); /* no level 2 or 3 in C locale */
+						C_("freq-level 3", "no-level-3"));
 	if (!gok_main_get_login ()) 
 	{
 	    gok_keyboard_add_compose_aux_keys (pKeyboard);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]