[bug #17269] localized headers in .mc/history

2006-09-13 Thread Pavel Tsekov

Follow-up Comment #3, bug #17269 (project mc):

I looked at that problem and the solution is pretty easy. Still I'd like to
discuss the issue with anyone interested so we can find the best way to solve
the problem.

Most of the problematic entries are created by an invocation of the function
nice_cd() located in src/cmd.c . Its first argument is a string to be used as
the heading of the dialog. The same string is also used to form the name of
the section in the history file where entries fed to the input field of the
dialog will be stored. A typical call to nice_cd() looks like this:

  nice_cd (_(Title string), ...)

So as you can see nice_cd() is passed a translated string - this is why a
translated section name is written to the history file. However this is
unnecessary since later the title string is translated one more time when
quick_dialog() is invoked to show the dialog. So, one way to solve the
problem is to change nice_cd() invocations like this:

  nice_cd (N_(Title string), ...)

However, this may not be the best solution since the programmer must know
that it should call nice_cd () with N_() instead of _(). So, maybe a better
way to solve the problem would be to add
a new argument to nice_cd() which will hold the history section name.

Any thoughts ?


___

Reply to this item at:

  http://savannah.gnu.org/bugs/?17269

___
  Message sent via/by Savannah
  http://savannah.gnu.org/

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


[bug #17269] localized headers in .mc/history

2006-09-13 Thread Egmont Koblinger

Follow-up Comment #4, bug #17269 (project mc):

Localizing an already localized string definitely shows wrong design.
Theoretically it can lead to false strings appearing on the screen (if the
first translated string happens to be the same as an English string used
somewhere else in mc). It's quite unlikely for this bug to ever occur, but
still it's better to avoid it by good design. It'd be bad if the person first
hitting this bug would have to choose different wording or if he had to fix mc
in this respect.

(Theoretically :-)) each function has a documented interface of what the
meaning of its arguments are, and this documentation should state for all
strings whether they are localized or not.

You say: this may not be the best solution since the programmer must know
that it should call nice_cd () with N_() instead of _(). I think this
approach is wrong. Every programmer wishing to use an already implemented
function should first check the docs or the comments in the code to see what
this function expects and then use it accordingly. If there's no docs stating
whether the argument to nice_cd should be localized or not then _this_ is a
bug in mc. If there are docs, however, then there's nothing you can do
against wrong usage and it's not your problem anymore.

(BTW it starts resembling the usually-misunderstood Hungarian notation by
Simonyi, see:
http://www.joelonsoftware.com/articles/Wrong.html
for the right explanation. If strings are always stored in variables whose
name begins with a prefix stating whether it's already localized, to be
localized, or non-translateable, then these kinds of bugs are less likely to
occur.)

About your first suggestion: it avoids translating an already translated
string, hence it should really be done.

About your second suggestion: it could make the config file look the same
even if for some reason the English UI string is modified. Hence it is a nice
move, too.

So, I recommend making both changes :-)


___

Reply to this item at:

  http://savannah.gnu.org/bugs/?17269

___
  Message sent via/by Savannah
  http://savannah.gnu.org/

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


[bug #17269] localized headers in .mc/history

2006-09-13 Thread Pavel Tsekov

Follow-up Comment #5, bug #17269 (project mc):

My last comment may be slightly misleading. To clarify:

  nice_cd() and others use fg_input_dialog_help() which takes
  care of displaying the input dialog and derives history file
  section names from the input dialog heading.


___

Reply to this item at:

  http://savannah.gnu.org/bugs/?17269

___
  Message sent via/by Savannah
  http://savannah.gnu.org/

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


[bug #17269] localized headers in .mc/history

2006-09-13 Thread Pavel Tsekov

Follow-up Comment #6, bug #17269 (project mc):

I think I'll proceed as following:


1) Currently fg_input_dialog_help() assumes that it is passed translated
strings. I won't change that because some of the callers pass as an argument
a string which is the result of sprintf() on translated template string.
However, I'll change
fg_input_dialog_help() to prevent the translation of the already translated
strings. Additionally I'll add comments to indicate that
fg_input_dialog_help() and any wrappers must take translated strings.

2) Next I'll change fg_input_dialog_help() to take a new argument
- the history section name. Then I will adjust all callers.


___

Reply to this item at:

  http://savannah.gnu.org/bugs/?17269

___
  Message sent via/by Savannah
  http://savannah.gnu.org/

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel