[xiph-commits] r12999 - trunk/planarity
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Wed May 30 02:57:36 PDT 2007
Author: xiphmont
Date: 2007-05-30 02:57:35 -0700 (Wed, 30 May 2007)
New Revision: 12999
Modified:
trunk/planarity/Makefile
trunk/planarity/dialog_finish.c
trunk/planarity/dialog_level.c
trunk/planarity/dialog_level_icons.c
trunk/planarity/dialog_pause.c
trunk/planarity/gameboard.c
trunk/planarity/gameboard_draw_intersection.c
trunk/planarity/gameboard_draw_main.c
trunk/planarity/gameboard_draw_score.c
trunk/planarity/gameboard_logic.c
trunk/planarity/gameboard_logic_buttonbar.c
trunk/planarity/graph.c
trunk/planarity/graph_generate.c
trunk/planarity/graph_region.c
trunk/planarity/graph_score.c
trunk/planarity/levelstate.c
trunk/planarity/main.c
trunk/planarity/main.h
trunk/planarity/timer.c
trunk/planarity/version.h
Log:
Commit internationalization patch with Czech translation provided by
petr.pisar at atlas.cz
Modified: trunk/planarity/Makefile
===================================================================
--- trunk/planarity/Makefile 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/Makefile 2007-05-30 09:57:35 UTC (rev 12999)
@@ -5,13 +5,27 @@
TARGET = gPlanarity
CC = gcc
LD = gcc
-INSTALL = install
+export INSTALL = install
STRIP = strip
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
ETCDIR = /etc/$(TARGET)
MANDIR = $(PREFIX)/man
+#DISABLE_NLS = true
+
+# All subdirs with Makefiles
+SUBDIRS =
+
+# By default, enable NLS
+ifeq ($(origin DISABLE_NLS), undefined)
+export GT_DOMAIN = $(TARGET)
+export GT_DIR = $(PREFIX)/share/locale
+ADD_DEF += -DUGT_DOMAIN="$(GT_DOMAIN)" -DUGT_DIR="$(GT_DIR)" -DENABLE_NLS
+SUBDIRS += po
+endif
+
+
# the very long LIBS entry is to build an executable that will
# work for on most modern linux distros without any of the
# bleeding-edge GTK 2.7/2.8 libs installed.
@@ -62,11 +76,16 @@
-lXext -lXrandr $(XINERAMA) -lXcursor -lX11 $(PIXMAN)\
-lXft $(PNG)
-all:
+all: all-local all-recursive
+
+all-local:
pkg-config --cflags "gtk+-2.0 $(GTKVER) cairo $(CAIROVER) freetype2" 1>/dev/null
$(MAKE) target CFLAGS='-O2 -ffast-math $(GCF) $(ADD_DEF)'
$(STRIP) $(TARGET)
+all-recursive:
+ for D in $(SUBDIRS); do make -C $$D || exit 1; done
+
static:
pkg-config --cflags "gtk+-2.0 $(GTKVER) cairo $(CAIROVER) freetype2" 1>/dev/null
$(MAKE) static-target CFLAGS='-O2 -ffast-math $(GCF) $(ADD_DEF)'
@@ -80,9 +99,15 @@
pkg-config --cflags "gtk+-2.0 $(GTKVER) cairo $(CAIROVER) freetype2" 1>/dev/null
$(MAKE) target CFLAGS='-pg -g -O2 -ffast-math $(GCF) $(ADD_DEF)" LIBS="$(LIBS) -lgprof-helper'
-clean:
+clean: clean-local clean-recursive
+
+clean-local:
rm -f $(OBJ) *.d *.d.* gmon.out $(TARGET)
+clean-recursive:
+ for D in $(SUBDIRS); do make -C $$D clean || exit 1; done
+
+
distclean: clean
rm -f *~
@@ -105,6 +130,11 @@
./touch-version
$(LD) $(OBJ) $(CFLAGS) -o $(TARGET) $(SLIBS) $(SLDF)
-install: target
+install: install-local install-recursive
+
+install-local: target
$(INSTALL) -d -m 0755 $(BINDIR)
$(INSTALL) -m 0755 $(TARGET) $(BINDIR)
+
+install-recursive:
+ for D in $(SUBDIRS); do make -C $$D install || exit 1; done
Modified: trunk/planarity/dialog_finish.c
===================================================================
--- trunk/planarity/dialog_finish.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/dialog_finish.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -77,9 +77,9 @@
int h=g->g.height;
buttonstate *states=g->b.states;
- states[0].rollovertext="exit gPlanarity";
- states[1].rollovertext="level selection menu";
- states[10].rollovertext="play next level!";
+ states[0].rollovertext=_("exit gPlanarity");
+ states[1].rollovertext=_("level selection menu");
+ states[10].rollovertext=_("play next level!");
states[0].callback = local_quit;
states[1].callback = local_level;
@@ -157,15 +157,15 @@
cairo_set_source_rgba (c, TEXT_COLOR);
y=h/2-FINISHBOX_HEIGHT/2+SCOREHEIGHT/2;
- render_text_centered(c,"Level Complete!", w/2,y);y+=45;
+ render_text_centered(c,_("Level Complete!"), w/2,y);y+=45;
set_font(c,16,16,0,0);
- snprintf(buffer,160,"Elapsed: %s",time);
+ snprintf(buffer,160,_("Elapsed: %s"),time);
render_bordertext_centered(c,buffer, w/2,y);y+=24;
- snprintf(buffer,160,"Base score: %d points",graphscore_get_raw_score(&g->g));
+ snprintf(buffer,160,_("Base score: %d points"),graphscore_get_raw_score(&g->g));
render_bordertext_centered(c,buffer, w/2,y);y+=24;
if(graphscore_get_multiplier_percent(&g->g)>100){
@@ -173,32 +173,32 @@
set_font(c,16,16,0,1);
cairo_set_source_rgba (c, HIGH_COLOR);
- snprintf(buffer,160,"Objective Exceeded! %d%%",graphscore_get_multiplier_percent(&g->g));
+ snprintf(buffer,160,_("Objective Exceeded! %d%%"),graphscore_get_multiplier_percent(&g->g));
render_bordertext_centered(c,buffer, w/2,y);y+=24;
cairo_restore(c);
}
- snprintf(buffer,160,"Time bonus: %d points",time_bonus);
+ snprintf(buffer,160,_("Time bonus: %d points"),time_bonus);
render_bordertext_centered(c,buffer, w/2,y);y+=35;
set_font(c,16,16,0,1);
- snprintf(buffer,160,"Final score: %d points",graphscore_get_score(&g->g)+time_bonus);
+ snprintf(buffer,160,_("Final score: %d points"),graphscore_get_score(&g->g)+time_bonus);
render_bordertext_centered(c,buffer, w/2,y);y+=24;
if(graphscore_get_score(&g->g)+time_bonus >= levelstate_get_hiscore()){
cairo_set_source_rgba (c, HIGH_COLOR);
- render_bordertext_centered(c,"A high score!", w/2,y);y+=43;
+ render_bordertext_centered(c,_("A high score!"), w/2,y);y+=43;
cairo_set_source_rgba (c, TEXT_COLOR);
}else{
- snprintf(buffer,160,"Previous best: %ld points",levelstate_get_hiscore());
+ snprintf(buffer,160,_("Previous best: %ld points"),levelstate_get_hiscore());
render_bordertext_centered(c,buffer, w/2,y);y+=43;
}
- render_bordertext_centered(c,"Total score to date:", w/2,y);
+ render_bordertext_centered(c,_("Total score to date:"), w/2,y);
y+=21;
- snprintf(buffer,160,"%ld points",levelstate_total_hiscore());
+ snprintf(buffer,160,_("%ld points"),levelstate_total_hiscore());
render_bordertext_centered(c,buffer, w/2,y);
}
Modified: trunk/planarity/dialog_level.c
===================================================================
--- trunk/planarity/dialog_level.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/dialog_level.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -64,9 +64,9 @@
int h=g->g.height;
buttonstate *states=g->b.states;
- states[0].rollovertext="exit gPlanarity";
- states[2].rollovertext="reset level";
- states[10].rollovertext="play level!";
+ states[0].rollovertext=_("exit gPlanarity");
+ states[2].rollovertext=_("reset level");
+ states[10].rollovertext=_("play level!");
states[0].callback = local_quit;
states[2].callback = local_reset;
@@ -136,7 +136,7 @@
set_font(c,18,18,0,1);
cairo_set_source_rgba (c, TEXT_COLOR);
- render_text_centered(c,"Available Levels", w/2,h/2-LEVELBOX_HEIGHT/2+SCOREHEIGHT/2);
+ render_text_centered(c,_("Available Levels"), w/2,h/2-LEVELBOX_HEIGHT/2+SCOREHEIGHT/2);
cairo_destroy(c);
}
Modified: trunk/planarity/dialog_level_icons.c
===================================================================
--- trunk/planarity/dialog_level_icons.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/dialog_level_icons.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -243,7 +243,7 @@
if(g->d.text1.width==0 ||
(ey<g->d.text1.y+g->d.text1.height && ey2>g->d.text1.y)){
- snprintf(buffer,160,"Level %d:",get_level_num()+1);
+ snprintf(buffer,160,_("Level %d:"),get_level_num()+1);
set_font(c,20,20,0,1);
cairo_set_source_rgba (c, TEXT_COLOR);
g->d.text1=render_bordertext_centered(c, buffer,w/2,y+45);
@@ -261,10 +261,10 @@
if(levelstate_get_hiscore()==0){
set_font(c,18,18,1,0);
- snprintf(buffer,160,"[not yet completed]");
+ snprintf(buffer,160,_("[not yet completed]"));
}else{
set_font(c,18,18,0,0);
- snprintf(buffer,160,"level high score: %ld",levelstate_get_hiscore());
+ snprintf(buffer,160,_("level high score: %ld"),levelstate_get_hiscore());
}
cairo_set_source_rgba (c, TEXT_COLOR);
@@ -274,7 +274,7 @@
if(g->d.text4.width==0 ||
(ey<g->d.text4.y+g->d.text4.height && ey2>g->d.text4.y)){
- snprintf(buffer,160,"total score all levels: %ld",levelstate_total_hiscore());
+ snprintf(buffer,160,_("total score all levels: %ld"),levelstate_total_hiscore());
set_font(c,18,18,0,0);
cairo_set_source_rgba (c, TEXT_COLOR);
Modified: trunk/planarity/dialog_pause.c
===================================================================
--- trunk/planarity/dialog_pause.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/dialog_pause.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -64,8 +64,8 @@
int h=g->g.height;
buttonstate *states=g->b.states;
- states[0].rollovertext="exit gPlanarity";
- states[10].rollovertext="resume game!";
+ states[0].rollovertext=_("exit gPlanarity");
+ states[10].rollovertext=_("resume game!");
states[0].callback = local_quit;
states[10].callback = local_unpause;
@@ -128,10 +128,10 @@
set_font(c,18,18,0,1);
cairo_set_source_rgba (c, TEXT_COLOR);
- render_text_centered(c,"Game Paused", w/2,h/2-PAUSEBOX_HEIGHT/2+SCOREHEIGHT/2);
+ render_text_centered(c,_("Game Paused"), w/2,h/2-PAUSEBOX_HEIGHT/2+SCOREHEIGHT/2);
set_font(c,18,18,0,0);
- render_bordertext_centered(c,"Time Elapsed:", w/2,h/2-30);
+ render_bordertext_centered(c,_("Time Elapsed:"), w/2,h/2-30);
render_bordertext_centered(c,time, w/2,h/2);
}
@@ -183,19 +183,19 @@
set_font(c,18,18,0,1);
cairo_set_source_rgba (c, TEXT_COLOR);
- render_text_centered(c,"gPlanarity", w/2,y);
+ render_text_centered(c,_("gPlanarity"), w/2,y);
set_font(c,18,18,0,0);
y+=45;
- render_bordertext_centered(c,"Untangle the mess!", w/2,y);
+ render_bordertext_centered(c,_("Untangle the mess!"), w/2,y);
y+=30;
set_font(c,13,13,0,0);
- render_bordertext_centered(c,"Drag verticies to eliminate crossed lines.", w/2,y); y+=16;
- render_bordertext_centered(c,"The objective may be a complete solution or", w/2,y); y+=16;
- render_bordertext_centered(c,"getting as close as possible to solving an", w/2,y); y+=16;
- render_bordertext_centered(c,"unsolvable puzzle. Work quickly and", w/2,y); y+=16;
- render_bordertext_centered(c,"exceed the objective for bonus points!", w/2,y); y+=16;
+ render_bordertext_centered(c,_("Drag verticies to eliminate crossed lines."), w/2,y); y+=16;
+ render_bordertext_centered(c,_("The objective may be a complete solution or"), w/2,y); y+=16;
+ render_bordertext_centered(c,_("getting as close as possible to solving an"), w/2,y); y+=16;
+ render_bordertext_centered(c,_("unsolvable puzzle. Work quickly and"), w/2,y); y+=16;
+ render_bordertext_centered(c,_("exceed the objective for bonus points!"), w/2,y); y+=16;
y+=16;
cairo_move_to (c, w/2-100,y);
@@ -204,13 +204,13 @@
y+=32;
set_font(c,12,13,0,0);
- render_bordertext_centered(c,"gPlanarity written by Monty <monty at xiph.org>",w/2,y);y+=17;
- render_bordertext_centered(c,"as a demonstration of Gtk+/Cairo",w/2,y);y+=32;
+ render_bordertext_centered(c,_("gPlanarity written by Monty <monty at xiph.org>"),w/2,y);y+=17;
+ render_bordertext_centered(c,_("as a demonstration of Gtk+/Cairo"),w/2,y);y+=32;
- render_bordertext_centered(c,"Original Flash version of Planarity by",w/2,y);y+=17;
- render_bordertext_centered(c,"John Tantalo <john.tantalo at case.edu>",w/2,y);y+=32;
+ render_bordertext_centered(c,_("Original Flash version of Planarity by"),w/2,y);y+=17;
+ render_bordertext_centered(c,_("John Tantalo <john.tantalo at case.edu>"),w/2,y);y+=32;
- render_bordertext_centered(c,"Original game concept by Mary Radcliffe",w/2,y);y+=17;
+ render_bordertext_centered(c,_("Original game concept by Mary Radcliffe"),w/2,y);y+=17;
y = h/2+ABOUTBOX_HEIGHT/2-SCOREHEIGHT/2;
Modified: trunk/planarity/gameboard.c
===================================================================
--- trunk/planarity/gameboard.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/gameboard.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -35,10 +35,12 @@
#include <time.h>
#include <string.h>
+#include "gettext.h"
#include "graph.h"
#include "gameboard.h"
#include "levelstate.h"
+
static GtkWidgetClass *parent_class = NULL;
static void gameboard_init (Gameboard *g){
@@ -70,10 +72,10 @@
if(widget->allocation.width != g->resize_w ||
widget->allocation.height != g->resize_h){
if(time(NULL) > g->resize_timeout){
- fprintf(stderr,"\n\nERROR: The windowmanager appears to be ignoring resize requests.\n"
+ fprintf(stderr,_("\n\nERROR: The windowmanager appears to be ignoring resize requests.\n"
"This stands a pretty good chance of scrambling any saved board larger\n"
- "than the default window size.\n\n"
- "Clipping and/or expanding this board to the current window size...\n\n");
+ "than the default window size.\n\n"));
+ fprintf(stderr,_("Clipping and/or expanding this board to the current window size...\n\n"));
g->resize_w = 0;
g->resize_h = 0;
resize_buttons(g,g->g.width, g->g.height, widget->allocation.width, widget->allocation.height);
@@ -179,12 +181,12 @@
allocation->height != g->resize_h &&
g->resize_timeout == 0 ){
- fprintf(stderr,"\n\nERROR: The window size granted by the windowmanager is not the\n"
+ fprintf(stderr,_("\n\nERROR: The window size granted by the windowmanager is not the\n"
"window size gPlanarity requested. If the windowmanager is\n"
"configured to ignore application sizing requests, this stands\n"
"a pretty good chance of scrambling saved boards later (and\n"
- "making everything look funny now).\n\n"
- "Clipping and/or expanding this board to the current window size...\n\n");
+ "making everything look funny now).\n\n"));
+ fprintf(stderr,_("Clipping and/or expanding this board to the current window size...\n\n"));
g->resize_h=0;
g->resize_w=0;
Modified: trunk/planarity/gameboard_draw_intersection.c
===================================================================
--- trunk/planarity/gameboard_draw_intersection.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/gameboard_draw_intersection.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -62,7 +62,7 @@
cairo_stroke(c);
set_font(c, 30., 34., 0,1);
- render_bordertext_centered(c,"rather many, really",x2,y2+r/4);
+ render_bordertext_centered(c,_("rather many, really"),x2,y2+r/4);
}
Modified: trunk/planarity/gameboard_draw_main.c
===================================================================
--- trunk/planarity/gameboard_draw_main.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/gameboard_draw_main.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -367,7 +367,7 @@
cairo_surface_t *s = cairo_image_surface_create_from_png(name);
if(s==NULL || cairo_surface_status(s)!=CAIRO_STATUS_SUCCESS)
- fprintf(stderr,"ERROR: Could not load board icon \"%s\"\n",
+ fprintf(stderr,_("ERROR: Could not load board icon \"%s\"\n"),
name);
cairo_t *c = cairo_create(s);
@@ -433,7 +433,7 @@
draw_intersections(b,g,c,0,0,g->width,g->height);
if(cairo_surface_write_to_png(s,name) != CAIRO_STATUS_SUCCESS){
- fprintf(stderr,"ERROR: Could not save board icon \"%s\"\n",
+ fprintf(stderr,_("ERROR: Could not save board icon \"%s\"\n"),
name);
return -1;
}
Modified: trunk/planarity/gameboard_draw_score.c
===================================================================
--- trunk/planarity/gameboard_draw_score.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/gameboard_draw_score.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -64,11 +64,11 @@
topbox(g,c,g->g.width,SCOREHEIGHT);
- snprintf(level_string,160,"Level %d: %s",get_level_num()+1,get_level_desc());
- snprintf(score_string,160,"Score: %d",graphscore_get_raw_score(&g->g));
- snprintf(mult_string,160,"%d%%",graphscore_get_multiplier_percent(&g->g));
- snprintf(int_string,160,"Intersections: %ld",g->g.active_intersections);
- snprintf(obj_string,160,"Objective: %s",graphscore_objective_string(&g->g));
+ snprintf(level_string,160,_("Level %d: %s"),get_level_num()+1,get_level_desc());
+ snprintf(score_string,160,_("Score: %d"),graphscore_get_raw_score(&g->g));
+ snprintf(mult_string,160,_("%d%%"),graphscore_get_multiplier_percent(&g->g));
+ snprintf(int_string,160,_("Intersections: %ld"),g->g.active_intersections);
+ snprintf(obj_string,160,_("Objective: %s"),graphscore_objective_string(&g->g));
set_font(c,xpx,15,0,1);
cairo_set_source_rgba (c, TEXT_COLOR);
Modified: trunk/planarity/gameboard_logic.c
===================================================================
--- trunk/planarity/gameboard_logic.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/gameboard_logic.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -368,7 +368,7 @@
f = fopen(name,"wb");
if(f==NULL){
- fprintf(stderr,"ERROR: Could not save board state for \"%s\":\n\t%s\n",
+ fprintf(stderr,_("ERROR: Could not save board state for \"%s\":\n\t%s\n"),
get_level_desc(),strerror(errno));
return errno;
}
@@ -398,7 +398,7 @@
f = fopen(name,"rb");
if(f==NULL){
- fprintf(stderr,"ERROR: Could not read saved board state for \"%s\":\n\t%s\n",
+ fprintf(stderr,_("ERROR: Could not read saved board state for \"%s\":\n\t%s\n"),
get_level_desc(),strerror(errno));
return errno;
}
Modified: trunk/planarity/gameboard_logic_buttonbar.c
===================================================================
--- trunk/planarity/gameboard_logic_buttonbar.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/gameboard_logic_buttonbar.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -29,6 +29,7 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
+#include "gettext.h"
#include "graph.h"
#include "timer.h"
#include "gameboard.h"
@@ -50,16 +51,16 @@
int w=g->g.width;
int h=g->g.height;
- states[0].rollovertext="exit gPlanarity";
- states[1].rollovertext="level selection menu";
- states[2].rollovertext="reset board";
- states[3].rollovertext="pause";
- states[4].rollovertext="help / about";
- states[5].rollovertext="expand";
- states[6].rollovertext="shrink";
- states[7].rollovertext="hide/show lines";
- states[8].rollovertext="mark intersections";
- states[9].rollovertext="click when finished!";
+ states[0].rollovertext=_("exit gPlanarity");
+ states[1].rollovertext=_("level selection menu");
+ states[2].rollovertext=_("reset board");
+ states[3].rollovertext=_("pause");
+ states[4].rollovertext=_("help / about");
+ states[5].rollovertext=_("expand");
+ states[6].rollovertext=_("shrink");
+ states[7].rollovertext=_("hide/show lines");
+ states[8].rollovertext=_("mark intersections");
+ states[9].rollovertext=_("click when finished!");
states[0].callback = quit_action;
states[1].callback = level_action;
Modified: trunk/planarity/graph.c
===================================================================
--- trunk/planarity/graph.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/graph.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <math.h>
+#include "gettext.h"
#include "graph.h"
#include "random.h"
#include "timer.h"
@@ -919,7 +920,7 @@
if(A>=0 && A<g->vertex_num && B>=0 && B<g->vertex_num)
add_edge(g,flat[A],flat[B]);
else
- fprintf(stderr,"WARNING: edge references out of range vertex in save file\n");
+ fprintf(stderr,_("WARNING: edge references out of range vertex in save file\n"));
}
sscanf(line,"int %ld",&g->original_intersections);
}
Modified: trunk/planarity/graph_generate.c
===================================================================
--- trunk/planarity/graph_generate.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/graph_generate.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include "graph.h"
#include "graph_generate.h"
+#include "gettext.h"
typedef struct {
char *class;
@@ -43,112 +44,112 @@
#define FINITE_LEVELS 79
static gen_instance i_list[FINITE_LEVELS]={
- {"simple", 1, "A Small Beginning", generate_simple, 1.,4., 1 }, // 1
- {"simple", 2, "My First Real Level(tm)", generate_simple, 1.,4., 2 }, // 2
- {"data", 0, "My First Mission Impossible(tm)", generate_data, 20.,4., 3 }, // 3
- {"simple", 3, "Larger But Not Harder", generate_simple, 1.,4., 2 }, // 4
- {"crest", 5, "The Trick Is It's Easy", generate_crest, 1.,4., 2 }, // 5
+ {"simple", 1, __("A Small Beginning"), generate_simple, 1.,4., 1 }, // 1
+ {"simple", 2, __("My First Real Level(tm)"), generate_simple, 1.,4., 2 }, // 2
+ {"data", 0, __("My First Mission Impossible(tm)"), generate_data, 20.,4., 3 }, // 3
+ {"simple", 3, __("Larger But Not Harder"), generate_simple, 1.,4., 2 }, // 4
+ {"crest", 5, __("The Trick Is It's Easy"), generate_crest, 1.,4., 2 }, // 5
- {"simple", 4, "Practice Before the Handbasket: One of Three", generate_simple, 1.,4., 2 }, // 6
- {"simple", 5, "Practice Before the Handbasket: Two of Three", generate_simple, 1.,4., 2 }, // 7
- {"simple", 6, "Practice Before the Handbasket: Three of Three", generate_simple, 1.,4., 2 }, // 8
+ {"simple", 4, __("Practice Before the Handbasket: One of Three"), generate_simple, 1.,4., 2 }, // 6
+ {"simple", 5, __("Practice Before the Handbasket: Two of Three"), generate_simple, 1.,4., 2 }, // 7
+ {"simple", 6, __("Practice Before the Handbasket: Three of Three"), generate_simple, 1.,4., 2 }, // 8
- {"sparse", 4, "Tough and Stringy", generate_sparse, 1.2,4., 2 }, // 9
- {"sparse", 5, "Threadbare", generate_sparse, 1.2,4., 2 }, // 10
+ {"sparse", 4, __("Tough and Stringy"), generate_sparse, 1.2,4., 2 }, // 9
+ {"sparse", 5, __("Threadbare"), generate_sparse, 1.2,4., 2 }, // 10
- {"nasty", 4, "The Bumpy Circles Are Slightly More Difficult", generate_nasty, 1.5,4., 3 }, // 11
- {"nasty", 5, "Three is a Magic Number", generate_nasty, 1.5,4., 3 }, // 12
- {"nasty", 6, "Last Call For (Sort of) Triangles (For Now)", generate_nasty, 1.5,4., 3 }, // 13
+ {"nasty", 4, __("The Bumpy Circles Are Slightly More Difficult"), generate_nasty, 1.5,4., 3 }, // 11
+ {"nasty", 5, __("Three is a Magic Number"), generate_nasty, 1.5,4., 3 }, // 12
+ {"nasty", 6, __("Last Call For (Sort of) Triangles (For Now)"), generate_nasty, 1.5,4., 3 }, // 13
- {"free", 4, "Something Only Subtly Different", generate_freeform, 1.5,4., 3 }, // 14
- {"free", 5, "It Can Roll! Granted, Not Very Well", generate_freeform, 1.5,4., 3 }, // 15
- {"free", 6, "If You Squint, It's a Round Brick", generate_freeform, 1.5,4., 3 }, // 16
+ {"free", 4, __("Something Only Subtly Different"), generate_freeform, 1.5,4., 3 }, // 14
+ {"free", 5, __("It Can Roll! Granted, Not Very Well"), generate_freeform, 1.5,4., 3 }, // 15
+ {"free", 6, __("If You Squint, It's a Round Brick"), generate_freeform, 1.5,4., 3 }, // 16
- {"rogue", 5, "A New Objective", generate_rogue, 1.6,4., 3 }, // 17
- {"rogue", 6, "How Low Can You Go?", generate_rogue, 1.6,4., 3 }, // 18
- {"rogue", 7, "Military Industrial Complex", generate_rogue, 1.6,4., 4 }, // 19
+ {"rogue", 5, __("A New Objective"), generate_rogue, 1.6,4., 3 }, // 17
+ {"rogue", 6, __("How Low Can You Go?"), generate_rogue, 1.6,4., 3 }, // 18
+ {"rogue", 7, __("Military Industrial Complex"), generate_rogue, 1.6,4., 4 }, // 19
- {"embed", 4, "The Hexagon is a Subtle and Wily Beast", generate_embed, 2.,4., 4 }, // 20
- {"embed", 5, "No, Really, The Hexagon Puzzles Are Harder", generate_embed, 3.,4., 5 }, // 21
- {"embed", 6, "Cursed? Call 1-800-HEX-A-GON Today!", generate_embed, 4.,4., 6 }, // 22
+ {"embed", 4, __("The Hexagon is a Subtle and Wily Beast"), generate_embed, 2.,4., 4 }, // 20
+ {"embed", 5, __("No, Really, The Hexagon Puzzles Are Harder"), generate_embed, 3.,4., 5 }, // 21
+ {"embed", 6, __("Cursed? Call 1-800-HEX-A-GON Today!"), generate_embed, 4.,4., 6 }, // 22
- {"simple", 7, "Round but Straightforward", generate_simple, 1.,4., 4 }, // 23
+ {"simple", 7, __("Round but Straightforward"), generate_simple, 1.,4., 4 }, // 23
- {"shape", 0, "A Star Is Born... Then Solved", generate_shape, 1.,2., 6 }, // 24
- {"shape", 1, "Oh, Rain*bows*...", generate_shape, 1.,2., 6 }, // 25
- {"shape", 2, "Solve Along the Dotted Line", generate_shape, 1.,2., 6 }, // 26
- {"shape", 3, "Using All Available Space", generate_shape, 1.,2., 6 }, // 27
- {"shape", 4, "Brainfreeze", generate_shape, 1.,2., 6 }, // 28
- {"shape", 6, "Tropical Storm Invest", generate_shape, 1.,2., 6 }, // 30
+ {"shape", 0, __("A Star Is Born... Then Solved"), generate_shape, 1.,2., 6 }, // 24
+ {"shape", 1, __("Oh, Rain*bows*..."), generate_shape, 1.,2., 6 }, // 25
+ {"shape", 2, __("Solve Along the Dotted Line"), generate_shape, 1.,2., 6 }, // 26
+ {"shape", 3, __("Using All Available Space"), generate_shape, 1.,2., 6 }, // 27
+ {"shape", 4, __("Brainfreeze"), generate_shape, 1.,2., 6 }, // 28
+ {"shape", 6, __("Tropical Storm Invest"), generate_shape, 1.,2., 6 }, // 30
- {"dense", 8, "Algorithm: Original/Dense (Order: 8)", generate_dense, .8,1., 5 }, // 31
- {"simple", 8, "Algorithm: Original (Order: 8)", generate_simple, 1.,1., 6 }, // 32
- {"sparse", 8, "Algorithm: Original/Sparse (Order: 8)",generate_sparse, 1.2,1., 7 }, // 33
- {"nasty", 8, "Algorithm: Nasty (Order: 8)", generate_nasty, 1.5,1., 8 }, // 34
- {"free", 8, "Algorithm: Freeform/4 (Order: 8)", generate_freeform, 1.5,1., 9 }, // 35
- {"rogue", 8, "Algorithm: Rogue (Order: 8)", generate_rogue, 1.6,1.,10 }, // 36
- {"embed", 8, "Algorithm: Embed (Order: 8)", generate_embed, 4.,1.,10 }, // 37
- {"shape", 7, "Operator", generate_shape, 1.,2.,10 }, // 38
+ {"dense", 8, __("Algorithm: Original/Dense (Order: 8)"), generate_dense, .8,1., 5 }, // 31
+ {"simple", 8, __("Algorithm: Original (Order: 8)"), generate_simple, 1.,1., 6 }, // 32
+ {"sparse", 8, __("Algorithm: Original/Sparse (Order: 8)"),generate_sparse, 1.2,1., 7 }, // 33
+ {"nasty", 8, __("Algorithm: Nasty (Order: 8)"), generate_nasty, 1.5,1., 8 }, // 34
+ {"free", 8, __("Algorithm: Freeform/4 (Order: 8)"), generate_freeform, 1.5,1., 9 }, // 35
+ {"rogue", 8, __("Algorithm: Rogue (Order: 8)"), generate_rogue, 1.6,1.,10 }, // 36
+ {"embed", 8, __("Algorithm: Embed (Order: 8)"), generate_embed, 4.,1.,10 }, // 37
+ {"shape", 7, __("Operator"), generate_shape, 1.,2.,10 }, // 38
- {"dense", 9, "Algorithm: Original/Dense (Order: 9)", generate_dense, .8,1., 5 }, // 39
- {"simple", 9, "Algorithm: Original (Order: 9)", generate_simple, 1.,1., 6 }, // 40
- {"sparse", 9, "Algorithm: Original/Sparse (Order: 9)",generate_sparse, 1.2,1., 7 }, // 41
- {"nasty", 9, "Algorithm: Nasty (Order: 9)", generate_nasty, 1.5,1., 8 }, // 42
- {"free", 9, "Algorithm: Freeform/4 (Order: 9)", generate_freeform, 1.5,1., 9 }, // 43
- {"rogue", 9, "Algorithm: Rogue (Order: 9)", generate_rogue, 1.6,1.,10 }, // 44
- {"embed", 9, "Algorithm: Embed (Order: 9)", generate_embed, 4.,1.,10 }, // 45
- {"shape", 8, "The Inside Is Pointy", generate_shape, 1.,2.,10 }, // 46
+ {"dense", 9, __("Algorithm: Original/Dense (Order: 9)"), generate_dense, .8,1., 5 }, // 39
+ {"simple", 9, __("Algorithm: Original (Order: 9)"), generate_simple, 1.,1., 6 }, // 40
+ {"sparse", 9, __("Algorithm: Original/Sparse (Order: 9)"),generate_sparse, 1.2,1., 7 }, // 41
+ {"nasty", 9, __("Algorithm: Nasty (Order: 9)"), generate_nasty, 1.5,1., 8 }, // 42
+ {"free", 9, __("Algorithm: Freeform/4 (Order: 9)"), generate_freeform, 1.5,1., 9 }, // 43
+ {"rogue", 9, __("Algorithm: Rogue (Order: 9)"), generate_rogue, 1.6,1.,10 }, // 44
+ {"embed", 9, __("Algorithm: Embed (Order: 9)"), generate_embed, 4.,1.,10 }, // 45
+ {"shape", 8, __("The Inside Is Pointy"), generate_shape, 1.,2.,10 }, // 46
- {"dense", 10, "Algorithm: Original/Dense (Order: 10)", generate_dense, .8,1., 5 }, // 47
- {"simple",10, "Algorithm: Original (Order: 10)", generate_simple, 1.,1., 6 }, // 48
- {"sparse",10, "Algorithm: Original/Sparse (Order: 10)",generate_sparse, 1.2,1., 7 }, // 49
- {"nasty", 10, "Algorithm: Nasty (Order: 10)", generate_nasty, 1.5,1., 8 }, // 50
- {"free", 10, "Algorithm: Freeform/4 (Order: 10)", generate_freeform, 1.5,1., 9 }, // 51
- {"rogue", 10, "Algorithm: Rogue (Order: 10)", generate_rogue, 1.6,1.,10 }, // 52
- {"embed", 10, "Algorithm: Embed (Order: 10)", generate_embed, 4.,1.,10 }, // 53
- {"shape", 9, "Riches and Good Luck", generate_shape, 1.,2.,10 }, // 54
+ {"dense", 10, __("Algorithm: Original/Dense (Order: 10)"), generate_dense, .8,1., 5 }, // 47
+ {"simple",10, __("Algorithm: Original (Order: 10)"), generate_simple, 1.,1., 6 }, // 48
+ {"sparse",10, __("Algorithm: Original/Sparse (Order: 10)"),generate_sparse, 1.2,1., 7 }, // 49
+ {"nasty", 10, __("Algorithm: Nasty (Order: 10)"), generate_nasty, 1.5,1., 8 }, // 50
+ {"free", 10, __("Algorithm: Freeform/4 (Order: 10)"), generate_freeform, 1.5,1., 9 }, // 51
+ {"rogue", 10, __("Algorithm: Rogue (Order: 10)"), generate_rogue, 1.6,1.,10 }, // 52
+ {"embed", 10, __("Algorithm: Embed (Order: 10)"), generate_embed, 4.,1.,10 }, // 53
+ {"shape", 9, __("Riches and Good Luck"), generate_shape, 1.,2.,10 }, // 54
- {"dense", 11, "Algorithm: Original/Dense (Order: 11)", generate_dense, .8,1., 5 }, // 55
- {"simple",11, "Algorithm: Original (Order: 11)", generate_simple, 1.,1., 6 }, // 56
- {"sparse",11, "Algorithm: Original/Sparse (Order: 11)",generate_sparse, 1.2,1., 7 }, // 57
- {"nasty", 11, "Algorithm: Nasty (Order: 11)", generate_nasty, 1.5,1., 8 }, // 58
- {"free", 11, "Algorithm: Freeform/4 (Order: 11)", generate_freeform, 1.5,1., 9 }, // 59
- {"rogue", 11, "Algorithm: Rogue (Order: 11)", generate_rogue, 1.6,1.,10 }, // 60
- {"embed", 11, "Algorithm: Embed (Order: 11)", generate_embed, 4.,1.,10 }, // 61
- {"shape", 10, "Mmmm... Doughnut", generate_shape, 1.,2.,10 }, // 62
+ {"dense", 11, __("Algorithm: Original/Dense (Order: 11)"), generate_dense, .8,1., 5 }, // 55
+ {"simple",11, __("Algorithm: Original (Order: 11)"), generate_simple, 1.,1., 6 }, // 56
+ {"sparse",11, __("Algorithm: Original/Sparse (Order: 11)"),generate_sparse, 1.2,1., 7 }, // 57
+ {"nasty", 11, __("Algorithm: Nasty (Order: 11)"), generate_nasty, 1.5,1., 8 }, // 58
+ {"free", 11, __("Algorithm: Freeform/4 (Order: 11)"), generate_freeform, 1.5,1., 9 }, // 59
+ {"rogue", 11, __("Algorithm: Rogue (Order: 11)"), generate_rogue, 1.6,1.,10 }, // 60
+ {"embed", 11, __("Algorithm: Embed (Order: 11)"), generate_embed, 4.,1.,10 }, // 61
+ {"shape", 10, __("Mmmm... Doughnut"), generate_shape, 1.,2.,10 }, // 62
- {"dense", 12, "Algorithm: Original/Dense (Order: 12)", generate_dense, .8,1., 5 }, // 63
- {"simple",12, "Algorithm: Original (Order: 12)", generate_simple, 1.,1., 6 }, // 64
- {"sparse",12, "Algorithm: Original/Sparse (Order: 12)",generate_sparse, 1.2,1., 7 }, // 65
- {"nasty", 12, "Algorithm: Nasty (Order: 12)", generate_nasty, 1.5,1., 8 }, // 66
- {"free", 12, "Algorithm: Freeform/4 (Order: 12)", generate_freeform, 1.5,1., 9 }, // 67
- {"rogue", 12, "Algorithm: Rogue (Order: 12)", generate_rogue, 1.6,1.,10 }, // 68
- {"embed", 12, "Algorithm: Embed (Order: 12)", generate_embed, 4.,1.,10 }, // 69
- {"shape", 11, "Quick and Dirty, or Slow and Steady", generate_shape, 1.,1.,10 }, // 70
- {"shape", 5, "Little Fluffy Clouds", generate_shape, 1.,2., 6 }, // 29
+ {"dense", 12, __("Algorithm: Original/Dense (Order: 12)"), generate_dense, .8,1., 5 }, // 63
+ {"simple",12, __("Algorithm: Original (Order: 12)"), generate_simple, 1.,1., 6 }, // 64
+ {"sparse",12, __("Algorithm: Original/Sparse (Order: 12)"),generate_sparse, 1.2,1., 7 }, // 65
+ {"nasty", 12, __("Algorithm: Nasty (Order: 12)"), generate_nasty, 1.5,1., 8 }, // 66
+ {"free", 12, __("Algorithm: Freeform/4 (Order: 12)"), generate_freeform, 1.5,1., 9 }, // 67
+ {"rogue", 12, __("Algorithm: Rogue (Order: 12)"), generate_rogue, 1.6,1.,10 }, // 68
+ {"embed", 12, __("Algorithm: Embed (Order: 12)"), generate_embed, 4.,1.,10 }, // 69
+ {"shape", 11, __("Quick and Dirty, or Slow and Steady"), generate_shape, 1.,1.,10 }, // 70
+ {"shape", 5, __("Little Fluffy Clouds"), generate_shape, 1.,2., 6 }, // 29
- {"dense", 13, "Algorithm: Original/Dense (Order: 13)", generate_dense, .8,1., 5 }, // 71
- {"simple",13, "Algorithm: Original (Order: 13)", generate_simple, 1.,1., 6 }, // 72
- {"sparse",13, "Algorithm: Original/Sparse (Order: 13)",generate_sparse, 1.2,1., 7 }, // 73
- {"nasty", 13, "Algorithm: Nasty (Order: 13)", generate_nasty, 1.5,1., 8 }, // 74
- {"free", 13, "Algorithm: Freeform/4 (Order: 13)", generate_freeform, 1.5,1., 9 }, // 75
- {"rogue", 13, "Algorithm: Rogue (Order: 13)", generate_rogue, 1.6,1.,10 }, // 76
- {"embed", 13, "Algorithm: Embed (Order: 13)", generate_embed, 4.,1.,10 }, // 77
- {"shape", 12, "A Sudden Urge To Go Shopping", generate_shape, 1.,1.,10 }, // 78
- {"shape", 13, "Sweet Reward", generate_shape, 1.,1.,10 }, // 79
+ {"dense", 13, __("Algorithm: Original/Dense (Order: 13)"), generate_dense, .8,1., 5 }, // 71
+ {"simple",13, __("Algorithm: Original (Order: 13)"), generate_simple, 1.,1., 6 }, // 72
+ {"sparse",13, __("Algorithm: Original/Sparse (Order: 13)"),generate_sparse, 1.2,1., 7 }, // 73
+ {"nasty", 13, __("Algorithm: Nasty (Order: 13)"), generate_nasty, 1.5,1., 8 }, // 74
+ {"free", 13, __("Algorithm: Freeform/4 (Order: 13)"), generate_freeform, 1.5,1., 9 }, // 75
+ {"rogue", 13, __("Algorithm: Rogue (Order: 13)"), generate_rogue, 1.6,1.,10 }, // 76
+ {"embed", 13, __("Algorithm: Embed (Order: 13)"), generate_embed, 4.,1.,10 }, // 77
+ {"shape", 12, __("A Sudden Urge To Go Shopping"), generate_shape, 1.,1.,10 }, // 78
+ {"shape", 13, __("Sweet Reward"), generate_shape, 1.,1.,10 }, // 79
};
#define LOOP_LEVELS 8
static gen_instance i_list_loop[LOOP_LEVELS]={
- {"dense", 14, "Algorithm: Original/Dense (Order: %d)", generate_dense, .8,1., 5 }, // n
- {"simple",14, "Algorithm: Original (Order: %d)", generate_simple, 1.,1., 6 }, // n
- {"sparse",14, "Algorithm: Original/Sparse (Order: %d)",generate_sparse, 1.2,1., 7 }, // n
- {"nasty", 14, "Algorithm: Nasty (Order: %d)", generate_nasty, 1.5,1., 8 }, // n
- {"free", 14, "Algorithm: Freeform/4 (Order: %d)", generate_freeform, 1.5,1., 9 }, // n
- {"rogue", 14, "Algorithm: Rogue (Order: %d)", generate_rogue, 1.6,1.,10 }, // n
- {"embed", 14, "Algorithm: Embed (Order: %d)", generate_embed, 4.,1.,10 }, // n
- {"shape", 14, "Algorithm: Region (Order: %d)", generate_shape, 1.,2.,10 },
+ {"dense", 14, __("Algorithm: Original/Dense (Order: %d)"), generate_dense, .8,1., 5 }, // n
+ {"simple",14, __("Algorithm: Original (Order: %d)"), generate_simple, 1.,1., 6 }, // n
+ {"sparse",14, __("Algorithm: Original/Sparse (Order: %d)"),generate_sparse, 1.2,1., 7 }, // n
+ {"nasty", 14, __("Algorithm: Nasty (Order: %d)"), generate_nasty, 1.5,1., 8 }, // n
+ {"free", 14, __("Algorithm: Freeform/4 (Order: %d)"), generate_freeform, 1.5,1., 9 }, // n
+ {"rogue", 14, __("Algorithm: Rogue (Order: %d)"), generate_rogue, 1.6,1.,10 }, // n
+ {"embed", 14, __("Algorithm: Embed (Order: %d)"), generate_embed, 4.,1.,10 }, // n
+ {"shape", 14, __("Algorithm: Region (Order: %d)"), generate_shape, 1.,2.,10 },
};
int generate_find_number(char *id){
@@ -192,7 +193,7 @@
gm->desc = i_list[num].desc;
gm->unlock_plus = i_list[num].unlock+1;
if(asprintf(&gm->id,"%s %d",i_list[num].class,i_list[num].instancenum)==-1){
- fprintf(stderr,"Couldn't allocate memory for level name.\n");
+ fprintf(stderr,_("Couldn't allocate memory for level name.\n"));
return -1;
}
return 0;
@@ -206,12 +207,12 @@
gm->num = num;
gm->unlock_plus = i_list_loop[classnum].unlock+1;
if(asprintf(&gm->desc,i_list_loop[classnum].desc,ordernum)==-1){
- fprintf(stderr,"Couldn't allocate memory for level desciption.\n");
+ fprintf(stderr,_("Couldn't allocate memory for level desciption.\n"));
return -1;
}
if(asprintf(&gm->id,"%s %d",i_list_loop[classnum].class,ordernum)==-1){
- fprintf(stderr,"Couldn't allocate memory for level name.\n");
+ fprintf(stderr,_("Couldn't allocate memory for level name.\n"));
return -1;
}
Modified: trunk/planarity/graph_region.c
===================================================================
--- trunk/planarity/graph_region.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/graph_region.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -31,6 +31,7 @@
#include "graph.h"
#include "graph_region.h"
+#include "gettext.h"
/* Regions are 'electric fences' for mesh building; used in mesh2 to
make non-convex shapes */
@@ -455,8 +456,8 @@
}
}else{
// circles shrunk and no longer overlap.
- fprintf(stderr,"region overlap adjustment failed in arc_arc_adj; \n"
- " This is an internal error that should never happen.\n");
+ fprintf(stderr,_("region overlap adjustment failed in arc_arc_adj; \n"
+ " This is an internal error that should never happen.\n"));
}
}
Modified: trunk/planarity/graph_score.c
===================================================================
--- trunk/planarity/graph_score.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/graph_score.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -29,6 +29,7 @@
#include <math.h>
#include "graph.h"
#include "timer.h"
+#include "gettext.h"
static char objective_string[160];
@@ -63,17 +64,17 @@
char *graphscore_objective_string(graph *g){
if(g->objective == 0)
- return "zero intersections";
+ return _("zero intersections");
if(g->objective == 1){
if(g->objective_lessthan){
- return "1 intersection or fewer";
+ return _("1 intersection or fewer");
}else{
- return "1 intersection";
+ return _("1 intersection");
}
}else{
- snprintf(objective_string,160,"%d intersections%s",
+ snprintf(objective_string,160,_("%d intersections%s"),
g->objective,(g->objective_lessthan?
- " or fewer":""));
+ _(" or fewer"):""));
return objective_string;
}
}
Modified: trunk/planarity/levelstate.c
===================================================================
--- trunk/planarity/levelstate.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/levelstate.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -166,7 +166,7 @@
f = fopen(name,"wb");
if(f==NULL){
- fprintf(stderr,"ERROR: Could not save game state file \"%s\":\n\t%s\n",
+ fprintf(stderr,_("ERROR: Could not save game state file \"%s\":\n\t%s\n"),
curr->gm.id,strerror(errno));
return errno;
}
@@ -213,7 +213,7 @@
f = fopen(name,"rb");
if(f==NULL){
if(errno!=ENOENT){
- fprintf(stderr,"ERROR: Could not read game state file \"%s\":\n\t%s\n",
+ fprintf(stderr,_("ERROR: Could not read game state file \"%s\":\n\t%s\n"),
curr->gm.id,strerror(errno));
}
return errno;
@@ -362,7 +362,7 @@
}
char *get_level_desc(){
- return curr->gm.desc;
+ return _(curr->gm.desc);
}
void levelstate_finish(){
Modified: trunk/planarity/main.c
===================================================================
--- trunk/planarity/main.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/main.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -70,7 +70,7 @@
// this is ok
return 0;
default:
- fprintf(stderr,"ERROR: Could not create directory (%s) to save game state:\n\t%s\n",
+ fprintf(stderr,_("ERROR: Could not create directory (%s) to save game state:\n\t%s\n"),
name,strerror(errno));
return errno;
}
@@ -90,7 +90,7 @@
signal(sig,SIG_IGN);
if(sig!=SIGINT)
fprintf(stderr,
- "\nTrapped signal %d; saving state and exiting!\n",sig);
+ _("\nTrapped signal %d; saving state and exiting!\n"),sig);
levelstate_write(statedir);
gtk_main_quit();
@@ -143,10 +143,10 @@
fc_pattern = FcFontMatch(0, fc_pattern, 0);
if(!fc_pattern){
- fprintf(stderr,"\nUnable to find any suitable %s fonts!\n"
- "Continuing, but the the results are likely to be poor.\n\n",
+ fprintf(stderr,_("\nUnable to find any suitable %s fonts!\n"
+ "Continuing, but the the results are likely to be poor.\n\n"),
- (slant?(bold?"bold italic":"italic"):(bold?"bold":"medium")) );
+ (slant?(bold?_("bold italic"):_("italic")):(bold?_("bold"):_("medium"))));
}
FcPatternGetString (fc_pattern, FC_FAMILY, 0, (FcChar8 **)&fontface);
@@ -161,10 +161,10 @@
FcPatternGetBool(fc_pattern, FC_SCALABLE, 0, &scalable);
if (scalable != FcTrue) {
- fprintf(stderr,"\nSelected %s font \"%s\" is not scalable! This is almost as bad\n"
+ fprintf(stderr,_("\nSelected %s font \"%s\" is not scalable! This is almost as bad\n"
"as not finding any font at all. Continuing, but this may look\n"
- "very poor indeed.\n\n",
- (slant?(bold?"bold italic":"italic"):(bold?"bold":"medium")), fontface);
+ "very poor indeed.\n\n"),
+ (slant?(bold?_("bold italic"):_("italic")):(bold?_("bold"):_("medium"))), fontface);
}
/* Set the hinting behavior we want; only the autohinter is giving
@@ -270,6 +270,12 @@
}
int main(int argc, char *argv[]){
+#ifdef ENABLE_NLS
+ setlocale(LC_ALL, "");
+ textdomain(GT_DOMAIN);
+ bindtextdomain(GT_DOMAIN, GT_DIR);
+#endif
+
char *homedir = getenv("home");
if(!homedir)
homedir = getenv("HOME");
@@ -278,8 +284,9 @@
if(!homedir)
homedir = getenv("HOMEDIR");
if(!homedir){
- fprintf(stderr,"No homedir environment variable set! gPlanarity will be\n"
- "unable to permanently save any progress or board state.\n");
+ fprintf(stderr,
+ _("No homedir environment variable set! gPlanarity will be\n"
+ "unable to permanently save any progress or board state.\n"));
boarddir=NULL;
statedir=NULL;
}else{
Modified: trunk/planarity/main.h
===================================================================
--- trunk/planarity/main.h 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/main.h 2007-05-30 09:57:35 UTC (rev 12999)
@@ -26,6 +26,23 @@
#include <gtk/gtk.h>
+#ifdef ENABLE_NLS
+#include <locale.h>
+#include <libintl.h>
+
+#define GT_DOMAIN X_GT_DOMAIN(UGT_DOMAIN)
+#define X_GT_DOMAIN(x) XX_GT_DOMAIN(x)
+#define XX_GT_DOMAIN(x) #x
+
+#define GT_DIR X_GT_DIR(UGT_DIR)
+#define X_GT_DIR(x) XX_GT_DIR(x)
+#define XX_GT_DIR(x) #x
+
+#define _(x) gettext(x)
+#else
+#define _(x) x
+#endif
+
extern char *boarddir;
extern char *statedir;
extern char *fontface;
Modified: trunk/planarity/timer.c
===================================================================
--- trunk/planarity/timer.c 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/timer.c 2007-05-30 09:57:35 UTC (rev 12999)
@@ -26,6 +26,7 @@
#include <time.h>
#include "timer.h"
+#include "gettext.h"
static int paused;
static time_t begin_time_add;
@@ -47,11 +48,11 @@
int se = get_timer() - ho*3600 - mi*60;
if(ho){
- snprintf(timebuffer,160,"%d:%02d:%02d",ho,mi,se);
+ snprintf(timebuffer,160,_("%d:%02d:%02d"),ho,mi,se);
}else if (mi){
- snprintf(timebuffer,160,"%d:%02d",mi,se);
+ snprintf(timebuffer,160,_("%d:%02d"),mi,se);
}else{
- snprintf(timebuffer,160,"%d seconds",se);
+ snprintf(timebuffer,160,_("%d seconds"),se);
}
return timebuffer;
Modified: trunk/planarity/version.h
===================================================================
--- trunk/planarity/version.h 2007-05-30 09:19:31 UTC (rev 12998)
+++ trunk/planarity/version.h 2007-05-30 09:57:35 UTC (rev 12999)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Thu Jun 1 20:08:17 EDT 2006] */
+/* DO NOT EDIT: Automated versioning hack [Wed May 30 06:58:22 EDT 2007] */
More information about the commits
mailing list