Thread: Ticket 4: better i18n
Hi, 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 :) Comments? -- Guillaume http://www.postgresql.fr http://dalibo.com
Attachment
On Tue, Jun 29, 2010 at 9:14 PM, Guillaume Lelarge <guillaume@lelarge.info> wrote: > Hi, > > 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? -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com The Enterprise Postgres Company
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
On Tue, Jun 29, 2010 at 9:39 PM, Guillaume Lelarge <guillaume@lelarge.info> wrote: > 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"? Ah - I see. Makes perfect sense - thanks! -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com The Enterprise Postgres Company
Le 29/06/2010 22:41, Dave Page a écrit : > On Tue, Jun 29, 2010 at 9:39 PM, Guillaume Lelarge > <guillaume@lelarge.info> wrote: > >> 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"? > > Ah - I see. Makes perfect sense - thanks! > The issue of doing this is that we have to add the sentence for each object and each catalogs. Which adds a lot of strings to translate (and quite the same, because they differ on a single word). But I don't think there is a way to do better than the way I did. -- Guillaume http://www.postgresql.fr http://dalibo.com
On Tue, Jun 29, 2010 at 9:51 PM, Guillaume Lelarge <guillaume@lelarge.info> wrote: > > The issue of doing this is that we have to add the sentence for each > object and each catalogs. Which adds a lot of strings to translate (and > quite the same, because they differ on a single word). But I don't think > there is a way to do better than the way I did. I'll have to trust you on that - you're the language guy :-) -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com The Enterprise Postgres Company
Le 29/06/2010 22:59, Dave Page a écrit : > On Tue, Jun 29, 2010 at 9:51 PM, Guillaume Lelarge > <guillaume@lelarge.info> wrote: >> >> The issue of doing this is that we have to add the sentence for each >> object and each catalogs. Which adds a lot of strings to translate (and >> quite the same, because they differ on a single word). But I don't think >> there is a way to do better than the way I did. > > I'll have to trust you on that - you're the language guy :-) > Just got a message of Marek Černocký, our czech translator who was waiting for this. BTW, this is probably not the only thing we'll have to do to have a better i18n, but it was surely the most important one. -- Guillaume http://www.postgresql.fr http://dalibo.com
Dave Page escreveu: > On Tue, Jun 29, 2010 at 9:51 PM, Guillaume Lelarge > <guillaume@lelarge.info> wrote: >> The issue of doing this is that we have to add the sentence for each >> object and each catalogs. Which adds a lot of strings to translate (and >> quite the same, because they differ on a single word). But I don't think >> there is a way to do better than the way I did. > > I'll have to trust you on that - you're the language guy :-) > That is/was a real issue, I've already noticed it too. Go for it even if we will have tons of strings to update. -- Euler Taveira de Oliveira http://www.timbira.com/