The latest change, noted as "ADD: koord in window title for all objects" prevents translation of tree, building, and attraction names in the window headers: they all appear in their original German.
Edit: The problem is that, in thing_info.cc
gui_frame_t::set_name( title );
now uses the string, "title", which contains both the name and the co-ordinate, whereas the translator is only expecting the name. The name will have to be translated separately before being parsed into the "title" string, thus:
title.printf( "%s (%s)", translator::translate(get_name()), get_ding()->get_pos().get_2d().get_str() );
This will require that
#include "../dataobj/translator.h"
is added to the requisite part of thing_info.cc. I have confirmed that this fixes the issue.
The system will change again anyways ...
Hmm, the new system works with individually named objects, but generic windows of things that do not have a specific location (such as the new map window, the load/save windows, etc.) now display their untranslated names.
The latest release has partly fixed this, but still requires the following changes for translations to work fully:
gui_frame.cc
gui_frame_t::gui_frame_t(char const* const name, spieler_t const* const sp)
{
- this->name =name;
+ this->name = translator::translate(name);
groesse = koord(200, 100);
min_windowsize = koord(0,0);
owner = sp;
container.set_pos(koord(0,TITLEBAR_HEIGHT));
set_resizemode(no_resize); //25-may-02 markus weber added
dirty = true;
}
and replace the following method definition in gui_frame.h:
- void set_name(const char *name) { this->name=name; }
+ void set_name(const char *name);
with a declaration, and add the below method definition to gui_frame.cc:
+void gui_frame_t::set_name(const char *name)
+{
+ this->name = translator::translate(name);
+}
Actually, that should be avoided, until city having acidentally internal Simutrans names to get strange names. Imho all dialogues should rather submit a properly name to gui_frame_t. I only omitted color so far, if I am right.
Hmm, when I tested it, quite a number of things were missing, such as the load/save window, the new map window, all of the toolstrips for different transport types, etc. - any window that has a general name rather than an object-specific name, in other words. I did test it in Experimental, but the GUI is not something that has been changed between Standard and Experimental (apart from the depot window), and the affected code is the same in both, so it seems reasonable to assume that the effect is the same in both.
Certainly, the same effect could be achieved passing the translated name through the constructor, although this would take more work to code.
Well, meanwhile I changed most of the constructors anyway.
You're probably right that this is the right way of doing it, though, as it's better design to avoid the possibility of double-translation, even if it is a somewhat marginal case.