If you want to translate Midori, you need a few preparations.
-First enable localization file updates when building:
+First create/ update the localization template:
-./waf configure --enable-update-po && ./waf build
+./waf build --update-po
+
+Running this command again will also update all translations
+as needed, according to changes in the template.
If you want to add a new language 'aa', create it like this:
-msginit -l aa_CC -o aa.po -i midori.pot && sed -i 's/PACKAGE/midori/g' aa.po
+cd po
+msginit -l aa_CC -o aa.po -i midori.pot
+sed -i 's/PACKAGE/midori/g' aa.po
To check your language 'aa' for errors, do this:
guint keyval;
gchar* fallback;
} FatStockItem;
+ GtkIconSource* icon_source;
+ GtkIconSet* icon_set;
+ GtkIconFactory* factory = gtk_icon_factory_new ();
+ gsize i;
static FatStockItem items[] =
{
{ STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD },
};
- GtkIconSource* icon_source;
- GtkIconSet* icon_set;
- GtkIconFactory* factory = gtk_icon_factory_new ();
- guint i;
-
- for (i = 0; i < (guint)G_N_ELEMENTS (items); i++)
+ for (i = 0; i < G_N_ELEMENTS (items); i++)
{
icon_set = gtk_icon_set_new ();
icon_source = gtk_icon_source_new ();
g_type_class_unref (enum_class);
}
else
- g_warning (_("Unhandled settings value '%s'"), property);
+ g_warning (_("Invalid configuration value '%s'"), property);
}
return settings;
}
GParamSpec* pspec;
GType type;
const gchar* property;
+ gboolean saved;
key_file = g_key_file_new ();
class = G_OBJECT_GET_CLASS (settings);
enum_value->value_name);
}
else
- g_warning (_("Unhandled settings value '%s'"), property);
+ g_warning (_("Invalid configuration value '%s'"), property);
}
- gboolean saved = sokoke_key_file_save_to_file (key_file, filename, error);
+ saved = sokoke_key_file_save_to_file (key_file, filename, error);
g_key_file_free (key_file);
return saved;
}
if (type)
return type;
static const GEnumValue values[] = {
- { MIDORI_LOAD_PROVISIONAL, "MIDORI_LOAD_PROVISIONAL", N_("Load Provisional") },
- { MIDORI_LOAD_COMMITTED, "MIDORI_LOAD_COMMITTED", N_("Load Committed") },
- { MIDORI_LOAD_FINISHED, "MIDORI_LOAD_FINISHED", N_("Load Finished") },
+ { MIDORI_LOAD_PROVISIONAL, "MIDORI_LOAD_PROVISIONAL", "Load Provisional" },
+ { MIDORI_LOAD_COMMITTED, "MIDORI_LOAD_COMMITTED", "Load Committed" },
+ { MIDORI_LOAD_FINISHED, "MIDORI_LOAD_FINISHED", "Load Finished" },
{ 0, NULL, NULL }
};
type = g_enum_register_static ("MidoriLoadStatus", values);
+++ /dev/null
-#! /usr/bin/env python
-# WAF build script for midori
-# This file is licensed under the terms of the expat license, see the file EXPAT.
-
-import Params
-import pproc as subprocess
-import os
-
-APPNAME = 'midori'
-
-if bld.env ()['INTLTOOL_UPDATE']:
- os.chdir ('./po')
- try:
- try:
- size_old = os.stat (APPNAME + '.pot').st_size
- except:
- size_old = 0
- subprocess.call (['intltool-update', '--pot'])
- size_new = os.stat (APPNAME + '.pot').st_size
- if size_new <> size_old:
- Params.pprint ('YELLOW', "Updated po template.")
- try:
- intltool_update = subprocess.Popen (['intltool-update', '-r'],
- stderr=subprocess.PIPE)
- intltool_update.wait ()
- Params.pprint ('YELLOW', "Updated translations.")
- except:
- Params.pprint ('RED', "Failed to update translations.")
- except:
- Params.pprint ('RED', "Failed to generate po template.")
- os.chdir ('..')
-
-obj = bld.create_obj ('intltool_po')
-obj.appname = APPNAME
nls = 'no'
conf.check_message_custom ('localization', 'support', nls)
- if Params.g_options.enable_update_po:
- conf.find_program ('intltool-update', var='INTLTOOL_UPDATE')
- if conf.env['INTLTOOL_UPDATE']:
- update_po = 'yes'
- else:
- update_po = 'not available'
- else:
- update_po = 'no'
- conf.check_message_custom ('localization file', 'updates', update_po)
-
# We support building without intltool
# Therefore datadir may not have been defined
if not conf.is_defined ('DATADIR'):
opt.add_option ('--disable-sqlite', action='store_true', default=False,
help='Disables sqlite support', dest='disable_sqlite')
- opt.add_option ('--enable-update-po', action='store_true', default=False,
- help='Enables localization file updates', dest='enable_update_po')
opt.add_option ('--enable-api-docs', action='store_true', default=False,
help='Enables API documentation', dest='enable_api_docs')
+ opt.add_option ('--update-po', action='store_true', default=False,
+ help='Update localization files', dest='update_po')
+
def build (bld):
def mkdir (path):
if not os.access (path, os.F_OK):
install_files ('DOCDIR', '/midori/user/', blddir + '/docs/user/midori.html')
if bld.env ()['INTLTOOL']:
- bld.add_subdirs ('po')
+ obj = bld.create_obj ('intltool_po')
+ obj.podir = 'po'
+ obj.appname = APPNAME
if bld.env ()['GTKDOC_SCAN'] and Params.g_commands['build']:
bld.add_subdirs ('docs/api')
if not icon_cache_updated:
Params.pprint ('YELLOW', "Icon cache not updated. After install, run this:")
Params.pprint ('YELLOW', "gtk-update-icon-cache -q -f -t %s" % dir)
+
+ elif Params.g_options.update_po:
+ os.chdir('./po')
+ try:
+ try:
+ size_old = os.stat (APPNAME + '.pot').st_size
+ except:
+ size_old = 0
+ subprocess.call (['intltool-update', '--pot'])
+ size_new = os.stat (APPNAME + '.pot').st_size
+ if size_new <> size_old:
+ Params.pprint ('YELLOW', "Updated po template.")
+ try:
+ intltool_update = subprocess.Popen (['intltool-update', '-r'],
+ stderr=subprocess.PIPE)
+ intltool_update.wait ()
+ Params.pprint ('YELLOW', "Updated translations.")
+ except:
+ Params.pprint ('RED', "Failed to update translations.")
+ except:
+ Params.pprint ('RED', "Failed to generate po template.")
+ Params.pprint ('RED', "Make sure intltool is installed.")
+ os.chdir ('..')