Ticket #235: gui_internal_i18n_support.diff

File gui_internal_i18n_support.diff, 11.7 KB (added by latouche, 13 years ago)
  • navit/gui/internal/gui_internal.c

     
    6666#define STATE_EDIT 16
    6767#define STATE_CLEAR 32
    6868
     69#define _(STRING)   gettext(STRING)
     70
    6971enum widget_type {
    7072        widget_box=1,
    7173        widget_button,
     
    11031105gui_internal_cmd_add_bookmark(struct gui_priv *this, struct widget *wm)
    11041106{
    11051107        struct widget *w,*wb,*wk,*wl,*we,*wnext,*wp=wm->data;
    1106         wb=gui_internal_menu(this, "Add Bookmark");     
     1108        wb=gui_internal_menu(this, _("Add Bookmark")); 
    11071109        w=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
    11081110        gui_internal_widget_append(wb, w);
    11091111        we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
     
    12991301        enum projection pro=wm->c.pro;
    13001302        struct selector *isel=wm->data;
    13011303
    1302         wb=gui_internal_menu(this, isel ? isel->name : "POIs");
     1304        wb=gui_internal_menu(this, isel ? isel->name : _("POIs"));     
    13031305        w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
    13041306        gui_internal_widget_append(wb, w);
    13051307        if (! isel)
     
    13811383        gui_internal_widget_append(w, gui_internal_label_new(this, coord));
    13821384        g_free(coord);
    13831385        gui_internal_widget_append(w,
    1384                 gui_internal_button_new_with_callback(this, "Set as destination",
     1386                gui_internal_button_new_with_callback(this, _("Set as destination"),
    13851387                        image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
    13861388                        gui_internal_cmd_set_destination, wm));
    13871389        gui_internal_widget_append(w,
    1388                 gui_internal_button_new_with_callback(this, "Set as position",
     1390                gui_internal_button_new_with_callback(this, _("Set as position"),
    13891391                        image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
    13901392                        gui_internal_cmd_set_position, wm));
    13911393        gui_internal_widget_append(w,
    1392                 wbc=gui_internal_button_new_with_callback(this, "Add as bookmark",
     1394                wbc=gui_internal_button_new_with_callback(this, _("Add as bookmark"),
    13931395                        image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
    13941396                        gui_internal_cmd_add_bookmark, wm));
    13951397        wbc->c=wm->c;
    13961398        gui_internal_widget_append(w,
    1397                 wbc=gui_internal_button_new_with_callback(this, "POIs",
     1399                wbc=gui_internal_button_new_with_callback(this, _("POIs"),
    13981400                        image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
    13991401                        gui_internal_cmd_pois, NULL));
    14001402        wbc->c=wm->c;
    14011403#if 0
    14021404        gui_internal_widget_append(w,
    1403                 gui_internal_button_new(this, "Add to tour",
     1405                gui_internal_button_new(this, _("Add to tour"),
    14041406                        image_new_o(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill));
    14051407        gui_internal_widget_append(w,
    1406                 gui_internal_button_new(this, "Add as bookmark",
     1408                gui_internal_button_new(this, _("Add as bookmark"),
    14071409                        image_new_o(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill));
    14081410#endif
    14091411        if ((int)wm->data != 1) {
    14101412                gui_internal_widget_append(w,
    1411                         gui_internal_button_new_with_callback(this, "View on map",
     1413                        gui_internal_button_new_with_callback(this, _("View on map"),
    14121414                                image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
    14131415                                gui_internal_cmd_view_on_map, wm));
    14141416        }
     
    14861488        struct coord c;
    14871489
    14881490
    1489         wb=gui_internal_menu(this, wm->text ? wm->text : "Bookmarks");
     1491        wb=gui_internal_menu(this, wm->text ? wm->text : _("Bookmarks"));
    14901492        w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
    14911493        w->spy=this->spacing*3;
    14921494        gui_internal_widget_append(wb, w);
     
    15221524                                                wbm->c.x=c.x;
    15231525                                                wbm->c.y=c.y;
    15241526                                                wbm->c.pro=map_projection(mattr.u.map);
    1525                                                 wbm->name=g_strdup_printf("Bookmark %s",label_full);
     1527                                                wbm->name=g_strdup_printf(_("Bookmark %s"),label_full);
    15261528                                                wbm->text=g_strdup(l);
    15271529                                                gui_internal_widget_append(w, wbm);
    15281530                                                g_hash_table_insert(hash, g_strdup(l), (void *)1);
     
    18901892        struct attr_iter *iter;
    18911893
    18921894
    1893         wb=gui_internal_menu(this, "Layout");
     1895        wb=gui_internal_menu(this, _("Layout"));
    18941896        w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
    18951897        w->spy=this->spacing*3;
    18961898        gui_internal_widget_append(wb, w);
     
    19171919{
    19181920        struct widget *w;
    19191921
    1920         w=gui_internal_menu(this, "Display");   
     1922        w=gui_internal_menu(this, _("Display"));       
    19211923        gui_internal_widget_append(w,
    1922                 gui_internal_button_new_with_callback(this, "Layout",
     1924                gui_internal_button_new_with_callback(this, _("Layout"),
    19231925                        image_new_l(this, "gui_display"), gravity_center|orientation_vertical,
    19241926                        gui_internal_cmd_layout, NULL));
    19251927        if (this->fullscreen) {
    19261928                gui_internal_widget_append(w,
    1927                         gui_internal_button_new_with_callback(this, "Window Mode",
     1929                        gui_internal_button_new_with_callback(this, _("Window Mode"),
    19281930                                image_new_l(this, "gui_leave_fullscreen"), gravity_center|orientation_vertical,
    19291931                                gui_internal_cmd_fullscreen, NULL));
    19301932        } else {
    19311933                gui_internal_widget_append(w,
    1932                         gui_internal_button_new_with_callback(this, "Fullscreen",
     1934                        gui_internal_button_new_with_callback(this, _("Fullscreen"),
    19331935                                image_new_l(this, "gui_fullscreen"), gravity_center|orientation_vertical,
    19341936                                gui_internal_cmd_fullscreen, NULL));
    19351937        }
     
    19571959        struct widget *w,*wc;
    19581960        char *coord;
    19591961
    1960         w=gui_internal_menu(this, "Actions");   
     1962        w=gui_internal_menu(this, _("Actions"));       
    19611963        gui_internal_widget_append(w,
    1962                 gui_internal_button_new_with_callback(this, "Bookmarks",
     1964                gui_internal_button_new_with_callback(this, _("Bookmarks"),
    19631965                        image_new_l(this, "gui_bookmark"), gravity_center|orientation_vertical,
    19641966                        gui_internal_cmd_bookmarks, NULL));
    19651967        if (this->clickp_valid) {
     
    19681970                        wc=gui_internal_button_new_with_callback(this, coord,
    19691971                                image_new_l(this, "gui_map"), gravity_center|orientation_vertical,
    19701972                                gui_internal_cmd_position, NULL));
    1971                 wc->name=g_strdup("Map Point");
     1973                wc->name=g_strdup(_("Map Point"));
    19721974                wc->c=this->clickp;
    19731975                g_free(coord);
    19741976        }
     
    19781980                        wc=gui_internal_button_new_with_callback(this, coord,
    19791981                                image_new_l(this, "gui_rules"), gravity_center|orientation_vertical,
    19801982                                gui_internal_cmd_position, NULL));
    1981                 wc->name=g_strdup("Vehicle Position");
     1983                wc->name=g_strdup(_("Vehicle Position"));
    19821984                wc->c=this->vehiclep;
    19831985                g_free(coord);
    19841986        }
    19851987        gui_internal_widget_append(w,
    1986                 gui_internal_button_new_with_callback(this, "Town",
     1988                gui_internal_button_new_with_callback(this, _("Town"),
    19871989                        image_new_l(this, "gui_rules"), gravity_center|orientation_vertical,
    19881990                        gui_internal_cmd_town, NULL));
    19891991        gui_internal_widget_append(w,
    1990                 gui_internal_button_new_with_callback(this, "Street",
     1992                gui_internal_button_new_with_callback(this, _("Street"),
    19911993                        image_new_l(this, "gui_rules"), gravity_center|orientation_vertical,
    19921994                        gui_internal_cmd_street, NULL));
    19931995        gui_internal_widget_append(w,
    1994                 gui_internal_button_new_with_callback(this, "Quit",
     1996                gui_internal_button_new_with_callback(this, _("Quit"),
    19951997                        image_new_l(this, "gui_quit"), gravity_center|orientation_vertical,
    19961998                        gui_internal_cmd_quit, NULL));
    19971999        gui_internal_widget_append(w,
    1998                 gui_internal_button_new_with_callback(this, "Stop\nNavigation",
     2000                gui_internal_button_new_with_callback(this, _("Stop\nNavigation"),
    19992001                        image_new_l(this, "gui_stop"), gravity_center|orientation_vertical,
    20002002                        gui_internal_cmd_abort_navigation, NULL));
    20012003        gui_internal_menu_render(this);
     
    20112013        struct attr on, off;
    20122014
    20132015
    2014         wb=gui_internal_menu(this, "Maps");
     2016        wb=gui_internal_menu(this, _("Maps"));
    20152017        w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
    20162018        w->spy=this->spacing*3;
    20172019        gui_internal_widget_append(wb, w);
     
    20392041        struct attr_iter *iter;
    20402042
    20412043
    2042         wb=gui_internal_menu(this, "Vehicle");
     2044        wb=gui_internal_menu(this, _("Vehicle"));
    20432045        w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
    20442046        w->spy=this->spacing*3;
    20452047        gui_internal_widget_append(wb, w);
     
    20602062{
    20612063        struct widget *wb,*w;
    20622064        struct attr on,off;
    2063         wb=gui_internal_menu(this, "Rules");   
     2065        wb=gui_internal_menu(this, _("Rules"));
    20642066        w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
    20652067        w->spy=this->spacing*3;
    20662068        gui_internal_widget_append(wb, w);
     
    20682070        off.u.num=0;
    20692071        on.type=off.type=attr_tracking;
    20702072        gui_internal_widget_append(w,
    2071                 gui_internal_button_navit_attr_new(this, "Lock on road", gravity_left_center|orientation_horizontal|flags_fill,
     2073                gui_internal_button_navit_attr_new(this, _("Lock on road"), gravity_left_center|orientation_horizontal|flags_fill,
    20722074                        &on, &off));
    20732075        on.type=off.type=attr_orientation;
    20742076        gui_internal_widget_append(w,
    2075                 gui_internal_button_navit_attr_new(this, "Northing", gravity_left_center|orientation_horizontal|flags_fill,
     2077                gui_internal_button_navit_attr_new(this, _("Northing"), gravity_left_center|orientation_horizontal|flags_fill,
    20762078                        &on, &off));
    20772079        on.type=off.type=attr_cursor;
    20782080        gui_internal_widget_append(w,
    2079                 gui_internal_button_navit_attr_new(this, "Map follows Vehicle", gravity_left_center|orientation_horizontal|flags_fill,
     2081                gui_internal_button_navit_attr_new(this, _("Map follows Vehicle"), gravity_left_center|orientation_horizontal|flags_fill,
    20802082                        &on, &off));
    20812083        gui_internal_widget_append(w,
    2082                 gui_internal_button_new(this, "Attack defenseless civilians",
     2084                gui_internal_button_new(this, _("Attack defenseless civilians"),
    20832085                        image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill));
    20842086        gui_internal_menu_render(this);
    20852087}
     
    20892091{
    20902092        struct widget *w;
    20912093
    2092         w=gui_internal_menu(this, "Settings"); 
     2094        w=gui_internal_menu(this, _("Settings"));       
    20932095        gui_internal_widget_append(w,
    2094                 gui_internal_button_new_with_callback(this, "Display",
     2096                gui_internal_button_new_with_callback(this, _("Display"),
    20952097                        image_new_l(this, "gui_display"), gravity_center|orientation_vertical,
    20962098                        gui_internal_cmd_display, NULL));
    20972099        gui_internal_widget_append(w,
    2098                 gui_internal_button_new_with_callback(this, "Maps",
     2100                gui_internal_button_new_with_callback(this, _("Maps"),
    20992101                        image_new_l(this, "gui_maps"), gravity_center|orientation_vertical,
    21002102                        gui_internal_cmd_maps, NULL));
    21012103        gui_internal_widget_append(w,
    2102                 gui_internal_button_new_with_callback(this, "Vehicle",
     2104                gui_internal_button_new_with_callback(this, _("Vehicle"),
    21032105                        image_new_l(this, "gui_sound"), gravity_center|orientation_vertical,
    21042106                        gui_internal_cmd_vehicle, NULL));
    21052107        gui_internal_widget_append(w,
    2106                 gui_internal_button_new_with_callback(this, "Rules",
     2108                gui_internal_button_new_with_callback(this, _("Rules"),
    21072109                        image_new_l(this, "gui_rules"), gravity_center|orientation_vertical,
    21082110                        gui_internal_cmd_rules, NULL));
    21092111        gui_internal_menu_render(this);
     
    21352137        struct widget *w;
    21362138
    21372139        graphics_draw_mode(this->gra, draw_mode_begin);
    2138         w=gui_internal_menu(this, "Main menu");
     2140        w=gui_internal_menu(this, _("Main menu"));     
    21392141        w->spx=this->spacing*10;
    2140         gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, "Actions",
     2142        gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, _("Actions"),
    21412143                        image_new_l(this, "gui_actions"), gravity_center|orientation_vertical,
    21422144                        gui_internal_cmd_actions, NULL));
    2143         gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, "Settings",
     2145        gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, _("Settings"),
    21442146                        image_new_l(this, "gui_settings"), gravity_center|orientation_vertical,
    21452147                        gui_internal_cmd_settings, NULL));
    2146         gui_internal_widget_append(w, gui_internal_button_new(this, "Tools",
     2148        gui_internal_widget_append(w, gui_internal_button_new(this, _("Tools"),
    21472149                        image_new_l(this, "gui_tools"), gravity_center|orientation_vertical));
    21482150        gui_internal_menu_render(this);
    21492151        graphics_draw_mode(this->gra, draw_mode_end);