Thread: A bunch of minor issues
Hi, I'm working on the Finnish translation to bring it up-to-date, and bumped into a few minor issues, mostly localization related. This is the first time I'm hacking or even using pgAdmin, so excuse me if some of these topics have been discussed to death already: When creating a table or index, it would be nice if we checked that the value given for fillfactor is valid, within 0-100, in pgAdmin. Would be nicer than getting an error message from server. REINDEX options under "Maintenance". Always grey'd out, AFAICS. What are these? When trying to commit/rollback a prepared transaction in a database other than 'postgres', using the "server status" dialog, I always get this error message: ERROR: prepared transaction belongs to another database HINT: Connect to the database where the transaction was prepared to finish it. Apparently the "server status" always operates with the 'postgres' database... At a few places, buttons are laid out on top of each other, or over text labels, or columns are too narrow for the translated text. I know, this is mentioned in the howto, but it's still annoying. How well do the non-resizeable dialogs work with different font sizes, BTW? The "result copy quote" options in the main configuration options were not self-explanatory. I'd suggest grouping the three options together in a group box, and disabling the "result copy quote character" and "- separator" settings when "none"-quoting is selected. In checkboxes, sometimes a question mark is used at the end of the label text, sometimes not. Attached is a patch to change a few string constructions to be more localization-friendly. There's still a lot of troublesome constructs like "Cannot drop system %s", where %s is replaced with "View", "Sequence" etc. That doesn't work for many languages, including Finnish, where the following word needs to be inflected differently depending on the context. The patch also removes a bogus tooltip from a "Help"-button. You might want to replace it with a proper tooltip instead of removing it altogether. It would be nice if the references to lines in source files in the po-files worked for the strings extracted from xrc-files as well... In the "Manage macros" dialog, the "Name" column in the list is way too narrow, about 2-3 chars. For messages like "%d seconds", "%d rows", the plural forms of the formatting functions/macros should be used, see http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms. Google suggests that wxWidgets has a wxPLURAL macro for plural forms, that works like the _() macro that's used for normal strings. There's some strings in calls to wxLogDebug, like "OnTargetComplete() called", that are wrapped in _() for translation. Aren't those just for developers, and therefore a waste of time to translate? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Heikki Linnakangas wrote: > I'm working on the Finnish translation to bring it up-to-date, and > bumped into a few minor issues, mostly localization related. This is the > first time I'm hacking or even using pgAdmin, so excuse me if some of > these topics have been discussed to death already: > I faced those problems when I was updating the pt-br translation. Unfortunately, pgAdmin already froze the strings. > Attached is a patch to change a few string constructions to be more > localization-friendly. There's still a lot of troublesome constructs where is the patch? > It would be nice if the references to lines in source files in the > po-files worked for the strings extracted from xrc-files as well... > It would be nice but wxrc doesn't help. :( -- Euler Taveira de Oliveira http://www.timbira.com/
Euler Taveira de Oliveira wrote: > Heikki Linnakangas wrote: >> Attached is a patch to change a few string constructions to be more >> localization-friendly. There's still a lot of troublesome constructs > where is the patch? Oh crap. Here.. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com Index: pgadmin/frm/frmQuery.cpp =================================================================== --- pgadmin/frm/frmQuery.cpp (revision 6657) +++ pgadmin/frm/frmQuery.cpp (working copy) @@ -1146,8 +1146,10 @@ { wxString fn; if (!lastPath.IsNull()) - fn = wxT(" in file ") + lastPath; - wxMessageDialog msg(this, wxString::Format(_("The text %s has changed.\nDo you want to save changes?"), fn.c_str()),_("Query"), + fn = wxString::Format(_("The text in file %s has changed.\nDo you want to save changes?"), lastPath.c_str()); + else + fn = _("The text has changed.\nDo you want to save changes?"); + wxMessageDialog msg(this, fn, _("Query"), wxYES_NO|wxICON_EXCLAMATION| (canVeto ? wxCANCEL : 0)); Index: pgadmin/debugger/dbgPgConn.cpp =================================================================== --- pgadmin/debugger/dbgPgConn.cpp (revision 6657) +++ pgadmin/debugger/dbgPgConn.cpp (working copy) @@ -123,12 +123,12 @@ connectParams.Trim( true ); connectParams.Trim( false ); - m_frame->getStatusBar()->SetStatusText( wxString(_( "Connecting to " )) + msg, 1 ); + m_frame->getStatusBar()->SetStatusText( wxString::Format(_( "Connecting to %s" ), msg.c_str()), 1 ); m_pgConn = PQconnectdb( connectParams.ToAscii()); if( PQstatus( m_pgConn ) == CONNECTION_OK ) { - m_frame->getStatusBar()->SetStatusText( wxString(_( "Connected to " )) + msg, 1 ); + m_frame->getStatusBar()->SetStatusText( wxString::Format(_( "Connected to %s" ), msg.c_str()), 1 ); PQsetClientEncoding( m_pgConn, "UNICODE" ); } Index: pgadmin/dlg/dlgManageFavourites.cpp =================================================================== --- pgadmin/dlg/dlgManageFavourites.cpp (revision 6657) +++ pgadmin/dlg/dlgManageFavourites.cpp (working copy) @@ -149,6 +149,8 @@ void dlgManageFavourites::OnDelete(wxCommandEvent &ev) { + wxString msg; + if (!trLocation->GetSelection().IsOk() || trLocation->GetSelection() == trLocation->GetRootItem()) return; @@ -157,7 +159,11 @@ if (!item) return; - if (wxMessageDialog(this, wxString(_("Are you sure you want to delete the ")) + ((item->GetId()!=-2)?_("favourite"):_("folder"))+ wxT(" '") + item->GetTitle() + wxT("'?"), _("Confirm delete"), wxYES_NO| wxICON_QUESTION).ShowModal() != wxID_YES) + if (item->GetId() != -2) + msg = wxString::Format(_("Are you sure you want to delete the favourite '%s'?"), item->GetTitle().c_str()); + else + msg = wxString::Format(_("Are you sure you want to delete the folder '%s'?"), item->GetTitle().c_str()); + if (wxMessageDialog(this, msg, _("Confirm delete"), wxYES_NO | wxICON_QUESTION).ShowModal() != wxID_YES) return; if (favourites->DeleteTreeItem(trLocation->GetSelection())) Index: pgadmin/ui/frmOptions.xrc =================================================================== --- pgadmin/ui/frmOptions.xrc (revision 6657) +++ pgadmin/ui/frmOptions.xrc (working copy) @@ -354,7 +354,6 @@ <object class="wxButton" name="wxID_HELP"> <label>&Help</label> <pos>2,216d</pos> - <tooltip>Accept the current settings and close the dialogue.</tooltip> </object> <object class="wxButton" name="wxID_OK"> <label>&OK</label> @@ -369,4 +368,4 @@ <tooltip>Cancel any changes and close the dialogue.</tooltip> </object> </object> -</resource> \ No newline at end of file +</resource>
[Guillaume; I've left some of Heikki's suggestions to your discretion, please read on...] Heikki Linnakangas wrote: > Hi, > > I'm working on the Finnish translation to bring it up-to-date, and > bumped into a few minor issues, mostly localization related. This is the > first time I'm hacking or even using pgAdmin, so excuse me if some of > these topics have been discussed to death already: Gah - you know I'm trying to get this out the door :-p > When creating a table or index, it would be nice if we checked that the > value given for fillfactor is valid, within 0-100, in pgAdmin. Would be > nicer than getting an error message from server. We defer all validation to the server as a general rule. Some things are very difficult to verify on the client (the default value of a columnor a check constraint for example) so we leave it all to the server. > REINDEX options under "Maintenance". Always grey'd out, AFAICS. What are > these? The rules are (reformatted for clarity): // Is REINDEX the selected operation? bool isReindex = (rbxAction->GetSelection() == 2); sbxReindexOptions->Enable( isReindex && object->GetMetaType() == PGM_DATABASE || object->GetMetaType() == PGM_INDEX || object->GetMetaType() == PGM_PRIMARYKEY || object->GetMetaType() == PGM_UNIQUE); chkForce->Enable( isReindex && object->GetMetaType() == PGM_DATABASE); chkRecreate->Enable( isReindex && object->GetMetaType() == PGM_INDEX); RECREATE is a pgAdmin extension that drops and recreates an index. It isn't implemented for constraints (iirc) due to the window in which it could leave the table unconstrained. Although... is that actually an issue? I assume it is because the catalogs are always read with SnapshotNow() (is that the right one?). Anyway, you get the point. Grateful if you can confirm if we're right to worry or not! > When trying to commit/rollback a prepared transaction in a database > other than 'postgres', using the "server status" dialog, I always get > this error message: > > ERROR: prepared transaction belongs to another database > HINT: Connect to the database where the transaction was prepared to > finish it. > > Apparently the "server status" always operates with the 'postgres' > database... Will investigate and fix. > At a few places, buttons are laid out on top of each other, or over text > labels, or columns are too narrow for the translated text. I know, this > is mentioned in the howto, but it's still annoying. How well do the > non-resizeable dialogs work with different font sizes, BTW? Reasonably well as a general rule, but some GTK themes can do wierd things. The dialogues are all laid out using 'dialog units', the actual size of which are calculated at runtime taking into account the font selection. Much of what is in the howto relates to v1.0 before the current system was implemented. As you know I work in OS X and Windows most of the time and I know there are no sizing issues there in English. Is this something specific to running in Finnish (should that be Fin?), or GTK do you think? > The "result copy quote" options in the main configuration options were > not self-explanatory. Thats why we have a helpfile :-) > I'd suggest grouping the three options together in > a group box, I'm hoping to redesign that dialogue for the next version anyway, so I'm not going to spend any time on that this time round - but point taken. > and disabling the "result copy quote character" and "- > separator" settings when "none"-quoting is selected. I've committed a change to enable/disable the quote character option as appropriate, however the separator is always used. > In checkboxes, sometimes a question mark is used at the end of the label > text, sometimes not. Yeah, I don't know how those strings translate out of English, but some have the inflection of a question, whilst others are more of a statement with a true/false part - I think that's where the difference comes from. There are a couple I'm not sure about. I'm inclined to leave these for now and standardise them in the redesign next to round. They've been like that for a while, and I'd rather not cheese off the translators this late in the cycle! > Attached is a patch to change a few string constructions to be more > localization-friendly. There's still a lot of troublesome constructs > like "Cannot drop system %s", where %s is replaced with "View", > "Sequence" etc. That doesn't work for many languages, including Finnish, > where the following word needs to be inflected differently depending on > the context. The patch also removes a bogus tooltip from a > "Help"-button. You might want to replace it with a proper tooltip > instead of removing it altogether. I'll leave that to Guillaume to apply as he prefers. > It would be nice if the references to lines in source files in the > po-files worked for the strings extracted from xrc-files as well... Thats somewhat out of our control unfortunately (it's a wxWidgets thing). > In the "Manage macros" dialog, the "Name" column in the list is way too > narrow, about 2-3 chars. That must be a GTK thing as it's about 2.5 times the size of the Key column here. Is the Key column too large, forcing the Name to be small, or is there a bunch of unused space? > For messages like "%d seconds", "%d rows", the plural forms of the > formatting functions/macros should be used, see > http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms. > Google suggests that wxWidgets has a wxPLURAL macro for plural forms, > that works like the _() macro that's used for normal strings. Guillaume - is this something you want to do now, or defer for the next release? Obviously it would break strings and I'd *really* like to go RC in the next week or so! > There's some strings in calls to wxLogDebug, like "OnTargetComplete() > called", that are wrapped in _() for translation. Aren't those just for > developers, and therefore a waste of time to translate? Yep. Removed. Thanks for the feedback. Regards, Dave.
Dave Page wrote: >> When trying to commit/rollback a prepared transaction in a database >> other than 'postgres', using the "server status" dialog, I always get >> this error message: >> >> ERROR: prepared transaction belongs to another database >> HINT: Connect to the database where the transaction was prepared to >> finish it. >> >> Apparently the "server status" always operates with the 'postgres' >> database... > > Will investigate and fix. Seems this is only an issue with 8.3 Fix committed to SVN. Thanks, Dave.
Dave Page wrote: > Dave Page wrote: >>> When trying to commit/rollback a prepared transaction in a database >>> other than 'postgres', using the "server status" dialog, I always get >>> this error message: >>> >>> ERROR: prepared transaction belongs to another database >>> HINT: Connect to the database where the transaction was prepared to >>> finish it. >>> >>> Apparently the "server status" always operates with the 'postgres' >>> database... >> >> Will investigate and fix. > > Seems this is only an issue with 8.3 Fix committed to SVN. Really? <checks 8.2 source code>. No, that change was backpatched all the way to 8.1 branch, which is the first release with 2PC. The check is in src/backend/access/transam/twophase.c: > /* > * Note: it probably would be possible to allow committing from another > * database; but at the moment NOTIFY is known not to work and there > * may be some other issues as well. Hence disallow until someone > * gets motivated to make it work. > */ > if (MyDatabaseId != gxact->proc.databaseId) > ereport(ERROR, > (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), > errmsg("prepared transaction belongs to another database"), > errhint("Connect to the database where the transaction was prepared to finish it."))); -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Dave Page wrote: > [Guillaume; I've left some of Heikki's suggestions to your discretion, > please read on...] > > Heikki Linnakangas wrote: >> When creating a table or index, it would be nice if we checked that the >> value given for fillfactor is valid, within 0-100, in pgAdmin. Would be >> nicer than getting an error message from server. > > We defer all validation to the server as a general rule. Some things are > very difficult to verify on the client (the default value of a columnor > a check constraint for example) so we leave it all to the server. Ok, makes sense. > RECREATE is a pgAdmin extension that drops and recreates an index. What's the advantage of that, compared to normal REINDEX? > It > isn't implemented for constraints (iirc) due to the window in which it > could leave the table unconstrained. Although... is that actually an > issue? I assume it is because the catalogs are always read with > SnapshotNow() (is that the right one?). Anyway, you get the point. > Grateful if you can confirm if we're right to worry or not! I think it would work if you dropped and recreated the constraint in a single transaction. The DROP would acquire an exclusive lock on the table, so anyone trying to insert to it would block. >> At a few places, buttons are laid out on top of each other, or over text >> labels, or columns are too narrow for the translated text. I know, this >> is mentioned in the howto, but it's still annoying. How well do the >> non-resizeable dialogs work with different font sizes, BTW? > > Reasonably well as a general rule, but some GTK themes can do wierd > things. The dialogues are all laid out using 'dialog units', the actual > size of which are calculated at runtime taking into account the font > selection. Much of what is in the howto relates to v1.0 before the > current system was implemented. > > As you know I work in OS X and Windows most of the time and I know there > are no sizing issues there in English. Is this something specific to > running in Finnish (should that be Fin?), or GTK do you think? Finnish texts do tend to more longer than English. It's not a problem in most places, but for example "Rename" in the favourites manager is translated to "Nimeä uudelleen", which is quite a bit longer. If we just made the space reserved for the button bigger, it would look quite silly in English I think. But as it is, the button is partly underneath the "Remove" button. >> In checkboxes, sometimes a question mark is used at the end of the label >> text, sometimes not. > > Yeah, I don't know how those strings translate out of English, but some > have the inflection of a question, whilst others are more of a statement > with a true/false part - I think that's where the difference comes from. > There are a couple I'm not sure about. > > I'm inclined to leave these for now and standardise them in the redesign > next to round. They've been like that for a while, and I'd rather not > cheese off the translators this late in the cycle! Yeah, probably don't want to change it now. I'd suggest changing them all to the true/false statement form in the future. >> It would be nice if the references to lines in source files in the >> po-files worked for the strings extracted from xrc-files as well... > > Thats somewhat out of our control unfortunately (it's a wxWidgets thing). Only somewhat ;-). I hacked wxXml, wxrc and stringextract to do that. I'll clean that up and post patches to wx the wxWidgets list, as well the changes to stringextract. Meanwhile, anyone interested in the pgadmin3.pot file I have here with the file/line numbers in it? I can post it if so.. >> In the "Manage macros" dialog, the "Name" column in the list is way too >> narrow, about 2-3 chars. > > That must be a GTK thing as it's about 2.5 times the size of the Key > column here. Is the Key column too large, forcing the Name to be small, > or is there a bunch of unused space? There's a bunch of unused space. I can send you a screenshot. >> For messages like "%d seconds", "%d rows", the plural forms of the >> formatting functions/macros should be used, see >> http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms. >> Google suggests that wxWidgets has a wxPLURAL macro for plural forms, >> that works like the _() macro that's used for normal strings. > > Guillaume - is this something you want to do now, or defer for the next > release? Obviously it would break strings and I'd *really* like to go RC > in the next week or so! Yeah, probably better to leave it until next release. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Heikki Linnakangas wrote: > Really? <checks 8.2 source code>. No, that change was backpatched all > the way to 8.1 branch, which is the first release with 2PC. The check is > in src/backend/access/transam/twophase.c: Rats - seems the test server I was using was 8.2.2. Oh well, easy fix committed. Thanks, Dave.
On 26.9.2007, at 14.26, Heikki Linnakangas wrote: > Dave Page >> As you know I work in OS X and Windows most of the time and I know >> there >> are no sizing issues there in English. Is this something specific to >> running in Finnish (should that be Fin?), or GTK do you think? FI (or fi) should be enough (I am not sure, what you are looking for). > > Finnish texts do tend to more longer than English. It's not a > problem in > most places, but for example "Rename" in the favourites manager is > translated to "Nimeä uudelleen", which is quite a bit longer. If we > just > made the space reserved for the button bigger, it would look quite > silly > in English I think. But as it is, the button is partly underneath the > "Remove" button. That translation is a literal one. If something has a name already, "Nimeä" could be enough, it means then rename?! This is a suggestion only, and the problem remains, some translations are bound to be longish, in the user interface controls that will be difficult. ! ! Jyrki Wahlstedt ! http://www.wahlstedt.fi/jyrki/ ! ! Our life is no dream; but it ought to become one and perhaps will. ! PGP key ID: 0x139CC386 fingerprint: F355 B46F 026C B8C1 89C0 A780 6366 EFD9 139C C386
Heikki Linnakangas wrote: >> RECREATE is a pgAdmin extension that drops and recreates an index. > > What's the advantage of that, compared to normal REINDEX? Quoth the PG docs: REINDEX is similar to a drop and recreate of the index in that the index contents are rebuilt from scratch. However, the locking considerations are rather different. REINDEX locks out writes but not reads of the index's parent table. It also takes an exclusive lock on the specific index being processed, which will block reads that attempt to use that index. In contrast, DROP INDEX momentarily takes exclusive lock on the parent table, blocking both writes and reads. The subsequent CREATE INDEX locks out writes but not reads; since the index is not there, no read will attempt to use it, meaning that there will be no blocking but reads may be forced into expensive sequential scans. Another important point is that the drop/create approach invalidates any cached query plans that use the index, while REINDEX does not. >> It >> isn't implemented for constraints (iirc) due to the window in which it >> could leave the table unconstrained. Although... is that actually an >> issue? I assume it is because the catalogs are always read with >> SnapshotNow() (is that the right one?). Anyway, you get the point. >> Grateful if you can confirm if we're right to worry or not! > > I think it would work if you dropped and recreated the constraint in a > single transaction. The DROP would acquire an exclusive lock on the > table, so anyone trying to insert to it would block. OK. > Finnish texts do tend to more longer than English. It's not a problem in > most places, but for example "Rename" in the favourites manager is > translated to "Nimeä uudelleen", which is quite a bit longer. If we just > made the space reserved for the button bigger, it would look quite silly > in English I think. But as it is, the button is partly underneath the > "Remove" button. Wow, that is longer. I think we normally suggest leaving 50% extra space over the English text. I'm not sure how we'd handle that case automatically unless we rewrite everything to use sizers (which are a lot more usable now than when most of the dialogues were first written). Thats a *lot* of work though. > Only somewhat ;-). I hacked wxXml, wxrc and stringextract to do that. > I'll clean that up and post patches to wx the wxWidgets list, as well > the changes to stringextract. Cool, thanks. > Meanwhile, anyone interested in the pgadmin3.pot file I have here with > the file/line numbers in it? I can post it if so.. I'd be more interested in the patches so I can update my utilities and those of developer.pgadmin.org where stringextract tends to be run (I imagine Guillaume would like a copy too). >>> In the "Manage macros" dialog, the "Name" column in the list is way too >>> narrow, about 2-3 chars. >> That must be a GTK thing as it's about 2.5 times the size of the Key >> column here. Is the Key column too large, forcing the Name to be small, >> or is there a bunch of unused space? > > There's a bunch of unused space. I can send you a screenshot. I'll be in the office tomorrow - I can test it properly on Linux then and eyeball your screen. Thanks, Dave
Jyrki Wahlstedt wrote: > > On 26.9.2007, at 14.26, Heikki Linnakangas wrote: > >> Dave Page >>> As you know I work in OS X and Windows most of the time and I know there >>> are no sizing issues there in English. Is this something specific to >>> running in Finnish (should that be Fin?), or GTK do you think? > > FI (or fi) should be enough (I am not sure, what you are looking for). Just a correction to my grammar in that paragraph! Regards,Dave
Dave Page a écrit : > [Guillaume; I've left some of Heikki's suggestions to your discretion, > please read on...] > Thanks :) >> Attached is a patch to change a few string constructions to be more >> localization-friendly. There's still a lot of troublesome constructs >> like "Cannot drop system %s", where %s is replaced with "View", >> "Sequence" etc. That doesn't work for many languages, including Finnish, >> where the following word needs to be inflected differently depending on >> the context. The patch also removes a bogus tooltip from a >> "Help"-button. You might want to replace it with a proper tooltip >> instead of removing it altogether. > > I'll leave that to Guillaume to apply as he prefers. > Yes, I know those. I didn't work on it before because I wanted to know better pgAdmin's sources. That's why I mostly did minor adjustments for this release. But this is something I want to work on for next release. > [...] >> For messages like "%d seconds", "%d rows", the plural forms of the >> formatting functions/macros should be used, see >> http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms. >> Google suggests that wxWidgets has a wxPLURAL macro for plural forms, >> that works like the _() macro that's used for normal strings. > > Guillaume - is this something you want to do now, or defer for the next > release? Obviously it would break strings and I'd *really* like to go RC > in the next week or so! > Defer please. We already did many changes to strings in beta period, and that's not good. I'm waiting RC for another call to translators, so they can finish their work. I'll work on the plural forms for next release. >> There's some strings in calls to wxLogDebug, like "OnTargetComplete() >> called", that are wrapped in _() for translation. Aren't those just for >> developers, and therefore a waste of time to translate? > > Yep. Removed. > > Thanks for the feedback. > Yes, thanks, Heikki. Regards. -- Guillaume. http://www.postgresqlfr.org http://dalibo.com
Dave Page a écrit : > Heikki Linnakangas wrote: > [...] >> Meanwhile, anyone interested in the pgadmin3.pot file I have here with >> the file/line numbers in it? I can post it if so.. > > I'd be more interested in the patches so I can update my utilities and > those of developer.pgadmin.org where stringextract tends to be run (I > imagine Guillaume would like a copy too). > Right :) Thanks. -- Guillaume. http://www.postgresqlfr.org http://dalibo.com
Dave Page wrote: > REINDEX is similar to a drop and recreate of the index in that the index > contents are rebuilt from scratch. However, the locking considerations > are rather different. REINDEX locks out writes but not reads of the > index's parent table. It also takes an exclusive lock on the specific > index being processed, which will block reads that attempt to use that > index. In contrast, DROP INDEX momentarily takes exclusive lock on the > parent table, blocking both writes and reads. The subsequent CREATE > INDEX locks out writes but not reads; since the index is not there, no > read will attempt to use it, meaning that there will be no blocking but > reads may be forced into expensive sequential scans. Another important > point is that the drop/create approach invalidates any cached query > plans that use the index, while REINDEX does not. So the advantage is that drop+create will allow all reads to run concurrently, though they might have to use sequential scans. Hmm, I wonder if a CREATE+DROP+rename would be even better. Could use CONCURRENT-mode in the create as well to allow concurrent writes... I know I know, no new features at this point :). -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Heikki Linnakangas wrote: > Dave Page wrote: >> REINDEX is similar to a drop and recreate of the index in that the index >> contents are rebuilt from scratch. However, the locking considerations >> are rather different. REINDEX locks out writes but not reads of the >> index's parent table. It also takes an exclusive lock on the specific >> index being processed, which will block reads that attempt to use that >> index. In contrast, DROP INDEX momentarily takes exclusive lock on the >> parent table, blocking both writes and reads. The subsequent CREATE >> INDEX locks out writes but not reads; since the index is not there, no >> read will attempt to use it, meaning that there will be no blocking but >> reads may be forced into expensive sequential scans. Another important >> point is that the drop/create approach invalidates any cached query >> plans that use the index, while REINDEX does not. > > So the advantage is that drop+create will allow all reads to run > concurrently, though they might have to use sequential scans. Hmm, I > wonder if a CREATE+DROP+rename would be even better. Could use > CONCURRENT-mode in the create as well to allow concurrent writes... Would be even nicer to include in the server... maybe REINDEX CONCURRENTLY... > I know I know, no new features at this point :). Indeed :-) /D
Dave Page wrote: > I'd be more interested in the patches so I can update my utilities and > those of developer.pgadmin.org where stringextract tends to be run (I > imagine Guillaume would like a copy too). Ok. Here's two patches to enable that: wx-linenumbers-in-wxrc-1.patch (against wxWidgets SVN trunk) modifies wxrc to output additional empty lines, so that the line numbers of the strings in the gettext output match corresponding lines in the source file. A bit hacky, but it works. I had to modify wxXml code to keep the line numbers in the wxXmlNode-objects it constructs from the XML document. pgadmin-stringextract-keep-filenames-1.patch modifies stringextract so that it runs wxrc and xgettext separately on each xrc file, to get the correct filename in the pot file. BTW, this patch alone is beneficial; you get the correct filenames though the line numbers are bogus without the wxrc patch. I'm not sure how the xargs-magic works on windows... -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com Index: stringextract =================================================================== --- stringextract (revision 6673) +++ stringextract (working copy) @@ -40,4 +40,14 @@ xgettext -k_ -k__ -j -s -o pgadmin3.pot xtra/pgagent/*.cpp xgettext -k_ -k__ -j -s -o pgadmin3.pot xtra/pgagent/include/*.h -wxrc -g pgadmin/ui/*.xrc | xgettext -k_ -k__ -L C -j -s -o pgadmin3.pot - +TMPDIR=`mktemp -d` || exit 1 +echo "$TMPDIR" + +mkdir $TMPDIR/pgadmin +mkdir $TMPDIR/pgadmin/ui + +ls pgadmin/ui/*.xrc | xargs -I filename wxrc -g filename -o $TMPDIR/filename + +ls pgadmin/ui/*.xrc | xargs xgettext -k_ -k__ -L C -j -s -o pgadmin3.pot -D $TMPDIR/ + +rm -rf $TMPDIR Index: src/xml/xml.cpp =================================================================== --- src/xml/xml.cpp (revision 48947) +++ src/xml/xml.cpp (working copy) @@ -64,6 +64,7 @@ else m_parent->m_children = this; } + m_lineNo = -1; } wxXmlNode::wxXmlNode(wxXmlNodeType type, const wxString& name, @@ -454,6 +455,7 @@ struct wxXmlParsingContext { + XML_Parser parser; wxMBConv *conv; wxXmlNode *root; wxXmlNode *node; @@ -469,6 +471,9 @@ wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData; wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, CharToString(ctx->conv, name)); const char **a = atts; + + node->SetLineNumber(XML_GetCurrentLineNumber(ctx->parser)); + while (*a) { node->AddAttribute(CharToString(ctx->conv, a[0]), CharToString(ctx->conv, a[1])); @@ -508,6 +513,7 @@ if (!whiteOnly) { ctx->lastAsText = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"), str); + ctx->lastAsText->SetLineNumber(XML_GetCurrentLineNumber(ctx->parser)); ctx->node->AddChild(ctx->lastAsText); } } @@ -518,6 +524,7 @@ wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData; ctx->lastAsText = new wxXmlNode(wxXML_CDATA_SECTION_NODE, wxT("cdata"),wxT("")); + ctx->lastAsText->SetLineNumber(XML_GetCurrentLineNumber(ctx->parser)); ctx->node->AddChild(ctx->lastAsText); } @@ -530,8 +537,11 @@ // VS: ctx->node == NULL happens if there is a comment before // the root element (e.g. wxDesigner's output). We ignore such // comments, no big deal... - ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE, - wxT("comment"), CharToString(ctx->conv, data))); + wxXmlNode *n = new wxXmlNode(wxXML_COMMENT_NODE, + wxT("comment"), CharToString(ctx->conv, data)); + n->SetLineNumber(XML_GetCurrentLineNumber(ctx->parser)); + + ctx->node->AddChild(n); } ctx->lastAsText = NULL; } @@ -609,6 +619,7 @@ ctx.conv = new wxCSConv(encoding); #endif ctx.removeWhiteOnlyNodes = (flags & wxXMLDOC_KEEP_WHITESPACE_NODES) == 0; + ctx.parser = parser; XML_SetUserData(parser, (void*)&ctx); XML_SetElementHandler(parser, StartElementHnd, EndElementHnd); Index: include/wx/xml/xml.h =================================================================== --- include/wx/xml/xml.h (revision 48947) +++ include/wx/xml/xml.h (working copy) @@ -151,6 +151,9 @@ wxString GetAttribute(const wxString& attrName, const wxString& defaultVal) const; bool HasAttribute(const wxString& attrName) const; + + int GetLineNumber() const { return m_lineNo; } + void SetLineNumber(int lineNo) { m_lineNo = lineNo; } void SetType(wxXmlNodeType type) { m_type = type; } void SetName(const wxString& name) { m_name = name; } @@ -202,6 +205,7 @@ wxString m_content; wxXmlAttribute *m_attrs; wxXmlNode *m_parent, *m_children, *m_next; + int m_lineNo; // line number in original file, or -1 void DoCopy(const wxXmlNode& node); }; Index: utils/wxrc/wxrc.cpp =================================================================== --- utils/wxrc/wxrc.cpp (revision 48947) +++ utils/wxrc/wxrc.cpp (working copy) @@ -201,7 +201,18 @@ WX_DECLARE_OBJARRAY(XRCWndClassData,ArrayOfXRCWndClassData); WX_DEFINE_OBJARRAY(ArrayOfXRCWndClassData) +class StringWithLineNumber +{ +public: + wxString str; + int lineNo; +}; +WX_DECLARE_OBJARRAY(StringWithLineNumber ,ArrayOfStringWithLineNumber); +WX_DEFINE_OBJARRAY(ArrayOfStringWithLineNumber) + + + class XmlResApp : public wxAppConsole { public: @@ -222,8 +233,8 @@ void MakePackagePython(const wxArrayString& flist); void OutputGettext(); - wxArrayString FindStrings(); - wxArrayString FindStrings(wxXmlNode *node); + ArrayOfStringWithLineNumber FindStrings(); + ArrayOfStringWithLineNumber FindStrings(wxXmlNode *node); bool flagVerbose, flagCPP, flagPython, flagGettext; wxString parOutput, parFuncname, parOutputPath; @@ -806,10 +817,16 @@ } - +static int wxCMPFUNC_CONV StringWithLineNumberCmp( +StringWithLineNumber **a, StringWithLineNumber **b) +{ + return (*a)->lineNo - (*b)->lineNo; +} + void XmlResApp::OutputGettext() { - wxArrayString str = FindStrings(); + int lineNo; + ArrayOfStringWithLineNumber str = FindStrings(); wxFFile fout; if (parOutput.empty()) @@ -817,17 +834,27 @@ else fout.Open(parOutput, wxT("wt")); + str.Sort(StringWithLineNumberCmp); + + lineNo = 1; for (size_t i = 0; i < str.GetCount(); i++) - fout.Write("_(\"" + str[i] + "\");\n"); + { + while(lineNo < str[i].lineNo) + { + fout.Write("\n"); + lineNo++; + } + fout.Write("_(\"" + str[i].str + "\"); "); + } if (!parOutput) fout.Detach(); } -wxArrayString XmlResApp::FindStrings() +ArrayOfStringWithLineNumber XmlResApp::FindStrings() { - wxArrayString arr, a2; + ArrayOfStringWithLineNumber arr, a2; for (size_t i = 0; i < parFiles.GetCount(); i++) { @@ -888,9 +915,9 @@ } -wxArrayString XmlResApp::FindStrings(wxXmlNode *node) +ArrayOfStringWithLineNumber XmlResApp::FindStrings(wxXmlNode *node) { - wxArrayString arr; + ArrayOfStringWithLineNumber arr; wxXmlNode *n = node; if (n == NULL) return arr; @@ -919,14 +946,17 @@ if (!flagGettext || node->GetAttribute(_T("translate"), _T("1")) != _T("0")) { - arr.Add(ConvertText(n->GetContent())); + StringWithLineNumber *s = new StringWithLineNumber(); + s->str = ConvertText(n->GetContent()); + s->lineNo = n->GetLineNumber(); + arr.Add(s); } } // subnodes: if (n->GetType() == wxXML_ELEMENT_NODE) { - wxArrayString a2 = FindStrings(n); + ArrayOfStringWithLineNumber a2 = FindStrings(n); WX_APPEND_ARRAY(arr, a2); }
Jyrki Wahlstedt wrote: > On 26.9.2007, at 14.26, Heikki Linnakangas wrote: >> Finnish texts do tend to more longer than English. It's not a problem in >> most places, but for example "Rename" in the favourites manager is >> translated to "Nimeä uudelleen", which is quite a bit longer. If we just >> made the space reserved for the button bigger, it would look quite silly >> in English I think. But as it is, the button is partly underneath the >> "Remove" button. > > That translation is a literal one. If something has a name already, > "Nimeä" could be enough, it means then rename?! I suppose. "Nimeä" means "name", as in "give name", which isn't quite the same as "rename". Or "Vaihda nimi" ("Change name"). That might fit. Alternatively, we could split the words "Nimeä uudelleen" to two lines. That way the button expands downwards, which makes it bigger than the other buttons and it looks a bit funny. But at least the buttons wouldn't be on top of each other. > This is a suggestion > only, and the problem remains, some translations are bound to be > longish, in the user interface controls that will be difficult. Yeah :(. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Dave Page wrote: > Heikki Linnakangas wrote: >> There's some strings in calls to wxLogDebug, like "OnTargetComplete() >> called", that are wrapped in _() for translation. Aren't those just for >> developers, and therefore a waste of time to translate? > > Yep. Removed. Here's a few more, though I must admit that translating "Someone created a new line ending style! Run, run for your lives!!" would be much more fun than the run-of-the-mill strings ;-). I also added a XXX-comment to a suspicious piece of code in sysLogger.cpp. It's comparing to a string that's marked for translation, that's apparently coming from the operating system. You might want to change it to a non-translated string or something. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com Index: pgadmin/debugger/dlgDirectDbg.cpp =================================================================== --- pgadmin/debugger/dlgDirectDbg.cpp (revision 6673) +++ pgadmin/debugger/dlgDirectDbg.cpp (working copy) @@ -137,7 +137,7 @@ dbgBreakPointList::Node * node = m_breakpoints.GetFirst(); - wxASSERT_MSG( node != NULL, _( "Expected to find at least one target on the command line" )); + wxASSERT_MSG( node != NULL, wxT( "Expected to find at least one target on the command line" )); dbgBreakPoint * breakpoint = node->GetData(); @@ -153,7 +153,7 @@ case dbgBreakPoint::OID: targetType = 'o'; break; default: { - wxASSERT_MSG( false, _( "Unexpected target type" )); + wxASSERT_MSG( false, wxT( "Unexpected target type" )); break; } } Index: pgadmin/frm/frmQuery.cpp =================================================================== --- pgadmin/frm/frmQuery.cpp (revision 6673) +++ pgadmin/frm/frmQuery.cpp (working copy) @@ -1352,7 +1352,7 @@ break; default: - wxLogError(_("Someone created a new line ending style! Run, run for your lives!!")); + wxLogError(wxT("Someone created a new line ending style! Run, run for your lives!!")); } delete reCRLF; @@ -1396,7 +1396,7 @@ break; default: - wxLogError(_("Someone created a new line ending style! Run, run for your lives!!")); + wxLogError(wxT("Someone created a new line ending style! Run, run for your lives!!")); } if (!changed) Index: pgadmin/utils/sysLogger.cpp =================================================================== --- pgadmin/utils/sysLogger.cpp (revision 6673) +++ pgadmin/utils/sysLogger.cpp (working copy) @@ -207,8 +207,11 @@ #ifdef __WXMAC__ // This one crops up on the Mac and originates from the logging code // for no obviously apparent reason. + + // XXX: Does this need to be translated? What if the OS is running in + // a different language? if (msg.Contains(_("can't flush file descriptor"))) return true; #endif return false; -} \ No newline at end of file +}
Heikki Linnakangas wrote: > Dave Page wrote: >> Heikki Linnakangas wrote: >>> There's some strings in calls to wxLogDebug, like "OnTargetComplete() >>> called", that are wrapped in _() for translation. Aren't those just for >>> developers, and therefore a waste of time to translate? >> Yep. Removed. > > Here's a few more, though I must admit that translating "Someone created > a new line ending style! Run, run for your lives!!" would be much more > fun than the run-of-the-mill strings ;-). Committed that bit. > I also added a XXX-comment to a suspicious piece of code in > sysLogger.cpp. It's comparing to a string that's marked for translation, > that's apparently coming from the operating system. You might want to > change it to a non-translated string or something. > But not that bit. Thanks, Dave.
Heikki Linnakangas wrote: > Dave Page wrote: >> I'd be more interested in the patches so I can update my utilities and >> those of developer.pgadmin.org where stringextract tends to be run (I >> imagine Guillaume would like a copy too). > > Ok. Here's two patches to enable that: > > wx-linenumbers-in-wxrc-1.patch (against wxWidgets SVN trunk) modifies > wxrc to output additional empty lines, so that the line numbers of the > strings in the gettext output match corresponding lines in the source > file. A bit hacky, but it works. I had to modify wxXml code to keep the > line numbers in the wxXmlNode-objects it constructs from the XML document. As discussed, I haven't installed this on developer.pgadmin.org because it touches the wxXml classes as well as wxrc. > pgadmin-stringextract-keep-filenames-1.patch modifies stringextract so > that it runs wxrc and xgettext separately on each xrc file, to get the > correct filename in the pot file. BTW, this patch alone is beneficial; > you get the correct filenames though the line numbers are bogus without > the wxrc patch. I'm not sure how the xargs-magic works on windows... > I have committed that - thanks. /D
Dave Page wrote: > Heikki Linnakangas wrote: >> Dave Page wrote: >>> I'd be more interested in the patches so I can update my utilities and >>> those of developer.pgadmin.org where stringextract tends to be run (I >>> imagine Guillaume would like a copy too). >> Ok. Here's two patches to enable that: >> >> wx-linenumbers-in-wxrc-1.patch (against wxWidgets SVN trunk) modifies >> wxrc to output additional empty lines, so that the line numbers of the >> strings in the gettext output match corresponding lines in the source >> file. A bit hacky, but it works. I had to modify wxXml code to keep the >> line numbers in the wxXmlNode-objects it constructs from the XML document. > > As discussed, I haven't installed this on developer.pgadmin.org because > it touches the wxXml classes as well as wxrc. Ok. I submitted the wx patch to the wxWidgets patch tracker: https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1803492&group_id=9863 We'll see how that goes... -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Heikki Linnakangas wrote: > Dave Page wrote: >> Heikki Linnakangas wrote: >>> Dave Page wrote: >>>> I'd be more interested in the patches so I can update my utilities and >>>> those of developer.pgadmin.org where stringextract tends to be run (I >>>> imagine Guillaume would like a copy too). >>> Ok. Here's two patches to enable that: >>> >>> wx-linenumbers-in-wxrc-1.patch (against wxWidgets SVN trunk) modifies >>> wxrc to output additional empty lines, so that the line numbers of the >>> strings in the gettext output match corresponding lines in the source >>> file. A bit hacky, but it works. I had to modify wxXml code to keep the >>> line numbers in the wxXmlNode-objects it constructs from the XML document. >> As discussed, I haven't installed this on developer.pgadmin.org because >> it touches the wxXml classes as well as wxrc. > > Ok. I submitted the wx patch to the wxWidgets patch tracker: > > https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1803492&group_id=9863 > > We'll see how that goes... It was committed to wxWidgets, with some modifications. Nice. It turns out that the changes to stringextract were in fact not necessary, since Vaclav Slavik found out a way to include the filename of the original file in the wxrc output. It won't hurt, though, and it'll still be helpful when using an older version of wxrc that doesn't include the patch yet. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Heikki Linnakangas wrote: >> Ok. I submitted the wx patch to the wxWidgets patch tracker: >> >> https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1803492&group_id=9863 >> >> We'll see how that goes... > > It was committed to wxWidgets, with some modifications. Nice. > > It turns out that the changes to stringextract were in fact not > necessary, since Vaclav Slavik found out a way to include the filename > of the original file in the wxrc output. It won't hurt, though, and > it'll still be helpful when using an older version of wxrc that doesn't > include the patch yet. Nice work. Welcome to the joy that is wxWidgets hacking :-) /D
Heikki Linnakangas wrote: > Euler Taveira de Oliveira wrote: >> Heikki Linnakangas wrote: >>> Attached is a patch to change a few string constructions to be more >>> localization-friendly. There's still a lot of troublesome constructs >> where is the patch? > > Oh crap. Here.. :-) Thanks Heikki, patch applied. /D