Re: [Freeciv-Dev] (PR#39638) Non i18n'd string in client/helpdata.c

2007-09-01 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

On 01/09/2007, Marko Lindqvist  wrote

 On 31/08/2007, Joan Creus  wrote:
 
  Anyway, implementing an
  and-list and an or-list shouldn't be too hard, and it pays off with more
  natural sentences.

  Attached patch does that. It also makes help a bit more complete and
 fixes some logical errors.

 TRUNK version.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c	2007-08-31 11:51:59.0 +0300
+++ freeciv/client/helpdata.c	2007-09-01 11:35:54.0 +0300
@@ -1249,27 +1249,112 @@
   effect_list_iterate(get_req_source_effects(source), peffect) {
 Output_type_id output_type = O_LAST;
 struct unit_class *unitclass = NULL;
+struct unit_type *unittype = NULL;
 enum unit_flag_id unitflag = F_LAST;
-const char *output = All;
+struct astring outputs_or = ASTRING_INIT;
+struct astring outputs_and = ASTRING_INIT;
+bool extra_reqs = FALSE;
+
+astr_clear(outputs_or);
+astr_clear(outputs_and);
 
 /* Grab output type, if there is one */
 requirement_list_iterate(peffect-reqs, preq) {
   switch (preq-source.kind) {
-  case VUT_OTYPE:
-output_type = preq-source.value.outputtype;
-output = get_output_name(output_type);
-break;
-  case VUT_UCLASS:
-unitclass = preq-source.value.uclass;
-break;
-  case VUT_UTFLAG:
-unitflag = preq-source.value.unitflag;
-break;
-  default:
-break;
+   case VUT_OTYPE:
+ if (output_type == O_LAST) {
+   /* We should never have multiple outputtype requirements
+* in one list in the first place (it simply makes no sense,
+* output cannot be of multiple types)
+* Ruleset loading code should check against that. */
+   const char *oname;
+   
+   output_type = preq-source.value.outputtype;
+   oname = get_output_name(output_type);
+   astr_add(outputs_or, oname);
+   astr_add(outputs_and, oname);
+ }
+ break;
+   case VUT_UCLASS:
+ if (unitclass == NULL) {
+   unitclass = preq-source.value.uclass;
+ }
+ break;
+   case VUT_UTYPE:
+ if (unittype == NULL) {
+   unittype = preq-source.value.utype;
+ }
+ break;
+   case VUT_UTFLAG:
+ if (unitflag == F_LAST) {
+   /* FIXME: We should list all the unit flag requirements,
+*not only first one. */
+   unitflag = preq-source.value.unitflag;
+ }
+ break;
+   case VUT_GOVERNMENT:
+ /* This is government we are generating helptext for.
+  * ...or if not, it's ruleset bug that should never make it
+  * this far. Fix ruleset loading code. */
+ break;
+   default:
+ extra_reqs = TRUE;
+ break;
   };
 } requirement_list_iterate_end;
 
+if (!extra_reqs) {
+  /* Only list effects that have no special requirements. */
+ 
+  if (output_type == O_LAST) {
+/* There was no outputtype requirement. Effect is active for all
+ * output types. Generate lists for that. */
+const char *prev  = NULL;
+const char *prev2 = NULL;
+bool harvested_only = TRUE; /* Consider only output types from fields */
+
+if (peffect-type == EFT_UPKEEP_FACTOR
+|| peffect-type == EFT_UNIT_UPKEEP_FREE_PER_CITY
+|| peffect-type == EFT_OUTPUT_BONUS
+|| peffect-type == EFT_OUTPUT_BONUS_2) {
+  /* Effect can use or require any kind of output */
+  harvested_only = FALSE;
+}
+ 
+output_type_iterate(ot) {
+  struct output_type *pot = get_output_type(ot);
+ 
+  if (!harvested_only || pot-harvested) {
+if (prev2 != NULL) {
+  astr_add(outputs_or,  prev2);
+  astr_add(outputs_or,  , );
+  astr_add(outputs_and, prev2);
+  astr_add(outputs_and, , );
+}
+prev2 = prev;
+prev = _(pot-name);
+  }
+} output_type_iterate_end;
+if (prev2 != NULL) {
+  astr_add(outputs_or, prev2);
+  /* TRANS: List of possible output types has this between
+   *last two elements */
+  astr_add(outputs_or,  Q_(?outputlist: or ));
+  astr_add(outputs_and, prev2);
+  /* TRANS: List of possible output types has this between
+   *last two elements */
+  astr_add(outputs_and, Q_(?outputlist: and ));
+}
+if (prev != NULL) {
+  astr_add(outputs_or, prev);
+  astr_add(outputs_and, prev);
+} else {
+  /* TRANS: Empty output type list, should never happen. */
+  astr_add(outputs_or,  Q_(?outputlist: Nothing ));
+  astr_add(outputs_and, Q_(?outputlist: Nothing ));
+  

Re: [Freeciv-Dev] (PR#39638) Non i18n'd string in client/helpdata.c

2007-08-31 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

On 31/08/2007, Joan Creus [EMAIL PROTECTED] wrote:
 The way I have translated these strings might help. I have adapted the
 sentence to read:

 Each worked tile with at least 1 point of  %s will yield ...

 Then All might become all kinds of output, or any output, or something
 similar, and it would fit in all the sentences Marko has dug up. Of course,
 some translator comments would be essential for us translators to make it
 fit in the sentences.

 Those sentences where it appears twice, are problematic:
... at least 1 point of any output, will yield 2 additional points of
any output
should be
... at least 1 point of any output, will yield 2 additional points of
that output

 And it would be good if we could avoid using such internal concepts
as 'output' in end-user help.

 How about generating list of output types currently in use? That
would turn out something like food, trade or shields.
 and some example sentences (some using that list, some with specific output):

... at least 1 point of 'food, trade or shields', will yield 2
additional points of it.
... at least 1 point of 'food', will yield 2 additional points of it.

 Or do we need two lists? 'or' -list and 'and' -list.

You pay 2 times normal 'food, trade and shields' upkeep for your units.
You pay 2 times normal 'food' upkeep for your units.


 Some sentences should be modified, too; anyway, All production will suffer
 massive waste is misleading, if it refers to both trade and shields
 (perhaps also food?). Maybe just removing production will do the trick:

'food, trade and shields' production will suffer massive waste
'food' production will suffer massive waste


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39638) Non i18n'd string in client/helpdata.c

2007-08-31 Thread Joan Creus

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

The way I have translated these strings might help. I have adapted the
sentence to read:

Each worked tile with at least 1 point of  %s will yield ...

Then All might become all kinds of output, or any output, or something
similar, and it would fit in all the sentences Marko has dug up. Of course,
some translator comments would be essential for us translators to make it
fit in the sentences.

Some sentences should be modified, too; anyway, All production will suffer
massive waste is misleading, if it refers to both trade and shields
(perhaps also food?). Maybe just removing production will do the trick:

each worked tile with at least 1 point of  'any output' will yield...
any output will suffer massive waste
any output waste will increase ...

What do you think?

Joan

2007/8/31, Marko Lindqvist [EMAIL PROTECTED]:


 URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

 On 31/08/2007, Daniel Markstedt [EMAIL PROTECTED] wrote:
 
 
  The sentence produced by this string is awful even in its raw English
 form:
 
   * Each worked tile that gives more than 2 All will suffer a -1
  penalty when not celebrating.
 
  Wouldn't it make more sense to replace 'All' with something like 'of
  any output'?

 ...with some code changes and additional strings. It is currently
 used in sentences:

 Each worked tile that gives more than %d All will suffer a -1
 penalty when not celebrating.
 Each worked tile with at least 1 All will yield %d additional All
 when celebrating.
 Each worked tile with at least 1 All will yield %d additional All.
 All production will suffer massive waste.
 All production will suffer some waste.
 All production will suffer a small amount of waste.
 All waste will increase quickly with distance from capital.
 All waste will increase with distance from capital.
 All waste will increase slowly with distance from capital.

 Following sentences also use 'output', but they should only appear if
 there
 is some real output type (and not with All):
 You pay %d times normal All upkeep for your units.
 Each of your cities will avoid paying %d All towards unit upkeep.


 This help generation function is very broken considering alternative
 rulesets (not only that it lacks information, but it also produces
 misinformation in some cases)


 - ML




The way I have translated these strings might help. I have adapted the sentence to read:

Each worked tile with at least 1point of %s will yield ...
Then All might become all kinds of output, or any output, or something similar, and it would fit in all the sentences Marko has dug up. Of course, some translator comments would be essential for us translators to make it fit in the sentences.


Some sentences should be modified, too; anyway, All production will suffer massive waste is misleading, if it refers to both trade and shields (perhaps also food?). Maybe just removing production will do the trick:


each worked tile with at least 1 point of any outputwill yield...
any output will suffer massive waste
any output waste will increase ...

What do you think?
Joan

2007/8/31, Marko Lindqvist [EMAIL PROTECTED]:
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638
 On 31/08/2007, Daniel Markstedt [EMAIL PROTECTED] wrote: The sentence produced by this string is awful even in its raw English form:
* Each worked tile that gives more than 2 All will suffer a -1 penalty when not celebrating. Wouldnt it make more sense to replace All with something like of
 any output?...with some code changes and additional strings. It is currentlyused in sentences:Each worked tile that gives more than %d All will suffer a -1penalty when not celebrating.
Each worked tile with at least 1 All will yield %d additional Allwhen celebrating.Each worked tile with at least 1 All will yield %d additional All.All production will suffer massive waste.
All production will suffer some waste.All production will suffer a small amount of waste.All waste will increase quickly with distance from capital.
All waste will increase with distance from capital.All waste will increase slowly with distance from capital.Following sentences also use output, but they should only appear if there
is some real output type (and not with All):You pay %d times normal All upkeep for your units.Each of your cities will avoid paying %d All towards unit upkeep.
This help generation function is very broken considering alternativerulesets (not only that it lacks information, but it also producesmisinformation in some cases)- ML

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39638) Non i18n'd string in client/helpdata.c

2007-08-31 Thread Joan Creus

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

2007/8/31, Marko Lindqvist [EMAIL PROTECTED]:


 URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

 On 31/08/2007, Joan Creus [EMAIL PROTECTED] wrote:
  The way I have translated these strings might help. I have adapted the
  sentence to read:
 
  Each worked tile with at least 1 point of  %s will yield ...
 
  Then All might become all kinds of output, or any output, or
 something
  similar, and it would fit in all the sentences Marko has dug up. Of
 course,
  some translator comments would be essential for us translators to make
 it
  fit in the sentences.

 Those sentences where it appears twice, are problematic:
 ... at least 1 point of any output, will yield 2 additional points of
 any output
 should be
 ... at least 1 point of any output, will yield 2 additional points of
 that output

 And it would be good if we could avoid using such internal concepts
 as 'output' in end-user help.

How about generating list of output types currently in use? That
 would turn out something like food, trade or shields.
 and some example sentences (some using that list, some with specific
 output):


You have a point here. After all, this is the help system. The more info we
give, and the less ambiguous, the better. I don't like production (I tend
to think of production as synonymous with shields), and output is only
slightly better. Definitely, listing the three items is best.

... at least 1 point of 'food, trade or shields', will yield 2
 additional points of it.
 ... at least 1 point of 'food', will yield 2 additional points of it.

 Or do we need two lists? 'or' -list and 'and' -list.

 You pay 2 times normal 'food, trade and shields' upkeep for your units.
 You pay 2 times normal 'food' upkeep for your units.


But I thought upkeep was only paid  with  shields, isn't it? Apart for the
food for Settlers, of course. Perhaps your are thinking of alternate
rulesets where upkeep may be paid with everything? Anyway, implementing an
and-list and an or-list shouldn't be too hard, and it pays off with more
natural sentences.


 Some sentences should be modified, too; anyway, All production will
 suffer
  massive waste is misleading, if it refers to both trade and shields
  (perhaps also food?). Maybe just removing production will do the
 trick:

 'food, trade and shields' production will suffer massive waste
 'food' production will suffer massive waste


Yes, this way it gets clear, and the word production fits just fine.

Joan

2007/8/31, Marko Lindqvist [EMAIL PROTECTED]:
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 On 31/08/2007, Joan Creus [EMAIL PROTECTED]
 wrote: The way I have translated these strings might help. I have adapted the sentence to read: Each worked tile with at least 1 point of%s will yield ...
 Then All might become all kinds of output, or any output, or something similar, and it would fit in all the sentences Marko has dug up. Of course, some translator comments would be essential for us translators to make it
 fit in the sentences. Those sentences where it appears twice, are problematic:... at least 1 point of any output, will yield 2 additional points ofany outputshould be... at least 1 point of any output, will yield 2 additional points of
that output And it would be good if we could avoid using such internal conceptsas output in end-user help. 
 How about generating list of output types currently in use? Thatwould turn out something like food, trade or shields. and some example sentences (some using that list, some with specific output):
You have a point here. After all, this is the help system. The more info we give, and the less ambiguous, the better. I dont like production (I tend to think of production as synonymous with shields), and output is only slightly better. Definitely, listing the three items is best.
... at least 1 point of food, trade or shields, will yield 2
additional points of it at least 1 point of food, will yield 2 additional points of it. Or do we need two lists? or -list and and -list.You pay 2 times normal food, trade and shields upkeep for your units.
You pay 2 times normal food upkeep for your units.But I thought upkeep was only paid with shields, isnt it? Apart for the food for Settlers, of course. Perhaps your are thinking of alternate rulesets where upkeep may be paid with everything? Anyway, implementing an and-list and an or-list shouldnt be too hard, and it pays off with more natural sentences.
 Some sentences should be modified, too; anyway, All production will suffer
 massive waste is misleading, if it refers to both trade and shields (perhaps also food?). Maybe just removing production will do the trick:food, trade and shields production will suffer massive waste
food production will suffer massive wasteYes, this way it gets clear, and the word production fits just fine.Joan
___
Freeciv-dev mailing list
Freeciv-dev@gna.org

Re: [Freeciv-Dev] (PR#39638) Non i18n'd string in client/helpdata.c

2007-08-31 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

On 31/08/2007, Joan Creus  wrote:

 Anyway, implementing an
 and-list and an or-list shouldn't be too hard, and it pays off with more
 natural sentences.

 Attached patch does that. It also makes help a bit more complete and
fixes some logical errors.
 - If government is only one of the requirements, do not always list
effect as something government gives. (This should list effect with
requirement list, but until that is implemented it's better not to
claim that despotism gives +75% shield bonus (as that's only true for
city with Palace))

 This is S2_1 version. I had to touch two existing translatable strings.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c	2007-07-04 14:04:27.0 +0300
+++ freeciv/client/helpdata.c	2007-09-01 02:59:53.0 +0300
@@ -1282,21 +1282,112 @@
   effect_list_iterate(get_req_source_effects(source), peffect) {
 Output_type_id output_type = O_LAST;
 struct unit_class *unitclass = NULL;
+struct unit_type *unittype = NULL;
 enum unit_flag_id unitflag = F_LAST;
-const char *output = All;
+struct astring outputs_or = ASTRING_INIT;
+struct astring outputs_and = ASTRING_INIT;
+bool extra_reqs = FALSE;
+
+astr_clear(outputs_or);
+astr_clear(outputs_and);
 
 /* Grab output type, if there is one */
 requirement_list_iterate(peffect-reqs, preq) {
-  if (preq-source.type == REQ_OUTPUTTYPE) {
-output_type = preq-source.value.outputtype;
-output = get_output_name(output_type);
-  } else if (preq-source.type == REQ_UNITCLASS) {
-unitclass = preq-source.value.unitclass;
-  } else if (preq-source.type == REQ_UNITFLAG) {
-unitflag = preq-source.value.unitflag;
+  switch (preq-source.type) {
+   case REQ_OUTPUTTYPE:
+ if (output_type == O_LAST) {
+   /* We should never have multiple outputtype requirements
+* in one list in the first place (it simply makes no sense,
+* output cannot be of multiple types)
+* Ruleset loading code should check against that. */
+   const char *oname;
+
+   output_type = preq-source.value.outputtype;
+   oname = get_output_name(output_type);
+   astr_add(outputs_or, oname);
+  astr_add(outputs_and, oname);
+ }
+ break;
+   case REQ_UNITCLASS:
+ if (unitclass == NULL) {
+   unitclass = preq-source.value.unitclass;
+ }
+ break;
+   case REQ_UNITFLAG:
+ if (unitflag == F_LAST) {
+   /* FIXME: We should list all the unit flag requirements,
+*not only first one. */
+   unitflag = preq-source.value.unitflag;
+ }
+ break;
+   case REQ_UNITTYPE:
+ if (unittype == NULL) {
+   unittype = preq-source.value.unittype;
+ }
+ break;
+   case REQ_GOV:
+ /* This is government we are generating helptext for.
+  * ...or if not, it's ruleset bug that should never make it
+  * this far. Fix ruleset loading code. */
+ break;
+   default:
+ extra_reqs = TRUE;
+ break;
   }
 } requirement_list_iterate_end;
 
+if (!extra_reqs) {
+  /* Only list effects that have no special requirements. */
+
+  if (output_type == O_LAST) {
+/* There was no outputtype requirement. Effect is active for all
+ * output types. Generate lists for that. */
+const char *prev  = NULL;
+const char *prev2 = NULL;
+bool harvested_only = TRUE; /* Consider only output types from fields */
+
+if (peffect-type == EFT_UPKEEP_FACTOR
+|| peffect-type == EFT_UNIT_UPKEEP_FREE_PER_CITY
+|| peffect-type == EFT_OUTPUT_BONUS
+|| peffect-type == EFT_OUTPUT_BONUS_2) {
+  /* Effect can use or require any kind of output */
+  harvested_only = FALSE;
+}
+
+output_type_iterate(ot) {
+  struct output_type *pot = get_output_type(ot);
+
+  if (!harvested_only || pot-harvested) {
+if (prev2 != NULL) {
+  astr_add(outputs_or,  prev2);
+  astr_add(outputs_or,  , );
+  astr_add(outputs_and, prev2);
+  astr_add(outputs_and, , );
+}
+prev2 = prev;
+prev = _(pot-name);
+  }
+} output_type_iterate_end;
+if (prev2 != NULL) {
+  astr_add(outputs_or, prev2);
+  /* TRANS: List of possible output types has this between
+   *last two elements */
+  astr_add(outputs_or,  Q_(?outputlist: or ));
+  astr_add(outputs_and, prev2);
+  /* TRANS: List of possible output types has this between
+   *last two elements */
+  astr_add(outputs_and, Q_(?outputlist: and ));
+}
+if 

[Freeciv-Dev] (PR#39638) Non i18n'd string in client/helpdata.c

2007-08-30 Thread Joan Creus

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

In client/helpdata.c, line 1253 (revision 13433) (within
helptext_government()) the output variable is assigned All, without the _(

   const char *output = All;

As far as I've seen, in the default ruleset, this string only appears on the
help text for both Anarchy and Despotism, where it says that each worked
tile that gives more than %d %s will suffer a -1 penalty when not
celebrating.

It's most obvious in my language, because All means garlic, so the
message becomes something like if a worked tile gives more than 2 garlic
you will get a penalty. Kinda misleading.

I'm not sure if it's just a matter of sticking the _( in front, or there are
more implications in the logic of the program.

Cheers,

Joan

In client/helpdata.c, line 1253 (revision 13433) (within helptext_government()) the output variable is assigned All, without the _( const char *output = All;As far as Ive seen, in the default ruleset, this string only appears on the help text for both Anarchy and Despotism, where it says that each worked tile that gives more than %d %s will suffer a -1 penalty when not celebrating.
Its most obvious in my language, because All means garlic, so the message becomes something like if a worked tile gives more than 2 garlic you will get a penalty. Kinda misleading.
Im not sure if its just a matter of sticking the _( in front, or there are more implications in the logic of the program.Cheers,Joan
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39638) Non i18n'd string in client/helpdata.c

2007-08-30 Thread Daniel Markstedt

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

On 8/31/07, Joan Creus [EMAIL PROTECTED] wrote:

 URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638
 

 In client/helpdata.c, line 1253 (revision 13433) (within
 helptext_government()) the output variable is assigned All, without the _(

const char *output = All;

 As far as I've seen, in the default ruleset, this string only appears on the
 help text for both Anarchy and Despotism, where it says that each worked
 tile that gives more than %d %s will suffer a -1 penalty when not
 celebrating.

 It's most obvious in my language, because All means garlic, so the
 message becomes something like if a worked tile gives more than 2 garlic
 you will get a penalty. Kinda misleading.

 I'm not sure if it's just a matter of sticking the _( in front, or there are
 more implications in the logic of the program.

 Cheers,

 Joan


The sentence produced by this string is awful even in its raw English form:

 * Each worked tile that gives more than 2 All will suffer a -1
penalty when not celebrating.

Wouldn't it make more sense to replace 'All' with something like 'of
any output'?

 ~Daniel



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39638) Non i18n'd string in client/helpdata.c

2007-08-30 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39638 

On 31/08/2007, Daniel Markstedt [EMAIL PROTECTED] wrote:


 The sentence produced by this string is awful even in its raw English form:

  * Each worked tile that gives more than 2 All will suffer a -1
 penalty when not celebrating.

 Wouldn't it make more sense to replace 'All' with something like 'of
 any output'?

 ...with some code changes and additional strings. It is currently
used in sentences:

Each worked tile that gives more than %d All will suffer a -1
penalty when not celebrating.
Each worked tile with at least 1 All will yield %d additional All
when celebrating.
Each worked tile with at least 1 All will yield %d additional All.
All production will suffer massive waste.
All production will suffer some waste.
All production will suffer a small amount of waste.
All waste will increase quickly with distance from capital.
All waste will increase with distance from capital.
All waste will increase slowly with distance from capital.

Following sentences also use 'output', but they should only appear if there
is some real output type (and not with All):
You pay %d times normal All upkeep for your units.
Each of your cities will avoid paying %d All towards unit upkeep.


 This help generation function is very broken considering alternative
rulesets (not only that it lacks information, but it also produces
misinformation in some cases)


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev