Re: Ticket 4: better i18n - Mailing list pgadmin-hackers
From | Guillaume Lelarge |
---|---|
Subject | Re: Ticket 4: better i18n |
Date | |
Msg-id | 4C2A59FC.8010002@lelarge.info Whole thread Raw |
In response to | Re: Ticket 4: better i18n (Dave Page <dpage@pgadmin.org>) |
Responses |
Re: Ticket 4: better i18n
|
List | pgadmin-hackers |
Hi, Le 29/06/2010 22:16, Dave Page a écrit : > On Tue, Jun 29, 2010 at 9:14 PM, Guillaume Lelarge > <guillaume@lelarge.info> wrote: >> [...] >> This patch allows for a better internationalization. The big issue we >> had was with the use of the GetTranslatedTypeName() method. I add a >> GetTranslatedMessage for each object and each collection, so that the >> translation will be better. I tried with the french one, and it really >> is a lot better. Issues of this patch: adds quite some code lines, and >> adds many messages to translate (around 400). But the result is the good >> one. At least, I think so :) > > I'm not sure I understand the issue. Can you give an example? > Sure, you're right. An example would be better. See this line of code: text = wxString::Format(_("Are you sure you wish to drop %s \"%s\"?"), data->GetTranslatedTypeName().c_str(), ((pgServer*)data)->GetFullIdentifier().c_str()); On a table named "t1", text will have this value: Are you sure you wish to drop table "t1"? Which is good english. But, once translated in french, it gives: Êtes-vous sûr de vouloir supprimer table "t1"? Which is bad french. Because GetTranslatedTypeName returns "table" in french, which is the right translation of the single word table in english, but not in a complete sentence. It should be: Êtes-vous sûr de vouloir supprimer la table "t1"? On a trigger named "tr1", text will have this value: Are you sure you wish to drop trigger "tr1"? Which is good english. But, once translated in french, it gives: Êtes-vous sûr de vouloir supprimer trigger "tr1"? Instead of the right sentence: Êtes-vous sûr de vouloir supprimer le trigger "tr1"? So, in some languages, we would have a great deal of problems if we put simple translated words in an otherwise complete sentence. We have to give really complete sentences to translate, so that specific language syntax is respected. For example, word order could be different in other languages (though I don't have any example in the messages I found in pgAdmin with the french language). Hope it is better explained. But I'm not sure it really is :-/ Hmmm.. better idea, a copy/paste from PostgreSQL manuel :) # Do not construct sentences at run-time, like: printf("Files were %s.\n", flag ? "copied" : "removed"); The word order within the sentence might be different in other languages. Also, even if you remember to call gettext() on each fragment, the fragments might not translate well separately. It's better to duplicate a little code so that each message to be translated is a coherent whole. Only numbers, file names, and such-like run-time variables should be inserted at run time into a message text. (see http://www.postgresql.org/docs/9.0/static/nls-programmer.html#NLS-GUIDELINES) -- Guillaume http://www.postgresql.fr http://dalibo.com
pgadmin-hackers by date: