Commit 4a05d9a8 authored by Ross Golder's avatar Ross Golder

Various patches based on the patches from Vital Khilko in bug #57102.

parent 5c9ca29b
2006-01-15 Ross Golder <ross@golder.org>
* data/pixmaps/*.png: Various new pixmaps provided by Vital
Kilkho (#57102) for new preferences dialog..
* data/pixmaps/Makefile.am: Changes for above.
2005-09-10 Erdal Ronahi <erdal.ronahi@gmail.com>
* po/ku.po: Added Kurdish translation
......
......@@ -4,8 +4,25 @@
pixmaps_dir = $(datadir)/pixmaps/gtranslator
pixmaps__DATA = \
about_me.png \
auto.png \
autotrans.png \
comment.png \
content.png \
copy_2_tran.png \
files.png \
func.png \
fuzzy.png \
fuzzy_small.png \
header.png \
language.png \
plural.png \
plural_small.png \
recent.png \
table.png \
text.png \
translated.png \
translated_small.png \
untranslated.png \
untranslated_small.png
......
data/pixmaps/fuzzy.png

1.21 KB | W: | H:

data/pixmaps/fuzzy.png

825 Bytes | W: | H:

data/pixmaps/fuzzy.png
data/pixmaps/fuzzy.png
data/pixmaps/fuzzy.png
data/pixmaps/fuzzy.png
  • 2-up
  • Swipe
  • Onion skin
data/pixmaps/fuzzy_small.png

766 Bytes | W: | H:

data/pixmaps/fuzzy_small.png

617 Bytes | W: | H:

data/pixmaps/fuzzy_small.png
data/pixmaps/fuzzy_small.png
data/pixmaps/fuzzy_small.png
data/pixmaps/fuzzy_small.png
  • 2-up
  • Swipe
  • Onion skin
data/pixmaps/untranslated.png

1.16 KB | W: | H:

data/pixmaps/untranslated.png

763 Bytes | W: | H:

data/pixmaps/untranslated.png
data/pixmaps/untranslated.png
data/pixmaps/untranslated.png
data/pixmaps/untranslated.png
  • 2-up
  • Swipe
  • Onion skin
data/pixmaps/untranslated_small.png

738 Bytes | W: | H:

data/pixmaps/untranslated_small.png

581 Bytes | W: | H:

data/pixmaps/untranslated_small.png
data/pixmaps/untranslated_small.png
data/pixmaps/untranslated_small.png
data/pixmaps/untranslated_small.png
  • 2-up
  • Swipe
  • Onion skin
2006-01-05 Ross Golder <ross@golder.org>
* languages.c, messages-table.c, prefs.[ch], translator.c, utils.[ch]:
New treeview-based preferences dialog supplied by Vital Khilko
(#57102).
2006-01-15 Ross Golder <ross@golder.org>
* message.c, gui.c: Fixes to display the translated message
......
......@@ -56,6 +56,12 @@ typedef struct {
* 5 - The transfer bit count for the language (e.g. "8bit").
*/
gchar *bits;
/*
* 6 - plural form string;
*/
gchar *plural;
} GtrLanguage;
/*
......
......@@ -84,30 +84,10 @@ static void read_messages_table_colors()
/*
* Read the values from the prefs in -- but only if desired.
*/
if(GtrPreferences.use_own_mt_colors)
{
gchar *value;
#define set_color(key,member,defaultcolor) \
value=gtranslator_config_get_string("colors/messages_table_" key); \
if(value && value[0]=='#') { \
messages_table_colors->member=g_strdup(value); \
g_free(value); \
} \
else { \
messages_table_colors->member=g_strdup(defaultcolor); \
}
set_color("untranslated", untranslated, TABLE_UNTRANSLATED_COLOR);
set_color("translated", translated, TABLE_TRANSLATED_COLOR);
set_color("fuzzy", fuzzy, TABLE_FUZZY_COLOR);
#undef set_color
}
else
{
messages_table_colors->untranslated=g_strdup(TABLE_UNTRANSLATED_COLOR);
messages_table_colors->fuzzy=g_strdup(TABLE_FUZZY_COLOR);
messages_table_colors->translated=g_strdup(TABLE_TRANSLATED_COLOR);
}
/*
* Now parse our defined color strings into the GdkColor structs of
......
This diff is collapsed.
......@@ -48,7 +48,6 @@ struct {
guint show_messages_table : 1;
guint show_comment : 1;
guint collapse_all : 1;
guint show_plural_forms : 1;
/*
* Special options, taken by value in the prefs-box.
......@@ -60,16 +59,15 @@ struct {
guint dot_char : 1;
guint check_recent_file : 1;
guint use_own_fonts : 1;
guint use_own_colors : 1;
guint use_own_mt_colors : 1;
guint instant_spell_check : 1;
guint use_own_dict : 1;
guint keep_obsolete : 1;
guint sweep_compile_file : 1;
guint autosave : 1;
guint autosave_with_suffix : 1;
guint max_history_entries : 10;
#ifdef GTR_ABOUT_ME
guint use_about_me : 1;
#endif
guint hotkey_char;
/*
......@@ -82,11 +80,8 @@ struct {
* User-specified strings.
*/
gchar *autosave_suffix;
gchar *spell_command;
gchar *dictionary;
gchar *msgid_font;
gchar *msgstr_font;
gchar *scheme;
} GtrPreferences;
/*
......
......@@ -128,7 +128,8 @@ static GtrLanguage *gtranslator_translator_read_language()
"language/mime_type");
gtranslator_translator_read_value(&language->bits,
"language/encoding");
gtranslator_translator_read_value(&language->plural,
"language/plural_form_string");
return language;
}
......@@ -148,10 +149,25 @@ GtrTranslator *gtranslator_translator_new()
/*
* Read the translator specific values from the preferences.
*/
#ifdef GTR_ABOUT_ME
gchar *name = NULL;
gchar *email = NULL;
if(gtranslator_config_get_bool("toggles/use_about_me"))
if (gtranslator_config_about_me(&name, &email) &&
!(name == NULL || name == '\0') &&
email != NULL) {
new_translator->name = name;
new_translator->email = email;
} else {
#endif
gtranslator_translator_read_value(&new_translator->name,
"translator/name");
gtranslator_translator_read_value(&new_translator->email,
"translator/email");
#ifdef GTR_ABOUT_ME
}
#endif
gtranslator_translator_read_value(&new_translator->learn_buffer,
"translator/learn_buffer");
gtranslator_translator_read_value(&new_translator->tm_buffer,
......@@ -422,9 +438,14 @@ void gtranslator_translator_save(GtrTranslator *translator)
/*
* Save the translator's personal settings.
*/
#ifdef GTR_ABOUT_ME
if(!gtranslator_config_get_bool("toggles/use_about_me")) {
#endif
gtranslator_config_set_string("translator/name", translator->name);
gtranslator_config_set_string("translator/email", translator->email);
#ifdef GTR_ABOUT_ME
}
#endif
/*
* Save the language settings.
*/
......@@ -438,7 +459,8 @@ void gtranslator_translator_save(GtrTranslator *translator)
translator->language->encoding);
gtranslator_config_set_string("language/encoding",
translator->language->bits);
gtranslator_config_set_string("language/plural_form_string",
translator->language->plural);
/*
* Save the TM/auto translation settings.
*/
......@@ -455,7 +477,9 @@ void gtranslator_translator_free(GtrTranslator *translator)
{
if(translator)
{
if (translator->name != NULL)
g_free(translator->name);
if (translator->email != NULL)
g_free(translator->email);
g_free(translator->learn_buffer);
g_free(translator->tm_buffer);
......@@ -465,6 +489,7 @@ void gtranslator_translator_free(GtrTranslator *translator)
g_free(translator->language->encoding);
g_free(translator->language->group_email);
g_free(translator->language->bits);
g_free(translator->language->plural);
g_free(translator->language);
g_free(translator);
......
......@@ -225,7 +225,7 @@ void gtranslator_utils_set_language_values_by_language(const gchar *language)
gtranslator_config_set_string("language/mime_type", languages[i].encoding);
gtranslator_config_set_string("language/encoding", languages[i].bits);
gtranslator_config_set_string("language/plural_string", languages[i].plural);
return;
}
}
......@@ -833,3 +833,77 @@ int gtranslator_mkdir_hier(const char *path, mode_t mode)
g_free(copy);
return 0;
}
GdkPixbuf*
gtranslator_pixbuf_from_file(gchar *file)
{
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_file(file, &error);
if (error){
g_critical ("Could not load pixbuf: %s\n", error->message);
g_error_free(error);
return NULL;
}
return pixbuf;
}
gchar*
gtranslator_get_plural_form_string(gchar *lang)
{
#define BUF_SIZE 2048
gchar *cmd,
*po_test_file,
**pair,
buf[BUF_SIZE],
*plural_forms = NULL;
FILE *fs;
g_return_val_if_fail(lang!=NULL,NULL);
/*
* Check if msginit is available on the system.
*/
if(!g_find_program_in_path("msginit")) {
gtranslator_utils_error_dialog(_("Sorry, msginit isn't available on your system!"));
return NULL;
}
po_test_file = g_strconcat ("# SOME DESCRIPTIVE TITLE.\n",
"# Copyright (C) YEAR Free Software Foundation, Inc.\n",
"# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n",
"#\n",
"#, fuzzy\n",
"msgid \"\"\n",
"msgstr \"\"\n",
"\"Project-Id-Version: PACKAGE VERSION\\n\"\n",
"\"POT-Creation-Date: 2002-06-25 03:23+0200\\n\"\n",
"\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n",
"\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n",
"\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n",
"\"MIME-Version: 1.0\\n\"\n",
"\"Content-Type: text/plain; charset=CHARSET\\n\"\n",
"\"Content-Transfer-Encoding: ENCODING\\n\"\n",
NULL);
cmd = g_strdup_printf("echo '%s' | msginit -i- -l %s -o- --no-translator --no-wrap 2>/dev/null",
po_test_file, lang);
fs = popen(cmd,"r");
#define if_key_is(str) if (pair[0] && !strcmp(pair[0],str))
while(fgets(buf, BUF_SIZE, fs) != NULL)
{
pair = g_strsplit(buf, ": ", 2);
if_key_is("\"Plural-Forms")
{
plural_forms = g_strdup(*g_strsplit(pair[1], "\\n\"", 0));
}
g_strfreev(pair);
}
pclose(fs);
return plural_forms;
}
......@@ -159,4 +159,8 @@ void gtranslator_xml_set_integer_prop_by_name(xmlNode *parent, const xmlChar *pr
int gtranslator_mkdir_hier (const char *path, mode_t mode);
GdkPixbuf *gtranslator_pixbuf_from_file(gchar *file);
gchar *gtranslator_config_plural_form_string(gchar *lang);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment