Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: Minor translation patch for citydialog
Home

[Freeciv-Dev] Re: Minor translation patch for citydialog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Pieter J. Kersten" <kersten@xxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Minor translation patch for citydialog
From: Mike Kaufman <mkaufman@xxxxxxxxxxxxxx>
Date: Fri, 2 Nov 2001 14:57:52 -0600

On Fri, Nov 02, 2001 at 04:13:10PM +0100, Pieter J. Kersten wrote:
> >
> > well, I read the help on the subject (which may not be accurate), and it
> > says that the Oracle merely doubles the effect of temples, so it
> > wouldn't act like a temple if there isn't one in the city.
> >
> 
> So should it be mentioned in any place or not?

it'll be mentioned in the "wonders" category, if this is actually your
question...

> See my comment in the source on this hack. I think there remains some work
> to do.

see below.

> Index: happiness.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/happiness.c,v
> retrieving revision 1.1
> diff -u -r1.1 happiness.c
> --- happiness.c       2001/10/26 08:07:11     1.1
> +++ happiness.c       2001/11/02 15:08:21
> @@ -15,6 +15,7 @@
>  #endif
>  
>  #include <gtk/gtk.h>
> +#include <string.h>
>  
>  #include "city.h"
>  #include "fcintl.h"
> @@ -383,43 +384,38 @@
>    char buf[512], *bptr = buf;
>    int nleft = sizeof(buf);
>    struct city *pcity = pdialog->pcity;
> +  int wonders[] = { B_HANGING, B_MICHELANGELO, B_BACH, B_SHAKESPEARE, 
> B_CURE, -1 };
> +  int wonder;
> +  int firsttime = 1;
>  
>    my_snprintf(bptr, nleft, _("Wonders: "));
>    bptr = end_of_strn(bptr, &nleft);
>  
> -  if (city_affected_by_wonder(pcity, B_HANGING)) {
> -    faces++;
> -    my_snprintf(bptr, nleft, get_improvement_name(B_HANGING));
> -    bptr = end_of_strn(bptr, &nleft);
> -    my_snprintf(bptr, nleft, _(". "));
> -    bptr = end_of_strn(bptr, &nleft);
> -  }
> -  if (city_affected_by_wonder(pcity, B_BACH)) {
> -    faces++;
> -    my_snprintf(bptr, nleft, get_improvement_name(B_BACH));
> -    bptr = end_of_strn(bptr, &nleft);
> -    my_snprintf(bptr, nleft, _(". "));
> -    bptr = end_of_strn(bptr, &nleft);
> -  }
> -  /* hack for eliminating gtk_set_line_wrap() -mck */
> -  if (faces > 1) {
> -    /* sizeof("Wonders: ") */
> -    my_snprintf(bptr, nleft, _("\n              "));
> -    bptr = end_of_strn(bptr, &nleft);
> -  }
> -  if (city_affected_by_wonder(pcity, B_SHAKESPEARE)) {
> -    faces++;
> -    my_snprintf(bptr, nleft, get_improvement_name(B_SHAKESPEARE));
> -    bptr = end_of_strn(bptr, &nleft);
> -    my_snprintf(bptr, nleft, _(". "));
> -    bptr = end_of_strn(bptr, &nleft);
> -  }
> -  if (city_affected_by_wonder(pcity, B_CURE)) {
> -    faces++;
> -    my_snprintf(bptr, nleft, get_improvement_name(B_CURE));
> -    bptr = end_of_strn(bptr, &nleft);
> -    my_snprintf(bptr, nleft, _(". "));
> -    bptr = end_of_strn(bptr, &nleft);
> +  for (wonder = 0; wonders[wonder] > 0; wonder++) {
> +    if (city_affected_by_wonder(pcity, wonders[wonder])) {
> +      faces++;
> +      my_snprintf(bptr, nleft, get_improvement_name(wonders[wonder]));
> +      bptr = end_of_strn(bptr, &nleft);
> +      my_snprintf(bptr, nleft, _(". "));
> +      bptr = end_of_strn(bptr, &nleft);
> +      /* hack for eliminating gtk_set_line_wrap() -mck */
> +      if (firsttime && faces > 1) {
> +        /* sizeof("Wonders: ") */
> +        /* This hack is a bitch, as the GTK interface uses a proportional 
> font
> +         * which will clearly not line out nicely with spaces.
> +         * Nevertheless, supposing it works as designed, it should use the
> +         * translated string, so here it is. The trailing spaces are 
> obviously 
> +         * empirical and only reflect the original coding.
> +         * TODO: change this to a method which does not suffer from font
> +         *       characteristics.
> +         * -pjk
> +         */
> +        int length = strlen(_("Wonders: "));
> +        my_snprintf(bptr, nleft, "\n%*.*s     ", length, length, "");

why the extra spaces after 's'? The point of this was to make the
wonders line up after the linebreak, does this do that?

if this does work as advertised, the same thing,

    int length = strlen(_("Buildings: "));
    my_snprintf(bptr, nleft, "\n%*.*s     ", length, length, "");

should go above in happiness_dialog_update_buildings(), and obviously
the comment should be above instead. (I'm not sure how you'd put that
stuff in a useful (code-cutting) loop... though)

otherwise, looks ok.

-mike

> +        bptr = end_of_strn(bptr, &nleft);
> +        firsttime = 0;
> +      }
> +    }
>    }
>  
>    if (faces == 0) {



[Prev in Thread] Current Thread [Next in Thread]