aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-05-27 05:13:03 +0800
committerChristian Persch <chpe@src.gnome.org>2003-05-27 05:13:03 +0800
commit3f91d766156e07b491c27bc447fb7800cc7b4cdd (patch)
treec6fd21b549d42d2d420bf0f2980a751236d7c990
parenta991c432844c98ff65cca9765f5e8e3cf25d19b3 (diff)
downloadgsoc2013-epiphany-3f91d766156e07b491c27bc447fb7800cc7b4cdd.tar.gz
gsoc2013-epiphany-3f91d766156e07b491c27bc447fb7800cc7b4cdd.tar.zst
gsoc2013-epiphany-3f91d766156e07b491c27bc447fb7800cc7b4cdd.zip
Refactored the charset and language groups strings.
2003-05-26 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/mozilla-i18n.h: * embed/mozilla/mozilla-i18n.c: * embed/mozilla/mozilla-embed-single.c: (fill_charsets_list), (impl_get_charset_titles): * embed/mozilla/mozilla-notifiers.c: (mozilla_notifiers_init): * lib/ephy-langs.h: * src/prefs-dialog.c: (setup_font_menu): Refactored the charset and language groups strings.
-rw-r--r--ChangeLog12
-rw-r--r--embed/mozilla/Makefile.am2
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp178
-rw-r--r--embed/mozilla/mozilla-i18n.c162
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp11
-rw-r--r--lib/Makefile.am1
-rw-r--r--lib/ephy-langs.h (renamed from embed/mozilla/mozilla-i18n.h)59
-rw-r--r--src/prefs-dialog.c31
8 files changed, 214 insertions, 242 deletions
diff --git a/ChangeLog b/ChangeLog
index 94bfdf731..42d895d2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2003-05-26 Christian Persch <chpe@cvs.gnome.org>
+* embed/mozilla/mozilla-i18n.h:
+* embed/mozilla/mozilla-i18n.c:
+* embed/mozilla/mozilla-embed-single.c: (fill_charsets_list),
+(impl_get_charset_titles):
+* embed/mozilla/mozilla-notifiers.c: (mozilla_notifiers_init):
+* lib/ephy-langs.h:
+* src/prefs-dialog.c: (setup_font_menu):
+
+Refactored the charset and language groups strings.
+
+2003-05-26 Christian Persch <chpe@cvs.gnome.org>
+
* src/prefs-dialog.c: (free_lang_item), (prefs_dialog_finalize),
(compare_lang_items), (find_lang_code), (create_languages_list),
(general_prefs_new_language_menu), (language_menu_changed_cb),
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index a2cc20c5f..59eba1291 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -95,8 +95,6 @@ libephymozillaembed_la_SOURCES = \
mozilla-embed-persist.h \
mozilla-embed-single.cpp \
mozilla-embed-single.h \
- mozilla-i18n.c \
- mozilla-i18n.h \
mozilla-notifiers.cpp \
mozilla-notifiers.h \
nsUnicharUtils.cpp \
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index 9e6e664c7..c0db1d3c5 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -16,6 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "glib.h"
#include "ephy-string.h"
#include "ephy-debug.h"
@@ -24,7 +28,7 @@
#include "ephy-prefs.h"
#include "ephy-file-helpers.h"
#include "mozilla-notifiers.h"
-#include "mozilla-i18n.h"
+#include "ephy-langs.h"
#include "eel-gconf-extensions.h"
#include "ephy-embed-prefs.h"
#include "MozRegisterComponents.h"
@@ -58,6 +62,147 @@
#define MOZILLA_PROFILE_NAME "epiphany"
#define MOZILLA_PROFILE_FILE "prefs.js"
+/* language groups */
+typedef enum
+{
+ LG_ARABIC,
+ LG_BALTIC,
+ LG_CENTRAL_EUROPEAN,
+ LG_CHINESE,
+ LG_CYRILLIC,
+ LG_GREEK,
+ LG_HEBREW,
+ LG_INDIAN,
+ LG_JAPANESE,
+ LG_KOREAN,
+ LG_TURKISH,
+ LG_UNICODE,
+ LG_VIETNAMESE,
+ LG_WESTERN,
+ LG_OTHER,
+} LanguageGroup;
+
+/* language groups names */
+static const gchar *lgroups[] =
+{
+ N_("Arabic"),
+ N_("Baltic"),
+ N_("Central European"),
+ N_("Chinese"),
+ N_("Cyrillic"),
+ N_("Greek"),
+ N_("Hebrew"),
+ N_("Indian"),
+ N_("Japanese"),
+ N_("Korean"),
+ N_("Turkish"),
+ N_("Unicode"),
+ N_("Vietnamese"),
+ N_("Western"),
+ N_("Other")
+};
+static const guint n_lgroups = G_N_ELEMENTS (lgroups);
+
+/* translated charset titles */
+static const
+struct
+{
+ gchar *charset_title;
+ gchar *charset_name;
+ LanguageGroup lgroup;
+}
+charset_trans_array[] =
+{
+ { N_("Arabic (IBM-864)"), "IBM864", LG_ARABIC },
+ { N_("Arabic (IBM-864-I)"), "IBM864i", LG_ARABIC },
+ { N_("Arabic (ISO-8859-6)"), "ISO-8859-6", LG_ARABIC },
+ { N_("Arabic (ISO-8859-6-E)"), "ISO-8859-6-E", LG_ARABIC },
+ { N_("Arabic (ISO-8859-6-I)"), "ISO-8859-6-I", LG_ARABIC },
+ { N_("Arabic (MacArabic)"), "x-mac-arabic", LG_ARABIC },
+ { N_("Arabic (Windows-1256)"), "windows-1256", LG_ARABIC },
+ { N_("Armenian (ARMSCII-8)"), "armscii-8", LG_OTHER },
+ { N_("Baltic (ISO-8859-13)"), "ISO-8859-13", LG_BALTIC },
+ { N_("Baltic (ISO-8859-4)"), "ISO-8859-4", LG_BALTIC },
+ { N_("Baltic (Windows-1257)"), "windows-1257", LG_BALTIC },
+ { N_("Celtic (ISO-8859-14)"), "ISO-8859-14", LG_OTHER },
+ { N_("Central European (IBM-852)"), "IBM852", LG_CENTRAL_EUROPEAN },
+ { N_("Central European (ISO-8859-2)"), "ISO-8859-2", LG_CENTRAL_EUROPEAN },
+ { N_("Central European (MacCE)"), "x-mac-ce", LG_CENTRAL_EUROPEAN },
+ { N_("Central European (Windows-1250)"), "windows-1250", LG_CENTRAL_EUROPEAN },
+ { N_("Chinese Simplified (GB18030)"), "gb18030", LG_CHINESE },
+ { N_("Chinese Simplified (GB2312)"), "GB2312", LG_CHINESE },
+ { N_("Chinese Simplified (GBK)"), "x-gbk", LG_CHINESE },
+ { N_("Chinese Simplified (HZ)"), "HZ-GB-2312", LG_CHINESE },
+ { N_("Chinese Simplified (ISO-2022-CN)"), "ISO-2022-CN", LG_CHINESE },
+ { N_("Chinese Simplified (Windows-936)"), "windows-936", LG_CHINESE },
+ { N_("Chinese Traditional (Big5)"), "Big5", LG_CHINESE },
+ { N_("Chinese Traditional (Big5-HKSCS)"), "Big5-HKSCS", LG_CHINESE },
+ { N_("Chinese Traditional (EUC-TW)"), "x-euc-tw", LG_CHINESE },
+ { N_("Croatian (MacCroatian)"), "x-mac-croatian", LG_CENTRAL_EUROPEAN },
+ { N_("Cyrillic (IBM-855)"), "IBM855", LG_CYRILLIC },
+ { N_("Cyrillic (ISO-8859-5)"), "ISO-8859-5", LG_CYRILLIC },
+ { N_("Cyrillic (ISO-IR-111)"), "ISO-IR-111", LG_CYRILLIC },
+ { N_("Cyrillic (KOI8-R)"), "KOI8-R", LG_CYRILLIC },
+ { N_("Cyrillic (MacCyrillic)"), "x-mac-cyrillic", LG_CYRILLIC },
+ { N_("Cyrillic (Windows-1251)"), "windows-1251", LG_CYRILLIC },
+ { N_("Cyrillic/Russian (CP-866)"), "IBM866", LG_CYRILLIC },
+ { N_("Cyrillic/Ukrainian (KOI8-U)"), "KOI8-U", LG_CYRILLIC },
+ { N_("Cyrillic/Ukrainian (MacUkrainian)"), "x-mac-ukrainian", LG_CYRILLIC },
+ { N_("English (US-ASCII)"), "us-ascii", LG_WESTERN },
+ { N_("Farsi (MacFarsi)"), "x-mac-farsi", LG_OTHER },
+ { N_("Georgian (GEOSTD8)"), "geostd8", LG_OTHER },
+ { N_("Greek (ISO-8859-7)"), "ISO-8859-7", LG_GREEK },
+ { N_("Greek (MacGreek)"), "x-mac-greek", LG_GREEK },
+ { N_("Greek (Windows-1253)"), "windows-1253", LG_GREEK },
+ { N_("Gujarati (MacGujarati)"), "x-mac-gujarati", LG_INDIAN },
+ { N_("Gurmukhi (MacGurmukhi)"), "x-mac-gurmukhi", LG_INDIAN },
+ { N_("Hebrew (IBM-862)"), "IBM862", LG_HEBREW },
+ { N_("Hebrew (ISO-8859-8-E)"), "ISO-8859-8-E", LG_HEBREW },
+ { N_("Hebrew (ISO-8859-8-I)"), "ISO-8859-8-I", LG_HEBREW },
+ { N_("Hebrew (MacHebrew)"), "x-mac-hebrew", LG_HEBREW },
+ { N_("Hebrew (Windows-1255)"), "windows-1255", LG_HEBREW },
+ { N_("Hindi (MacDevanagari)"), "x-mac-devanagari", LG_INDIAN },
+ { N_("Icelandic (MacIcelandic)"), "x-mac-icelandic", LG_OTHER },
+ { N_("Japanese (EUC-JP)"), "EUC-JP", LG_JAPANESE },
+ { N_("Japanese (ISO-2022-JP)"), "ISO-2022-JP", LG_JAPANESE },
+ { N_("Japanese (Shift_JIS)"), "Shift_JIS", LG_JAPANESE },
+ { N_("Korean (EUC-KR)"), "EUC-KR", LG_KOREAN },
+ { N_("Korean (ISO-2022-KR)"), "ISO-2022-KR", LG_KOREAN },
+ { N_("Korean (JOHAB)"), "x-johab", LG_KOREAN },
+ { N_("Korean (UHC)"), "x-windows-949", LG_KOREAN },
+ { N_("Nordic (ISO-8859-10)"), "ISO-8859-10", LG_OTHER },
+ { N_("Romanian (MacRomanian)"), "x-mac-romanian", LG_OTHER },
+ { N_("Romanian (ISO-8859-16)"), "ISO-8859-16", LG_OTHER },
+ { N_("South European (ISO-8859-3)"), "ISO-8859-3", LG_OTHER },
+ { N_("Thai (TIS-620)"), "TIS-620", LG_OTHER },
+ { N_("Turkish (IBM-857)"), "IBM857", LG_TURKISH },
+ { N_("Turkish (ISO-8859-9)"), "ISO-8859-9", LG_TURKISH },
+ { N_("Turkish (MacTurkish)"), "x-mac-turkish", LG_TURKISH },
+ { N_("Turkish (Windows-1254)"), "windows-1254", LG_TURKISH },
+ { N_("Unicode (UTF-7)"), "UTF-7", LG_UNICODE },
+ { N_("Unicode (UTF-8)"), "UTF-8", LG_UNICODE },
+ { N_("Unicode (UTF-16BE)"), "UTF-16BE", LG_UNICODE },
+ { N_("Unicode (UTF-16LE)"), "UTF-16LE", LG_UNICODE },
+ { N_("Unicode (UTF-32BE)"), "UTF-32BE", LG_UNICODE },
+ { N_("Unicode (UTF-32LE)"), "UTF-32LE", LG_UNICODE },
+ { N_("User Defined"), "x-user-defined", LG_OTHER },
+ { N_("Vietnamese (TCVN)"), "x-viet-tcvn5712", LG_VIETNAMESE },
+ { N_("Vietnamese (VISCII)"), "VISCII", LG_VIETNAMESE },
+ { N_("Vietnamese (VPS)"), "x-viet-vps", LG_VIETNAMESE },
+ { N_("Vietnamese (Windows-1258)"), "windows-1258", LG_VIETNAMESE },
+ { N_("Visual Hebrew (ISO-8859-8)"), "ISO-8859-8", LG_HEBREW },
+ { N_("Western (IBM-850)"), "IBM850", LG_WESTERN },
+ { N_("Western (ISO-8859-1)"), "ISO-8859-1", LG_WESTERN },
+ { N_("Western (ISO-8859-15)"), "ISO-8859-15", LG_WESTERN },
+ { N_("Western (MacRoman)"), "x-mac-roman", LG_WESTERN },
+ { N_("Western (Windows-1252)"), "windows-1252", LG_WESTERN },
+ /* charsets whithout posibly translatable names */
+ { "T.61-8bit", "T.61-8bit", LG_OTHER },
+ { "x-imap4-modified-utf7", "x-imap4-modified-utf7", LG_UNICODE },
+ { "x-u-escaped", "x-u-escaped", LG_OTHER }
+};
+static const guint n_charset_trans_array = G_N_ELEMENTS (charset_trans_array);
+
static void
mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass);
static void
@@ -483,7 +628,6 @@ fill_charsets_lists (MozillaEmbedSinglePrivate *priv)
nsresult rv;
char *tmp;
PRUint32 cscount;
- PRUint32 translated_cscount = get_translated_cscount ();
char *charset_str, *charset_title_str;
nsCOMPtr<nsIAtom> docCharsetAtom;
@@ -521,17 +665,20 @@ fill_charsets_lists (MozillaEmbedSinglePrivate *priv)
if (tmp == NULL ||
strlen (tmp) == 0)
{
- if (tmp) nsMemory::Free (tmp);
charset_title_str = g_strdup (charset_str);
}
else
{
charset_title_str = g_strdup (tmp);
- nsMemory::Free (tmp);
- tmp = nsnull;
}
- for (PRUint32 j = 0; j < translated_cscount; j++)
+ if (tmp) nsMemory::Free (tmp);
+ tmp = nsnull;
+
+#ifdef GNOME_ENABLE_DEBUG
+ gboolean found = FALSE;
+#endif
+ for (PRUint32 j = 0; j < n_charset_trans_array; j++)
{
if (g_ascii_strcasecmp (
charset_str,
@@ -540,10 +687,21 @@ fill_charsets_lists (MozillaEmbedSinglePrivate *priv)
g_free (charset_title_str);
charset_title_str = (char *)
_(charset_trans_array[j].charset_title);
+#ifdef GNOME_ENABLE_DEBUG
+ found = TRUE;
+#endif
break;
}
}
+#ifdef GNOME_ENABLE_DEBUG
+ if (found == FALSE)
+ {
+ g_warning ("Charset %s with title %s not in list!",
+ charset_str, charset_title_str);
+ }
+#endif
+
/* fill the hash and the sorted list */
g_hash_table_insert (priv->charsets_hash, charset_title_str, charset_str);
priv->sorted_charsets_titles =
@@ -570,14 +728,13 @@ impl_get_charset_titles (EphyEmbedSingle *shell,
GList **charsets)
{
MozillaEmbedSingle *mshell = MOZILLA_EMBED_SINGLE(shell);
- int count = get_translated_cscount ();
GList *l = NULL;
- int j;
+ guint j;
ensure_charsets_tables (mshell);
g_return_val_if_fail (mshell->priv->charsets_hash != NULL, G_FAILED);
- for (j = 0; j < count; j++)
+ for (j = 0; j < n_charset_trans_array; j++)
{
if (group == NULL ||
strcmp (group, lgroups[charset_trans_array[j].lgroup]) == 0)
@@ -587,9 +744,6 @@ impl_get_charset_titles (EphyEmbedSingle *shell,
info->name = charset_trans_array[j].charset_name;
info->title = charset_trans_array[j].charset_title;
l = g_list_append (l, info);
-
- /* FIXME check that the encoding exists in mozilla before
- * adding it */
}
}
diff --git a/embed/mozilla/mozilla-i18n.c b/embed/mozilla/mozilla-i18n.c
deleted file mode 100644
index ce0a5b4ef..000000000
--- a/embed/mozilla/mozilla-i18n.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2000 Marco Pesenti Gritti
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "mozilla-i18n.h"
-
-#include <bonobo/bonobo-i18n.h>
-
-const char *lgroups[] = {
- N_("Arabic"),
- N_("Baltic"),
- N_("Central European"),
- N_("Chinese"),
- N_("Cyrillic"),
- N_("Greek"),
- N_("Hebrew"),
- N_("Indian"),
- N_("Japanese"),
- N_("Korean"),
- N_("Turkish"),
- N_("Unicode"),
- N_("Vietnamese"),
- N_("Western"),
- N_("Other"),
- NULL
-};
-
-const CharsetInfoPriv charset_trans_array[] = {
- {N_("Arabic (IBM-864)"), "IBM864", LG_ARABIC},
- {N_("Arabic (IBM-864-I)"), "IBM864i", LG_ARABIC},
- {N_("Arabic (ISO-8859-6)"), "ISO-8859-6", LG_ARABIC},
- {N_("Arabic (ISO-8859-6-E)"), "ISO-8859-6-E", LG_ARABIC},
- {N_("Arabic (ISO-8859-6-I)"), "ISO-8859-6-I", LG_ARABIC},
- {N_("Arabic (MacArabic)"), "x-mac-arabic", LG_ARABIC},
- {N_("Arabic (Windows-1256)"), "windows-1256", LG_ARABIC},
- {N_("Armenian (ARMSCII-8)"), "armscii-8", LG_OTHER},
- {N_("Baltic (ISO-8859-13)"), "ISO-8859-13", LG_BALTIC},
- {N_("Baltic (ISO-8859-4)"), "ISO-8859-4", LG_BALTIC},
- {N_("Baltic (Windows-1257)"), "windows-1257", LG_BALTIC},
- {N_("Celtic (ISO-8859-14)"), "ISO-8859-14", LG_OTHER},
- {N_("Central European (IBM-852)"), "IBM852", LG_CENTRAL_EUROPEAN},
- {N_("Central European (ISO-8859-2)"), "ISO-8859-2", LG_CENTRAL_EUROPEAN},
- {N_("Central European (MacCE)"), "x-mac-ce", LG_CENTRAL_EUROPEAN},
- {N_("Central European (Windows-1250)"), "windows-1250", LG_CENTRAL_EUROPEAN},
- {N_("Chinese Simplified (GB18030)"), "gb18030", LG_CHINESE},
- {N_("Chinese Simplified (GB2312)"), "GB2312", LG_CHINESE},
- {N_("Chinese Simplified (GBK)"), "x-gbk", LG_CHINESE},
- {N_("Chinese Simplified (HZ)"), "HZ-GB-2312", LG_CHINESE},
- {N_("Chinese Simplified (Windows-936)"), "windows-936", LG_CHINESE},
- {N_("Chinese Traditional (Big5)"), "Big5", LG_CHINESE},
- {N_("Chinese Traditional (Big5-HKSCS)"), "Big5-HKSCS", LG_CHINESE},
- {N_("Chinese Traditional (EUC-TW)"), "x-euc-tw", LG_CHINESE},
- {N_("Croatian (MacCroatian)"), "x-mac-croatian", LG_CENTRAL_EUROPEAN},
- {N_("Cyrillic (IBM-855)"), "IBM855", LG_CYRILLIC},
- {N_("Cyrillic (ISO-8859-5)"), "ISO-8859-5", LG_CYRILLIC},
- {N_("Cyrillic (ISO-IR-111)"), "ISO-IR-111", LG_CYRILLIC},
- {N_("Cyrillic (KOI8-R)"), "KOI8-R", LG_CYRILLIC},
- {N_("Cyrillic (MacCyrillic)"), "x-mac-cyrillic", LG_CYRILLIC},
- {N_("Cyrillic (Windows-1251)"), "windows-1251", LG_CYRILLIC},
- {N_("Cyrillic/Russian (CP-866)"), "IBM866", LG_CYRILLIC},
- {N_("Cyrillic/Ukrainian (KOI8-U)"), "KOI8-U", LG_CYRILLIC},
- {N_("Cyrillic/Ukrainian (MacUkrainian)"), "x-mac-ukrainian", LG_CYRILLIC},
- {N_("English (US-ASCII)"), "us-ascii", LG_WESTERN},
- {N_("Farsi (MacFarsi)"), "x-mac-farsi", LG_OTHER},
- {N_("Georgian (GEOSTD8)"), "geostd8", LG_OTHER},
- {N_("Greek (ISO-8859-7)"), "ISO-8859-7", LG_GREEK},
- {N_("Greek (MacGreek)"), "x-mac-greek", LG_GREEK},
- {N_("Greek (Windows-1253)"), "windows-1253", LG_GREEK},
- {N_("Gujarati (MacGujarati)"), "x-mac-gujarati", LG_INDIAN},
- {N_("Gurmukhi (MacGurmukhi)"), "x-mac-gurmukhi", LG_INDIAN},
- {N_("Hebrew (IBM-862)"), "IBM862", LG_HEBREW},
- {N_("Hebrew (ISO-8859-8-E)"), "ISO-8859-8-E", LG_HEBREW},
- {N_("Hebrew (ISO-8859-8-I)"), "ISO-8859-8-I", LG_HEBREW},
- {N_("Hebrew (MacHebrew)"), "x-mac-hebrew", LG_HEBREW},
- {N_("Hebrew (Windows-1255)"), "windows-1255", LG_HEBREW},
- {N_("Hindi (MacDevanagari)"), "x-mac-devanagari", LG_INDIAN},
- {N_("Icelandic (MacIcelandic)"), "x-mac-icelandic", LG_OTHER},
- {N_("Japanese (EUC-JP)"), "EUC-JP", LG_JAPANESE},
- {N_("Japanese (ISO-2022-JP)"), "ISO-2022-JP", LG_JAPANESE},
- {N_("Japanese (Shift_JIS)"), "Shift_JIS", LG_JAPANESE},
- {N_("Korean (EUC-KR)"), "EUC-KR", LG_KOREAN},
- {N_("Korean (ISO-2022-KR)"), "ISO-2022-KR", LG_KOREAN},
- {N_("Korean (JOHAB)"), "x-johab", LG_KOREAN},
- {N_("Korean (UHC)"), "x-windows-949", LG_KOREAN},
- {N_("Nordic (ISO-8859-10)"), "ISO-8859-10", LG_OTHER},
- {N_("Romanian (MacRomanian)"), "x-mac-romanian", LG_OTHER},
- {N_("Romanian (ISO-8859-16)"), "ISO-8859-16", LG_OTHER},
- {N_("South European (ISO-8859-3)"), "ISO-8859-3", LG_OTHER},
- {N_("Thai (TIS-620)"), "TIS-620", LG_OTHER},
- {N_("Turkish (IBM-857)"), "IBM857", LG_TURKISH},
- {N_("Turkish (ISO-8859-9)"), "ISO-8859-9", LG_TURKISH},
- {N_("Turkish (MacTurkish)"), "x-mac-turkish", LG_TURKISH},
- {N_("Turkish (Windows-1254)"), "windows-1254", LG_TURKISH},
- {N_("Unicode (UTF-7)"), "UTF-7", LG_UNICODE},
- {N_("Unicode (UTF-8)"), "UTF-8", LG_UNICODE},
- {N_("Unicode (UTF-16BE)"), "UTF-16BE", LG_UNICODE},
- {N_("Unicode (UTF-16LE)"), "UTF-16LE", LG_UNICODE},
- {N_("Unicode (UTF-32BE)"), "UTF-32BE", LG_UNICODE},
- {N_("Unicode (UTF-32LE)"), "UTF-32LE", LG_UNICODE},
- {N_("User Defined"), "x-user-defined", LG_OTHER},
- {N_("Vietnamese (TCVN)"), "x-viet-tcvn5712", LG_VIETNAMESE},
- {N_("Vietnamese (VISCII)"), "VISCII", LG_VIETNAMESE},
- {N_("Vietnamese (VPS)"), "x-viet-vps", LG_VIETNAMESE},
- {N_("Vietnamese (Windows-1258)"), "windows-1258", LG_VIETNAMESE},
- {N_("Visual Hebrew (ISO-8859-8)"), "ISO-8859-8", LG_HEBREW},
- {N_("Western (IBM-850)"), "IBM850", LG_WESTERN},
- {N_("Western (ISO-8859-1)"), "ISO-8859-1", LG_WESTERN},
- {N_("Western (ISO-8859-15)"), "ISO-8859-15", LG_WESTERN},
- {N_("Western (MacRoman)"), "x-mac-roman", LG_WESTERN},
- {N_("Western (Windows-1252)"), "windows-1252", LG_WESTERN},
- /* charsets whithout posibly translatable names */
- {"T61.8bit", "T61.8bit", LG_OTHER},
- {"x-imap4-modified-utf7", "x-imap4-modified-utf7", LG_UNICODE},
- {"x-u-escaped", "x-u-escaped", LG_OTHER}
-};
-
-const gchar *lang_encode_item[LANG_ENC_NUM] =
-{
- "x-western",
- "x-central-euro",
- "ja",
- "zh-TW",
- "zh-CN",
- "ko",
- "x-cyrillic",
- "x-baltic",
- "el",
- "tr",
- "x-unicode",
- "th",
- "he",
- "ar"
-};
-
-const gchar *font_types[] =
-{
- "serif",
- "sans-serif",
- "cursive",
- "fantasy",
- "monospace"
-};
-
-extern gint
-get_translated_cscount(void)
-{
- return sizeof (charset_trans_array) / sizeof ((charset_trans_array)[0]);
-}
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
index a85620e0b..1f05f5abd 100644
--- a/embed/mozilla/mozilla-notifiers.cpp
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -27,7 +27,8 @@
#include "MozRegisterComponents.h"
#include "ephy-prefs.h"
#include "ephy-embed-prefs.h"
-#include "mozilla-i18n.h"
+#include "ephy-langs.h"
+#include "ephy-debug.h"
#include <stdio.h>
#include <string.h>
@@ -348,7 +349,7 @@ void
mozilla_notifiers_init(EphyEmbedSingle *single)
{
GConfClient *client = eel_gconf_client_get_global ();
- int i;
+ guint i;
for (i = 0; conversion_table[i].gconf_key != NULL; i++)
{
@@ -386,14 +387,14 @@ mozilla_notifiers_init(EphyEmbedSingle *single)
}
/* fonts notifiers */
- for (i = 0; i < LANG_ENC_NUM; i++)
+ for (i = 0; i < n_lang_encode_items; i++)
{
- int k;
+ guint k;
char *types [] = { "serif", "sans-serif", "cursive", "fantasy", "monospace" };
char key[255];
char *info;
- for (k = 0; k < 5; k++)
+ for (k = 0; k < G_N_ELEMENTS (types); k++)
{
info = g_strconcat (types[k], ".", lang_encode_item[i], NULL);
diff --git a/lib/Makefile.am b/lib/Makefile.am
index f043b19fa..a4769da1a 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -34,6 +34,7 @@ libephy_la_SOURCES = \
ephy-gobject-misc.h \
ephy-gui.c \
ephy-gui.h \
+ ephy-langs.h \
ephy-marshal.c \
ephy-marshal.h \
ephy-node.c \
diff --git a/embed/mozilla/mozilla-i18n.h b/lib/ephy-langs.h
index 5b5dbc321..38df4fecf 100644
--- a/embed/mozilla/mozilla-i18n.h
+++ b/lib/ephy-langs.h
@@ -16,45 +16,32 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <glib.h>
G_BEGIN_DECLS
-#define LANG_ENC_NUM 14
-
-typedef enum {
- LG_ARABIC,
- LG_BALTIC,
- LG_CENTRAL_EUROPEAN,
- LG_CHINESE,
- LG_CYRILLIC,
- LG_GREEK,
- LG_HEBREW,
- LG_INDIAN,
- LG_JAPANESE,
- LG_KOREAN,
- LG_TURKISH,
- LG_UNICODE,
- LG_VIETNAMESE,
- LG_WESTERN,
- LG_OTHER
-} LanguageGroup;
-
-typedef struct {
- char *charset_title;
- char *charset_name;
- LanguageGroup lgroup;
-} CharsetInfoPriv;
-
-/* language groups names */
-extern const char *lgroups[];
-/* translated charset titles */
-extern const CharsetInfoPriv charset_trans_array[];
-
-/* FIXME */
-extern const char *lang_encode_name[LANG_ENC_NUM];
-extern const char *lang_encode_item[LANG_ENC_NUM];
-
-gint get_translated_cscount (void);
+/* language encoding groups */
+static const gchar *lang_encode_item[] =
+{
+ "x-western",
+ "x-central-euro",
+ "ja",
+ "zh-TW",
+ "zh-CN",
+ "ko",
+ "x-cyrillic",
+ "x-baltic",
+ "el",
+ "tr",
+ "x-unicode",
+ "th",
+ "he",
+ "ar"
+};
+static const guint n_lang_encode_items = G_N_ELEMENTS (lang_encode_item);
G_END_DECLS
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 3ae29f0e5..8e7793d16 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -28,6 +28,7 @@
#include "ephy-gui.h"
#include "eel-gconf-extensions.h"
#include "language-editor.h"
+#include "ephy-langs.h"
#include <bonobo/bonobo-i18n.h>
#include <gtk/gtkframe.h>
@@ -71,26 +72,6 @@ void
prefs_language_more_button_clicked_cb (GtkWidget *button,
EphyDialog *dialog);
-/* FIXME duped in mozilla/ */
-const
-char *lang_encode[] =
-{
- "x-western",
- "x-central-euro",
- "ja",
- "zh-TW",
- "zh-CN",
- "ko",
- "x-cyrillic",
- "x-baltic",
- "el",
- "tr",
- "x-unicode",
- "th",
- "he",
- "ar"
-};
-
static const
struct
{
@@ -399,12 +380,12 @@ setup_font_menu (PrefsDialog *dialog,
(EPHY_EMBED_SHELL (ephy_shell));
ephy_embed_single_get_font_list (single,
- lang_encode[dialog->priv->language],
+ lang_encode_item[dialog->priv->language],
type, &fonts, &default_font);
/* Get the default font */
sprintf (key, "%s_%s_%s", CONF_RENDERING_FONT, type,
- lang_encode[dialog->priv->language]);
+ lang_encode_item[dialog->priv->language]);
name = eel_gconf_get_string (key);
if (name == NULL)
{
@@ -454,7 +435,7 @@ save_font_menu (PrefsDialog *dialog,
sprintf (key, "%s_%s_%s", CONF_RENDERING_FONT,
fonts_types[type],
- lang_encode[dialog->priv->language]);
+ lang_encode_item[dialog->priv->language]);
eel_gconf_set_string (key, name);
g_free (name);
}
@@ -510,7 +491,7 @@ size_spinbutton_changed_cb (GtkWidget *spin, PrefsDialog *dialog)
sprintf (key, "%s_%s",
size_prefs[type],
- lang_encode[dialog->priv->language]);
+ lang_encode_item[dialog->priv->language]);
eel_gconf_set_integer (key, gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin)));
}
@@ -554,7 +535,7 @@ setup_size_control (PrefsDialog *dialog,
int size;
sprintf (key, "%s_%s", pref,
- lang_encode[dialog->priv->language]);
+ lang_encode_item[dialog->priv->language]);
size = eel_gconf_get_integer (key);
if (size == 0) size = default_size;