コード例 #1
0
ファイル: gul-iso-codes.c プロジェクト: GNOME/galeon
/**
 * gul_iso_codes_lookup_name_for_code:
 * @code: A language code, e.g. en-gb
 *
 * Looks up a name to display to the user for a language code,
 * this might use the iso-codes package if support was compiled
 * in, and it is available
 *
 * Returns: the UTF-8 string to display to the user, or NULL if 
 * a name for the code could not be found
 */
char *
gul_iso_codes_lookup_name_for_code (const char *code)
{
	char * lcode;
	char * ret;

	g_return_val_if_fail (code != NULL, NULL);

	ensure_iso_codes_initialised ();

	lcode = g_ascii_strdown (code, -1);

	ret = get_iso_name_for_lang_code (lcode);
	if (!ret)
	{
		const char *langname = 
			(const char*)g_hash_table_lookup (galeon_langs_table, lcode);

		if (langname)
		{
			ret = g_strdup (_(langname));
		}
	}

	g_free (lcode);

	return ret;
}
コード例 #2
0
ファイル: sexy-iso-codes.c プロジェクト: TingPing/hexchat
/**
 * gtkspell_iso_codes_lookup_name_for_code:
 * @code: A language code, e.g. en_CA
 *
 * Looks up a name to display to the user for a language code,
 * this might use the iso-codes package if support was compiled
 * in, and it is available
 *
 * Returns: the UTF-8 string to display to the user, or NULL if
 * a name for the code could not be found
 */
char *
gtkspell_iso_codes_lookup_name_for_code (const char *code)
{
    char * lcode;
    char * ret;

    g_return_val_if_fail (code != NULL, NULL);

    ensure_iso_codes_initialised ();

    lcode = g_ascii_strdown (code, -1);

    ret = get_iso_name_for_lang_code (lcode);

    g_free (lcode);

    return ret;
}