示例#1
0
static void
gtr_language_lazy_init (void)
{
  gchar *filename;

  if (initialized)
    return;

  plurals_file = g_key_file_new ();
  filename = gtr_dirs_get_ui_file (GTR_PLURAL_FORMS_FILENAME);
  if (!g_key_file_load_from_file (plurals_file, filename, G_KEY_FILE_NONE, NULL))
    {
      g_warning ("Bad plural form file: '%s'", filename);
      g_free (filename);
      return;
    }

  g_free (filename);

  bind_iso_domains ();
  load_iso_entries (639, (GFunc) read_iso_639_entry, &languages);
  languages = g_slist_reverse (languages);

  /* free the file, not needed anymore */
  g_key_file_free (plurals_file);

  initialized = TRUE;
}
static GHashTable *
create_iso_3166_table (void)
{
	GHashTable *table;

	bind_iso_domains ();
	table = g_hash_table_new_full (g_str_hash, g_str_equal,
				       (GDestroyNotify) g_free,
				       (GDestroyNotify) xmlFree);
	
	load_iso_entries (3166, (GFunc) read_iso_3166_entry, table);

	return table;
}