diff options
author | Akira TAGOH <akira@tagoh.org> | 2012-01-11 14:43:46 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2012-01-11 14:43:46 +0900 |
commit | 969e400cb72ca3720b0f951d15218c235261098a (patch) | |
tree | dbb6442813b8a3f3f65fe2a0dbb40a632a8b2a9b /tests | |
parent | 4d2acdb7d9c63f9a50fb0dbc74d9045b065f95b1 (diff) |
Use the origin from IANA registry for region code instead of iso-codes.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/region-db.c | 57 |
1 files changed, 3 insertions, 54 deletions
diff --git a/tests/region-db.c b/tests/region-db.c index 4ef545f..939834a 100644 --- a/tests/region-db.c +++ b/tests/region-db.c @@ -37,62 +37,11 @@ main(int argc, regiondb = lt_region_db_new(); if (g_strcmp0(argv[1], "list") == 0) { - GList *l = lt_region_db_get_regions(regiondb), *ll; + } else if (g_strcmp0(argv[1], "lookup") == 0) { + lt_region_t *region = lt_region_db_lookup(regiondb, argv[2]); - for (ll = l; ll != NULL; ll = g_list_next(ll)) { - g_print("%s\n", (gchar *)ll->data); - } - g_list_free(l); - } else if (g_strcmp0(argv[1], "code") == 0) { - lt_region_t *region = lt_region_db_lookup_region_from_language(regiondb, argv[2]); - - g_print("N: %s\n", lt_region_get_code(region, LT_REGION_CODE_NUMERIC)); - g_print("2: %s\n", lt_region_has_alpha_2_code(region) ? lt_region_get_code(region, LT_REGION_CODE_ALPHA_2) : "N/A"); - g_print("3: %s\n", lt_region_get_code(region, LT_REGION_CODE_ALPHA_3)); - g_print("4: %s\n", lt_region_has_alpha_4_code(region) ? lt_region_get_code(region, LT_REGION_CODE_ALPHA_4) : "N/A"); - lt_region_unref(region); - } else if (g_strcmp0(argv[1], "region") == 0) { - lt_region_t *region = lt_region_db_lookup_region_from_code(regiondb, argv[2]); - - g_print("%s\n", lt_region_get_name(region)); + g_print("%s (%s)\n", lt_region_get_tag(region), lt_region_get_name(region)); lt_region_unref(region); - } else if (g_strcmp0(argv[1], "subcode") == 0) { - lt_division_t *div = lt_region_db_lookup_division(regiondb, argv[2]); - - g_print("%s\n", lt_division_get_code(div)); - lt_division_unref(div); - } else if (g_strcmp0(argv[1], "subname") == 0) { - lt_division_t *div = lt_region_db_lookup_division(regiondb, argv[2]); - - g_print("%s\n", lt_division_get_name(div)); - lt_division_unref(div); - } else if (g_strcmp0(argv[1], "subtype") == 0) { - GList *l = lt_region_db_get_division_type(regiondb, argv[2]), *ll; - - for (ll = l; ll != NULL; ll = g_list_next(ll)) { - g_print("%s\n", (gchar *)ll->data); - } - g_list_free(l); - } else if (g_strcmp0(argv[1], "subnames") == 0) { - GList *l = lt_region_db_get_divisions(regiondb, argv[2], argv[3]), *ll; - - for (ll = l; ll != NULL; ll = g_list_next(ll)) { - lt_division_t *div = ll->data; - - g_print("%s\n", lt_division_get_name(div)); - lt_division_unref(div); - } - g_list_free(l); - } else if (g_strcmp0(argv[1], "subcodes") == 0) { - GList *l = lt_region_db_get_divisions(regiondb, argv[2], argv[3]), *ll; - - for (ll = l; ll != NULL; ll = g_list_next(ll)) { - lt_division_t *div = ll->data; - - g_print("%s\n", lt_division_get_code(div)); - lt_division_unref(div); - } - g_list_free(l); } lt_region_db_unref(regiondb); |