Partial fix for bug #3948.

The only strings not translated after the user changes the language,
are the menu buttons (File, Edit, Settings). A new menu button,
'settings' is added. Users can access the preferences and change
language dialog from here.
This commit is contained in:
Bram Ridder 2005-11-14 14:37:51 +00:00
parent 4efcadadf4
commit 4a03b49aed
4 changed files with 32 additions and 2 deletions

View file

@ -444,7 +444,7 @@ height=600
[menu]
title=_"File"
image=lite
items=editnewmap,editloadmap,editsaveas,editsavemap,editrevert,preferences,editquit
items=editnewmap,editloadmap,editsaveas,editsavemap,editrevert,editquit
rect=3,1,103,22
xanchor=fixed
yanchor=fixed
@ -457,6 +457,13 @@ height=600
rect=107,1,207,22
[/menu]
[menu]
title=_"Settings"
image=lite
items=changelanguage,preferences
rect=211,1,207,22
[/menu]
# The toolbar.
[menu]
image=draw_button_editor

View file

@ -359,7 +359,9 @@ void map_editor::right_click(const gamemap::location hex_clicked ) {
}
}
// Set the language...
/**
* Change the language (effectively reload the editor).
*/
void map_editor::change_language() {
std::vector<language_def> langdefs = get_languages();
@ -389,8 +391,18 @@ void map_editor::change_language() {
load_tooltips();
}
// Update the frame title
SDL_WM_SetCaption(_("Battle for Wesnoth Map Editor"), NULL);
font::load_font_config();
hotkey::load_descriptions();
// To reload the terrain names, we need to reload the configuration file
gamemap new_map(game_config_, map_.write());
map_ = new_map;
// Update the selected terrain strings
palette_.update_selected_terrains();
}

View file

@ -146,6 +146,14 @@ void terrain_palette::select_bg_terrain(gamemap::TERRAIN terrain) {
}
}
/**
* After the language is changed, the selected terrains needs an update.
*/
void terrain_palette::update_selected_terrains(void) {
set_dirty();
update_report();
}
std::string terrain_palette::get_terrain_string(const gamemap::TERRAIN t) {
std::stringstream str;
const std::string& name = map_.get_terrain_info(t).name();

View file

@ -53,6 +53,9 @@ public:
void select_fg_terrain(gamemap::TERRAIN);
void select_bg_terrain(gamemap::TERRAIN);
// Update the selected terrains strings
void update_selected_terrains(void);
// Draw the palette. If force is true everything will be redrawn
// even though it is not invalidated.
void draw(bool force=false);