Index: gnopernicus/speech/libsrs/srs-speech.c
===================================================================
RCS file: /cvs/gnome/gnopernicus/speech/libsrs/srs-speech.c,v
retrieving revision 1.12
diff -u -r1.12 srs-speech.c
--- gnopernicus/speech/libsrs/srs-speech.c	8 May 2006 10:01:56 -0000	1.12
+++ gnopernicus/speech/libsrs/srs-speech.c	11 May 2006 09:39:49 -0000
@@ -291,46 +291,55 @@
     return srs_gs_get_driver_voices (driver); 
 }
 
-static struct
+struct _SRSCharSpell
 {
     gunichar ch;
     gchar   *cbc; 
     gchar   *military;
-}srs_sp_spell_table[] =
+};
+
+typedef struct _SRSCharSpell SRSCharSpell;
+
+static SRSCharSpell **srs_sp_spell_table;
+
+static void
+srs_init_spell_table (const gchar *sstr)
+{
+    gchar **tokens;
+    gint i, cnt;
+
+    g_assert (sstr);
+
+    tokens = g_strsplit (sstr, "|",  -1);
+    for (cnt = 0; tokens[cnt]; cnt++);
+    srs_sp_spell_table = g_new (SRSCharSpell*, cnt + 1);
+    for (i = 0; i < cnt; i++)
+    {
+	gchar **chars;
+	chars = g_strsplit (tokens[i], ":", -1);
+	g_assert (chars[0] && chars[1] && chars[2] && !chars[3]);
+	srs_sp_spell_table[i] = g_new (SRSCharSpell, 1);
+	srs_sp_spell_table[i]->ch = g_utf8_get_char (chars[0]);
+	srs_sp_spell_table[i]->cbc = g_strdup (chars[1]);
+	srs_sp_spell_table[i]->military = g_strdup (chars[2]);
+	g_strfreev (chars);
+    }
+    srs_sp_spell_table[cnt] = NULL;
+}
+
+static void
+srs_terminate_spell_table ()
+{
+    gint i;
+
+    for (i = 0; srs_sp_spell_table[i]; i++)
     {
-	/* To translators: This is the military phonetic alphabet */
-	/* Be sure to remove "Phonetic|" from each string */
-	{'a',	"a",		N_("Phonetic|Alpha")	},
-	{'b',	"b",		N_("Phonetic|Bravo")	},
-	{'c',	"c",		N_("Phonetic|Charlie")	},
-	{'d',	"d",		N_("Phonetic|Delta")	},
-	{'e',	"e",		N_("Phonetic|Echo")	},
-	{'f',	"f",		N_("Phonetic|Foxtrot")	},
-	{'g',	"g",		N_("Phonetic|Golf")	},
-	{'h',	"h",		N_("Phonetic|Hotel")	},
-	{'i',	"i",		N_("Phonetic|India")	},
-	{'j',	"j",		N_("Phonetic|Juliet")	},
-	{'k',	"k",		N_("Phonetic|Kilo")	},
-	{'l',	"l",		N_("Phonetic|Lima")	},
-	{'m',	"m",		N_("Phonetic|Mike")	},
-	{'n',	"n",		N_("Phonetic|November")	},
-	{'o',	"o",		N_("Phonetic|Oscar")	},
-	{'p',	"p",		N_("Phonetic|Papa")	},
-	{'q',	"q",		N_("Phonetic|Quebec")	},
-	{'r',	"r",		N_("Phonetic|Romeo")	},
-	{'s',	"s",		N_("Phonetic|Sierra")	},
-	{'t',	"t",		N_("Phonetic|Tango")	},
-	{'u',	"u",		N_("Phonetic|Uniform")	},
-	{'v',	"v",		N_("Phonetic|Victor")	},
-	{'w',	"w",		N_("Phonetic|Whiskey")	},
-	{'x',	"x",		N_("Phonetic|Xray")	},
-	{'y',	"y",		N_("Phonetic|Yankee")	},
-	{'z',	"z",		N_("Phonetic|Zulu")	},
-	{' ',	N_("space"),	N_("space")	},
-	{'\t',	N_("tab"),	N_("tab")	},
-	{'\n',	N_("new line"),	N_("new line")	},
-	{'-',	N_("dash"),	N_("dash")	}
-    };
+	g_free (srs_sp_spell_table[i]->cbc);
+	g_free (srs_sp_spell_table[i]->military);
+	g_free (srs_sp_spell_table[i]);
+    }
+    g_free (srs_sp_spell_table);
+}
 
 static gint
 srs_sp_letter_get_index_for_spell (gunichar letter)
@@ -341,8 +350,8 @@
     sru_assert (g_unichar_validate (letter));
 
     letterl = g_unichar_tolower (letter);
-    for (i = 0; i < G_N_ELEMENTS (srs_sp_spell_table); i++)
-	if (letterl == srs_sp_spell_table[i].ch)
+    for (i = 0; srs_sp_spell_table[i]; i++)
+	if (letterl == srs_sp_spell_table[i]->ch)
 	    return i;
 
     return -1;
@@ -387,8 +396,8 @@
 	    if (index >= 0)
 		g_string_append (text,
 			    tout->spelling == SRS_SPELLING_CHAR ? 
-				    _(srs_sp_spell_table[index].cbc) : 
-				    Q_(srs_sp_spell_table[index].military));
+				    _(srs_sp_spell_table[index]->cbc) : 
+				    Q_(srs_sp_spell_table[index]->military));
 	    else
 		g_string_append_unichar (text, letter);
 	    srs_gs_speaker_say (voice->speaker, text->str, tout, i);
@@ -580,6 +589,8 @@
     srs_voices = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
 			(GDestroyNotify)srs_voice_terminate);
 
+    srs_init_spell_table (_("a:a:Alpha|b:b:Bravo|c:c:Charlie|d:d:Delta|e:e:Echo|f:f:Foxtrot|g:g:Golf|h:h:Hotel|i:i:India|j:j:Juliet|k:k:Kilo|l:l:Lima|m:m:Mike|n:n:November|o:o:Oscar|p:p:Papa|q:q:Quebec|r:r:Romeo|s:s:Sierra|t:t:Tango|u:u:Uniform|v:v:Victor|w:w:Whiskey|x:x:Xray|y:y:Yankee|z:z:Zulu| :space:space|\t:tab:tab|\n:new line:new line|-:dash:dash"));
+
     return srs_gs_init (srs_sp_clb, reset_callback);
 }
 
@@ -595,6 +606,7 @@
     g_hash_table_destroy (srs_voices);
 
     srs_gs_terminate ();
+    srs_terminate_spell_table ();
 }
 
 #ifdef SRS_NO_MARKERS_SUPPORTED
