[Freeciv-Dev] PATCH: Language fixes
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
the A/An-routine (n_if_vowel) is not very clever according to the comment
and also impossible and disturbing for translation. Here is a fix to that
problem.
- The function is removed totally.
- The strings has been changed to remove the need for the function.
The strings may no longer sound 100% perfect but they aren't anyway. I
removed A/An from some strings without other changes if it the result
sounds well. I cases where impossible I changed the strings to sound better.
I think it should be better localizable without affecting the english
language much. It should remove the need to skip arguments in result
strings (which is not very good, because the argument size is unknown then
and the sprintf function may get in trouble).
I included gzip and plain version of patch to check it.
Additionally made some optimizations to code (removed useless variables,
assignments). I triple checked them, so they are ok (also the compiler
thinks so :-)
Ciao
____ _ _ ____ _ _ _ _ ____
| | | | | | \ / | | | the cool Gremlin from Bischofswerda
| __ | ____| | \/ | | | WWW: http://home.pages.de/~stoecker/
| | | | | | | | PGP key available on www page.
|____| _|_ |____| _|_ _|_ |____| I hope AMIGA never ends to make fun!
diff -ur ../../freeciv-cvs/freeciv/client/helpdata.c ./client/helpdata.c
--- ../../freeciv-cvs/freeciv/client/helpdata.c Sun Aug 27 17:48:22 2000
+++ ./client/helpdata.c Mon Aug 28 18:54:31 2000
@@ -183,7 +183,7 @@
struct section_file file, *sf = &file;
char *filename;
- struct help_item *pitem = NULL;
+ struct help_item *pitem;
int i, isec;
char **sec, **paras;
int nsec, npara;
@@ -221,15 +221,14 @@
for(isec=0; isec<nsec; isec++) {
- enum help_page_type current_type = HELP_ANY;
char *gen_str =
secfile_lookup_str_default(sf, NULL, "%s.generate", sec[isec]);
if (gen_str) {
+ enum help_page_type current_type = HELP_ANY;
if (!booted) {
continue; /* on initial boot data tables are empty */
}
- current_type = HELP_ANY;
for(i=2; help_type_names[i]; i++) {
if(strcmp(gen_str, help_type_names[i])==0) {
current_type = i;
@@ -513,9 +512,8 @@
if(improvement_exists(B_SEWER)) {
char *s = improvement_types[B_SEWER].name;
sprintf(buf+strlen(buf),
- _("(A%s %s is also required for a city to grow larger"
- " than size %d.) "),
- n_if_vowel(*s), s, game.sewer_size);
+ _("(%s is also required for a city to grow larger"
+ " than size %d.) "), s, game.sewer_size);
}
strcat(buf,"\n");
}
@@ -849,7 +847,7 @@
}
if (utype->gold_cost) {
sprintf(buf+strlen(buf), _("%s%d gold"),
- (any++ ? ", " : ""), utype->gold_cost);
+ (any ? ", " : ""), utype->gold_cost);
}
} else {
/* strcpy(buf, _("None")); */
@@ -885,7 +883,7 @@
}
if (utype->gold_cost) {
sprintf(buf+strlen(buf), /*g=gold*/ _("%s%dg"),
- (any++ ? "/" : ""), utype->gold_cost);
+ (any ? "/" : ""), utype->gold_cost);
}
} else {
sprintf(buf, "%d", 0);
diff -ur ../../freeciv-cvs/freeciv/common/shared.c ./common/shared.c
--- ../../freeciv-cvs/freeciv/common/shared.c Sun Aug 27 17:48:52 2000
+++ ./common/shared.c Mon Aug 28 18:23:53 2000
@@ -54,20 +54,6 @@
static char *grouping_sep = ",";
static size_t grouping_sep_len = 1;
-
-/**************************************************************************
- FIXME: This is an inelegant, English-specific kludge that fails to
- work correctly even in the limited case of English, e.g. "An hour".
- It should be put to sleep in favour of a more general solution.
-**************************************************************************/
-char *n_if_vowel(char ch)
-{
- if (strchr("AEIOUaeiou",ch))
- return "n";
- else
- return "";
-}
-
/***************************************************************
Take a string containing multiple lines and create a copy where
each line is padded to the length of the longest line and centered.
diff -ur ../../freeciv-cvs/freeciv/common/shared.h ./common/shared.h
--- ../../freeciv-cvs/freeciv/common/shared.h Sun Aug 27 17:48:49 2000
+++ ./common/shared.h Mon Aug 28 18:24:06 2000
@@ -57,7 +57,6 @@
/* This is duplicated in rand.h to avoid extra includes: */
#define MAX_UINT32 0xFFFFFFFF
-char *n_if_vowel(char ch);
char *create_centered_string(char *s);
char * get_option(const char *option_name,char **argv,int *i,int argc);
diff -ur ../../freeciv-cvs/freeciv/server/stdinhand.c ./server/stdinhand.c
--- ../../freeciv-cvs/freeciv/server/stdinhand.c Sun Aug 27 17:49:15 2000
+++ ./server/stdinhand.c Sun Aug 27 19:14:09 2000
@@ -37,6 +37,7 @@
#include "registry.h"
#include "shared.h"
#include "support.h"
+#include "version.h"
#include "console.h"
#include "gamehand.h"
diff -ur ../../freeciv-cvs/freeciv/server/unitfunc.c ./server/unitfunc.c
--- ../../freeciv-cvs/freeciv/server/unitfunc.c Sun Aug 27 17:49:14 2000
+++ ./server/unitfunc.c Mon Aug 28 18:44:11 2000
@@ -670,12 +670,9 @@
unit_name (pdiplomat->type),
pplayer->future_tech, cplayer->name);
notify_player_ex (cplayer, pcity->x, pcity->y, E_DIPLOMATED,
- _("Game: A%s %s %s stole Future Tech. %d"
- " from %s."),
- n_if_vowel (get_nation_name (pplayer->nation)[0]),
- get_nation_name (pplayer->nation),
- unit_name (pdiplomat->type),
- pplayer->future_tech, pcity->name);
+ _("Game: Future Tech. %d stolen by %s %s from %s."),
+ pplayer->future_tech, get_nation_name (pplayer->nation),
+ unit_name (pdiplomat->type), pcity->name);
gamelog (GAMELOG_TECH, "%s steals Future Tech. %d from the %s",
get_nation_name_plural (pplayer->nation),
pplayer->future_tech,
@@ -805,9 +802,8 @@
" of inciting a revolt!"),
unit_name (pdiplomat->type));
notify_player_ex (cplayer, pcity->x, pcity->y, E_DIPLOMATED,
- _("Game: You caught a%s %s %s attempting"
+ _("Game: You caught %s %s attempting"
" to incite a revolt in %s!"),
- n_if_vowel (get_nation_name (pplayer->nation)[0]),
get_nation_name (pplayer->nation),
unit_name (pdiplomat->type), pcity->name);
wipe_unit (pdiplomat);
@@ -910,9 +906,8 @@
" of industrial sabotage!"),
unit_name (pdiplomat->type));
notify_player_ex (cplayer, pcity->x, pcity->y, E_DIPLOMATED,
- _("Game: You caught a%s %s %s attempting"
+ _("Game: You caught %s %s attempting"
" sabotage in %s!"),
- n_if_vowel (get_nation_name (pplayer->nation)[0]),
get_nation_name (pplayer->nation),
unit_name (pdiplomat->type), pcity->name);
wipe_unit (pdiplomat);
@@ -1047,9 +1042,8 @@
" of sabotage!"),
unit_name (pdiplomat->type));
notify_player_ex (cplayer, pcity->x, pcity->y, E_DIPLOMATED,
- _("Game: You caught a%s %s %s attempting"
+ _("Game: You caught %s %s attempting"
" to sabotage the %s in %s!"),
- n_if_vowel (get_nation_name (pplayer->nation)[0]),
get_nation_name (pplayer->nation),
unit_name (pdiplomat->type),
get_improvement_name (improvement), pcity->name);
@@ -1164,9 +1158,7 @@
unit_name (punit->type),
pcity->name);
notify_player_ex (cplayer, pcity->x, pcity->y, E_DIPLOMATED,
- _("Game: A%s %s %s was eliminated"
- " while infiltrating %s."),
- n_if_vowel (get_nation_name (pplayer->nation)[0]),
+ _("Game: Eliminated %s %s while infiltrating %s."),
get_nation_name (pplayer->nation),
unit_name (pdiplomat->type),
pcity->name);
@@ -1258,8 +1250,8 @@
static void maybe_cause_incident(enum diplomat_actions action, struct player
*offender,
struct unit *victim_unit, struct city
*victim_city)
{
- struct player *victim_player;
- int x,y;
+ struct player *victim_player = 0;
+ int x = 0, y = 0;
if (victim_city) {
x = victim_city->x;
y = victim_city->y;
@@ -1460,7 +1452,7 @@
improvement_types[B_LEONARDO].name,
get_unit_type(punit->type)->name,
get_unit_type(upgrade_type)->name,
- get_location_str_in(pplayer, punit->x, punit->y, ", "));
+ get_location_str_in(pplayer, punit->x, punit->y));
punit->veteran = 0;
upgrade_unit(punit,upgrade_type);
leonardo = leonardo_variant;
@@ -2804,13 +2796,11 @@
ITERATOR_NEXT((*iter));
}
notify_player_ex(get_player(playerid), x, y, E_UNIT_LOST,
- _("Game: You lost a%s %s when %s lost."),
- n_if_vowel(get_unit_type(pcargo->type)->name[0]),
+ _("Game: You lost %s when %s lost."),
get_unit_type(pcargo->type)->name,
get_unit_type(punit->type)->name);
- gamelog(GAMELOG_UNITL, "%s lose a%s %s when %s lost",
+ gamelog(GAMELOG_UNITL, "%s lose %s when %s lost",
get_nation_name_plural(game.players[playerid].nation),
- n_if_vowel(get_unit_type(pcargo->type)->name[0]),
get_unit_type(pcargo->type)->name,
get_unit_type(punit->type)->name);
server_remove_unit(pcargo);
@@ -2848,7 +2838,7 @@
struct city *incity = map_get_city(punit->x, punit->y);
struct player *pplayer = get_player(punit->owner);
struct player *destroyer = get_player(pkiller->owner);
- char *loc_str = get_location_str_in(pplayer, punit->x, punit->y, ", ");
+ char *loc_str = get_location_str_in(pplayer, punit->x, punit->y);
int num_killed[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
int ransom, unitcount = 0;
@@ -2878,13 +2868,11 @@
(map_get_special(punit->x, punit->y)&S_AIRBASE) ||
unitcount == 1) {
notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST,
- _("Game: You lost a%s %s under an attack from %s's %s%s."),
- n_if_vowel(get_unit_type(punit->type)->name[0]),
+ _("Game: You lost %s under an attack from %s's %s%s."),
get_unit_type(punit->type)->name, destroyer->name,
unit_name(pkiller->type), loc_str);
- gamelog(GAMELOG_UNITL, "%s lose a%s %s to the %s",
+ gamelog(GAMELOG_UNITL, "%s lose %s to the %s",
get_nation_name_plural(pplayer->nation),
- n_if_vowel(get_unit_type(punit->type)->name[0]),
get_unit_type(punit->type)->name,
get_nation_name_plural(destroyer->nation));
@@ -2922,14 +2910,12 @@
if (players_at_war(pkiller->owner, punit2->owner)) {
notify_player_ex(unit_owner(punit2),
punit2->x, punit2->y, E_UNIT_LOST,
- _("Game: You lost a%s %s under an attack"
+ _("Game: You lost %s under an attack"
" from %s's %s."),
- n_if_vowel(get_unit_type(punit2->type)->name[0]),
get_unit_type(punit2->type)->name, destroyer->name,
unit_name(pkiller->type));
- gamelog(GAMELOG_UNITL, "%s lose a%s %s to the %s",
+ gamelog(GAMELOG_UNITL, "%s lose %s to the %s",
get_nation_name_plural(get_player(punit2->owner)->nation),
- n_if_vowel(get_unit_type(punit2->type)->name[0]),
get_unit_type(punit2->type)->name,
get_nation_name_plural(destroyer->nation));
wipe_unit_spec_safe(punit2, NULL, 0);
@@ -2995,8 +2981,7 @@
for adding space/punctuation between rest of message and location string.
Don't call this function directly; use the wrappers below.
**************************************************************************/
-static char *get_location_str(struct player *pplayer, int x, int y,
- char *prefix, int use_at)
+static char *get_location_str(struct player *pplayer, int x, int y, int use_at)
{
static char buffer[MAX_LEN_NAME+64];
struct city *incity, *nearcity;
@@ -3004,19 +2989,19 @@
incity = map_get_city(x, y);
if (incity) {
if (use_at) {
- my_snprintf(buffer, sizeof(buffer), _("%sat %s"), prefix, incity->name);
+ my_snprintf(buffer, sizeof(buffer), _(" at %s"), incity->name);
} else {
- my_snprintf(buffer, sizeof(buffer), _("%sin %s"), prefix, incity->name);
+ my_snprintf(buffer, sizeof(buffer), _(" in %s"), incity->name);
}
} else {
nearcity = dist_nearest_city(pplayer, x, y, 0, 0);
if (nearcity) {
if (is_tiles_adjacent(x, y, nearcity->x, nearcity->y)) {
my_snprintf(buffer, sizeof(buffer),
- _("%soutside %s"), prefix, nearcity->name);
+ _(" outside %s"), nearcity->name);
} else {
my_snprintf(buffer, sizeof(buffer),
- _("%snear %s"), prefix, nearcity->name);
+ _(" near %s"), nearcity->name);
}
} else {
buffer[0] = '\0';
@@ -3025,14 +3010,14 @@
return buffer;
}
-char *get_location_str_in(struct player *pplayer, int x, int y, char *prefix)
+char *get_location_str_in(struct player *pplayer, int x, int y)
{
- return get_location_str(pplayer, x, y, prefix, 0);
+ return get_location_str(pplayer, x, y, 0);
}
-char *get_location_str_at(struct player *pplayer, int x, int y, char *prefix)
+char *get_location_str_at(struct player *pplayer, int x, int y)
{
- return get_location_str(pplayer, x, y, prefix, 1);
+ return get_location_str(pplayer, x, y, 1);
}
/**************************************************************************
@@ -3414,7 +3399,7 @@
struct city *homecity = NULL;
struct player *pplayer = get_player(punit->owner);
/* struct government *g = get_gov_pplayer(pplayer);*/
- int sentfrom = 0, sentto = 0, senthome = 0;
+ int senthome = 0;
if (punit->homecity)
homecity = find_city_by_id(punit->homecity);
@@ -3443,7 +3428,7 @@
city_refresh(homecity);
send_city_info(pplayer, homecity);
}
- senthome = sentto = 1;
+ senthome = 1;
}
if (fromcity && fromcity->owner == punit->owner) { /* leaving a city */
@@ -3451,11 +3436,11 @@
city_refresh(homecity);
send_city_info(pplayer, homecity);
}
- if (fromcity != homecity && !sentfrom) {
+ if (fromcity != homecity) {
city_refresh(fromcity);
send_city_info(pplayer, fromcity);
}
- senthome = sentfrom = 1;
+ senthome = 1;
}
/* entering/leaving a fortress */
diff -ur ../../freeciv-cvs/freeciv/server/unitfunc.h ./server/unitfunc.h
--- ../../freeciv-cvs/freeciv/server/unitfunc.h Sun Aug 27 17:49:14 2000
+++ ./server/unitfunc.h Mon Aug 28 18:18:37 2000
@@ -75,8 +75,8 @@
int transport_units, int take_from_land, int move_cost);
void assign_units_to_transporter(struct unit *ptrans, int take_from_land);
-char *get_location_str_in(struct player *pplayer, int x, int y, char *prefix);
-char *get_location_str_at(struct player *pplayer, int x, int y, char *prefix);
+char *get_location_str_in(struct player *pplayer, int x, int y);
+char *get_location_str_at(struct player *pplayer, int x, int y);
enum goto_move_restriction get_activity_move_restriction(enum unit_activity
activity);
diff -ur ../../freeciv-cvs/freeciv/server/unithand.c ./server/unithand.c
--- ../../freeciv-cvs/freeciv/server/unithand.c Sun Aug 27 17:49:15 2000
+++ ./server/unithand.c Mon Aug 28 18:50:58 2000
@@ -514,7 +514,6 @@
struct unit *plooser, *pwinner;
struct unit old_punit = *punit; /* Used for new ship algorithm. -GJW */
struct city *pcity;
- struct city *nearcity1, *nearcity2;
int def_x = pdefender->x, def_y = pdefender->y;
freelog(LOG_DEBUG, "Start attack: %s's %s against %s's %s.",
@@ -612,9 +611,6 @@
send_packet_unit_combat(pconn, &combat);
}
} conn_list_iterate_end;
-
- nearcity1 = dist_nearest_city(get_player(pwinner->owner), def_x, def_y, 0,
0);
- nearcity2 = dist_nearest_city(get_player(plooser->owner), def_x, def_y, 0,
0);
if(punit==plooser) {
/* The attacker lost */
@@ -629,7 +625,7 @@
" from %s's %s."),
unit_name(pwinner->type),
get_location_str_in(get_player(pwinner->owner),
- pwinner->x, pwinner->y, " "),
+ pwinner->x, pwinner->y),
get_player(plooser->owner)->name,
unit_name(plooser->type));
@@ -640,7 +636,7 @@
get_player(pwinner->owner)->name,
unit_name(pwinner->type),
get_location_str_at(get_player(plooser->owner),
- pwinner->x, pwinner->y, " "));
+ pwinner->x, pwinner->y));
wipe_unit(plooser);
}
else {
@@ -660,7 +656,7 @@
get_player(plooser->owner)->name,
unit_name(plooser->type),
get_location_str_at(get_player(pwinner->owner),
- plooser->x, plooser->y, " "));
+ plooser->x, plooser->y));
kill_unit(pwinner, plooser);
/* no longer pplayer - want better msgs -- Syela */
}
@@ -1250,7 +1246,6 @@
int coins;
struct player *pplayer = unit_owner(punit);
struct player *cplayer;
- struct city *pnewcity;
/* if not at war, may peacefully enter city */
if (!players_at_war(pplayer->player_no, pcity->owner))
@@ -1342,7 +1337,7 @@
get_a_tech(pplayer, cplayer);
make_partisans(pcity);
- pnewcity = transfer_city(pplayer, cplayer, pcity , 0, 0, 1, 1);
+ transfer_city(pplayer, cplayer, pcity , 0, 0, 1, 1);
send_player_info(pplayer, pplayer); /* Update techs */
if (do_civil_war)
Language.diff.gz
Description: Binary data
- [Freeciv-Dev] PATCH: Language fixes,
Dirk Stoecker <=
|
|