aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/mozilla-embed-single.cpp
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 /embed/mozilla/mozilla-embed-single.cpp
parenta991c432844c98ff65cca9765f5e8e3cf25d19b3 (diff)
downloadgsoc2013-epiphany-3f91d766156e07b491c27bc447fb7800cc7b4cdd.tar
gsoc2013-epiphany-3f91d766156e07b491c27bc447fb7800cc7b4cdd.tar.gz
gsoc2013-epiphany-3f91d766156e07b491c27bc447fb7800cc7b4cdd.tar.bz2
gsoc2013-epiphany-3f91d766156e07b491c27bc447fb7800cc7b4cdd.tar.lz
gsoc2013-epiphany-3f91d766156e07b491c27bc447fb7800cc7b4cdd.tar.xz
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.
Diffstat (limited to 'embed/mozilla/mozilla-embed-single.cpp')
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp178
1 files changed, 166 insertions, 12 deletions
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 */
}
}