pax_global_header00006660000000000000000000000064120250542620014510gustar00rootroot0000000000000052 comment=b8804d30b3b667a82958ee14783e77143af46945 potool-0.16/000077500000000000000000000000001202505426200127525ustar00rootroot00000000000000potool-0.16/.gitignore000066400000000000000000000000511202505426200147360ustar00rootroot00000000000000lex.po.[co] po.tab.[cho] potool.o potool potool-0.16/LICENSE000066400000000000000000000015101202505426200137540ustar00rootroot00000000000000potool is a program aiding editing of po files Copyright (C) 1999-2002 Zbigniew Chyla Copyright (C) 2000-2012 Marcin Owsiany This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA potool-0.16/Makefile000066400000000000000000000026571202505426200144240ustar00rootroot00000000000000# # potool is a program aiding editing of po files # Copyright (C) 1999-2002 Zbigniew Chyla # Copyright (C) 2000-2012 Marcin Owsiany # # see LICENSE for licensing info # VER = 0.15 DESTDIR = /usr/local BINDIR = $(DESTDIR)/bin INSTALL = install BININSTALL = $(INSTALL) -s GTAR = tar GLIB_LIB = $(shell pkg-config --libs glib-2.0) GLIB_INCLUDE = $(shell pkg-config --cflags glib-2.0) CPPFLAGS += $(GLIB_INCLUDE) CFLAGS += -g -Wall -Werror LDLIBS += $(GLIB_LIB) THINGS = potool po.tab lex.po OBJS = $(addsuffix .o, $(THINGS)) SOURCES = $(addsuffix .c, $(THINGS)) potool: $(OBJS) po.tab.o lex.po.c lex.po.o: po-gram.h common.h lex.po.c: po-gram.lex flex -Ppo $< # flex --debug -Ppo $< po.tab.c: po-gram.y bison -ppo -bpo -d $< install: potool $(INSTALL) -d $(BINDIR) $(BININSTALL) potool $(BINDIR) $(INSTALL) scripts/poedit $(BINDIR) $(INSTALL) scripts/postats $(BINDIR) $(INSTALL) scripts/poupdate $(BINDIR) $(INSTALL) change-po-charset $(BINDIR) clean: rm -f $(OBJS) *~ lex.po.c po.tab.[ch] potool scripts/*~ dist: clean cd ..; \ rm -f potool-$(VER).tar{,.gz} potool-$(VER); \ ln -s potool potool-$(VER); \ $(GTAR) --exclude='*/.git*' --owner=root --group=root -hcf potool-$(VER).tar potool-$(VER) && \ gzip -9 potool-$(VER).tar check: potool cd tests && bash test # make clean check G_SLICE=always-malloc WRAPPER='valgrind --leak-check=full --show-reachable=yes --error-exitcode=1' CC=colorgcc CFLAGS="-O0 -Wall -Werror" potool-0.16/README000066400000000000000000000005751202505426200136410ustar00rootroot00000000000000potool is a program for manipulating gettext po files Copyright (C) 1999-2003 Zbigniew Chyla Copyright (C) 2000-2012 Marcin Owsiany The license is in the LICENSE file Development packages needed for building the program: gcc, bison, flex, glib 2.x Documentation is available in manual page format: poedit.1 potool.1 postats.1 change-po-charset.1 potool-0.16/README.PL000066400000000000000000000006321202505426200141450ustar00rootroot00000000000000potool jest programem wspomagajcym edycj plikw po Copyright (C) 1999-2003 Zbigniew Chyla Copyright (C) 2000-2012 Marcin Owsiany Licencja znajduje si w pliku LICENSE Pakiety potrzebne do kompilacji programu: gcc, bison, flex, glib 2.x w wersji -devel Dokumentacja dostpna jest w postaci stron podrcznika (man): poedit.pl.1 potool.pl.1 postats.pl.1 change-po-charset.pl.1 potool-0.16/change-po-charset000077500000000000000000000037171202505426200162000ustar00rootroot00000000000000#!/usr/bin/perl # Changes the "charset" attribute value of the Content-Type header in a po file. # Does NOT actually change the encoding of the file. # # Copyright 2007-2009 Marcin Owsiany # This script is public domain. use strict; use warnings; my $debug = 0; my $charset = shift @ARGV; die "Usage: change-po-charset [ file ] [ ... ]\n" unless defined $charset; # States my ($S_BLANK, $S_COMMENT, $S_MSGCTXT, $S_MSGID, $S_MSGSTR) = (1..10); # Possible regexes my %r = ( blank => qr{^\s*$}oi, comment => qr{^#}oi, msgctxt => qr{^msgctxt\s+"(.*)"$}oi, msgid => qr{^msgid(_plural)?\s+".*"$}oi, msgstr => qr{^msgstr(\[\w+\])?\s+".*"$}oi, string => qr{^".*"$}oi, ); my $subst = qr{^("Content-Type:.*charset=)(.*?)(( *;.*)?\\n")$}oi; # Current line my $l; # Current line number my $n = 0; # Curerrent state my $s = $S_BLANK; # Whether we've done the job my $done = 0; while ($l = <>) { chomp $l; my $orig_s = $s; $n++; if ($done) { print $l, "\n" or die "print failed: $!"; next; } elsif ($s == $S_BLANK && $l =~ $r{blank}) { } elsif (($s == $S_BLANK || $s == $S_COMMENT) && $l =~ $r{comment}) { $s = $S_COMMENT; } elsif (($s == $S_BLANK || $s == $S_COMMENT) && $l =~ $r{msgctxt}) { $s = $S_MSGCTXT; } elsif (($s == $S_BLANK || $s == $S_COMMENT || $s == $S_MSGCTXT) && $l =~ $r{msgid}) { $s = $S_MSGID; } elsif ($s == $S_MSGID && $l =~ $r{msgstr}) { $s = $S_MSGSTR; } elsif ($s == $S_MSGID && ($l =~ $r{string} or $l =~ $r{msgid})) { } elsif ($s == $S_MSGSTR && ($l =~ $r{string} or $l =~ $r{msgstr})) { } elsif ($s == $S_MSGSTR && $l =~ $r{blank}) { $s = $S_BLANK; } else { die "Unrecognized line num. $n in state $s: [$l], exiting"; } if ($s == $S_MSGSTR) { $done = $l =~ s{$subst}{${1}${charset}${3}}i; print STDERR "CHANGED\n" if $debug and $done; } print $l, "\n" or die "print failed: $!"; printf STDERR "%03d: %s->%s: [%s]\n", $n, $orig_s, $s, $l if $debug; } close(STDOUT) or die "close failed: $!"; exit($done ? 0 : 2); potool-0.16/change-po-charset.1000066400000000000000000000020631202505426200163250ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH CHANGE-PO-CHARSET 1 "September 21, 2007" .\" Please adjust this date whenever revising the manpage. .SH NAME change-po-charset \- change the charset value in content-type header of a gettext po file .SH SYNOPSIS .B change-po-charset .RI .RI FILENAME1 .RI [ " FILENAME2 " ... ] .SH DESCRIPTION .B change-po-charset is a simple Perl script, which reads the specified file names, and prints them on standard output, making only the following modification. In the first msgstr string sequence it encounters, it changes the "charset" attribute of the Content-Type header to the charset specified as the first parameter. .sp Please note that it does not actually change any character encoding of the contents of the data. It is used by .BR potooledit (1) to fix the content-type header after it recodes the file with .BR iconv (1). .SH SEE ALSO .BR potooledit (1), .BR iconv (1), .BR msgmerge (1), .BR msgfmt (1). .br .SH AUTHOR change-po-charset was written by Marcin Owsiany . potool-0.16/change-po-charset.pl.1000066400000000000000000000020611202505426200167350ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH CHANGE-PO-CHARSET 1 "24 września 2007" .\" Proszę aktualizować datę przy zmianach treści .SH NAZWA change-po-charset \- zmienia atrybut charset w nagłówku content-type w pliku po gettext .SH SKŁADNIA .B change-po-charset .RI .RI PLIK1 .RI [ " PLIK2 " ... ] .SH OPIS .B change-po-charset to prosty skrypt w Perlu, który czyta podane pliki, i wypisuje je na standardowym wyjściu, dokonując tylko następującej modyfikacji. W pierwszym wpisie msgstr jaki napotka, zmienia wartość atrybutu "charset" w nagłówku Content-Type na taką, jak pierwszy parametr z jakim został uruchomiony. .sp Uwaga: skrypt nie zmienia samego kodowania znaków w treści plików. Jest on używany przez .BR potooledit (1) w celu poprawienia nagłówka Content-Type po zmianie kodowania pliku przy pomocy .BR iconv (1). .SH PATRZ TAKŻE .BR potooledit (1), .BR iconv (1), .BR msgmerge (1), .BR msgfmt (1). .br .SH AUTOR change-po-charset został napisany przez Marcina Owsianego . potool-0.16/common.h000066400000000000000000000011741202505426200144160ustar00rootroot00000000000000/* * potool is a program aiding editing of po files * Copyright (C) 1999-2002 Zbigniew Chyla * * see LICENSE for licensing info */ #ifndef COMMON_H #define COMMON_H #include #define g_slist_free_custom(list,free_func) \ G_STMT_START { \ GSList *potool_list = (list), *potool_l; \ for (potool_l = potool_list; potool_l != NULL; potool_l = potool_l->next) \ free_func (potool_l->data); \ g_slist_free (potool_list); \ } G_STMT_END /* Critical error that causes the program to exit 1. * This is unlike g_error which calls abort() which dumps core. */ void po_error(const gchar *format, ...); #endif /* COMMON_H */ potool-0.16/i18n.h000066400000000000000000000003131202505426200136770ustar00rootroot00000000000000/* * potool is a program aiding editing of po files * Copyright (C) 1999-2002 Zbigniew Chyla * * see LICENSE for licensing info */ #ifndef I18N_H #define I18N_H #define _(string) (string) #endif potool-0.16/po-gram.h000066400000000000000000000016331202505426200144700ustar00rootroot00000000000000/* * potool is a program aiding editing of po files * Copyright (C) 1999-2002 Zbigniew Chyla * Copyright (C) 2000-2012 Marcin Owsiany * * see LICENSE for licensing info */ #ifndef PO_GRAM_H #define PO_GRAM_H #include void po_scan_open_file(char *fn); void po_scan_close_file(void); void po_init_parser(void); /* ---- */ typedef struct { char *str; int num_lines; int *line_lengths; } StringBlock; typedef struct { GSList *std, *pos, *res; GSList *spec; } PoComments; typedef struct { StringBlock *ctx, *id, *id_plural; } PoPrevious; typedef struct { StringBlock *str; int n; } MsgStrX; typedef struct { PoComments comments; PoPrevious previous; gboolean is_fuzzy, is_c_format; StringBlock *ctx, *id, *id_plural, *str; GSList *msgstrxs; } PoEntry; typedef struct { GSList *entries, *obsolete_entries; } PoFile; PoFile *po_read (char *fn); #endif /* PO_GRAM_H */ potool-0.16/po-gram.lex000066400000000000000000000053211202505426200150270ustar00rootroot00000000000000%option noyywrap %option noinput %option nounput %option yylineno %{ /* * potool is a program aiding editing of po files * Copyright (C) 1999-2002 Zbigniew Chyla * Copyright (C) 2000-2012 Marcin Owsiany * * see LICENSE for licensing info */ #include #include #include #include "i18n.h" #include "po-gram.h" #include "po.tab.h" #include "common.h" static YY_BUFFER_STATE buf_state = (YY_BUFFER_STATE) 0; static FILE *buf_file = NULL; void po_scan_open_file (char *fn) { if (buf_state != (YY_BUFFER_STATE) 0) { g_error (_("Trying to scan two files!")); } if ((buf_file = fopen (fn, "r")) == NULL) { po_error (_("Can't open input file: %s\n"), fn); } buf_state = yy_create_buffer (buf_file, YY_BUF_SIZE); yy_switch_to_buffer (buf_state); } // I don't know why lex' own declaration is not visible to this block, but // using this seems to be the only way to avoid leaks. int polex_destroy (void); void po_scan_close_file (void) { if (buf_state == (YY_BUFFER_STATE) 0) { g_error (_("Can't delete input buffer!")); } yy_delete_buffer (buf_state); buf_state = NULL; fclose(buf_file); buf_file = NULL; polex_destroy(); } %} %% "msgctxt" { return MSGCTXT; } "msgid" { return MSGID; } "msgid_plural" { return MSGID_PLURAL; } "#| msgctxt" { return PREVIOUS_MSGCTXT; } "#| msgid" { return PREVIOUS_MSGID; } "#| msgid_plural" { return PREVIOUS_MSGID_PLURAL; } "msgstr" { return MSGSTR; } "["[0-9]*"]" { polval.str_val = g_strndup (yytext + 1, yyleng - 2); return MSGSTR_X; } \"(\\.|[^\\"])*\" { polval.str_val = g_strndup (yytext + 1, yyleng - 2); return STRING; } "#~ msgctxt" { return OBSOLETE_MSGCTXT; } "#~ msgid" { return OBSOLETE_MSGID; } "#~ msgid_plural" { return OBSOLETE_MSGID_PLURAL; } "#~| msgctxt" { return OBSOLETE_PREVIOUS_MSGCTXT; } "#~| msgid" { return OBSOLETE_PREVIOUS_MSGID; } "#~| msgid_plural" { return OBSOLETE_PREVIOUS_MSGID_PLURAL; } "#~ msgstr" { return OBSOLETE_MSGSTR; } "#~ "\"(\\.|[^\\"])*\" { polval.str_val = g_strndup (yytext + 4, yyleng - 5); return OBSOLETE_STRING; } "#:".*"\n" { polval.str_val = g_strndup (yytext + 2, yyleng - 3); return COMMENT_POS; } "#,".*"\n" { polval.str_val = g_strndup (yytext + 2, yyleng - 3); return COMMENT_SPECIAL; } "# ".*"\n" { polval.str_val = g_strndup (yytext + 1, yyleng - 2); return COMMENT_STD; } "#\n" { polval.str_val = g_strdup (""); return COMMENT_STD; } "#"[^|~\n].*"\n" { polval.str_val = g_strndup (yytext + 1, yyleng - 2); return COMMENT_RESERVED; } [ \t\v\f\n] { ; } . { return INVALID; } %% potool-0.16/po-gram.y000066400000000000000000000223651202505426200145160ustar00rootroot00000000000000%{ /* * potool is a program aiding editing of po files * Copyright (C) 1999-2002 Zbigniew Chyla * Copyright (C) 2000-2012 Marcin Owsiany * * see LICENSE for licensing info */ #include #include #include #include #include #include #include #include #include "po-gram.h" #include "common.h" #include "i18n.h" int polineno; int polex (void); void poerror (const char *s); static GSList *entries = NULL, *obsolete_entries = NULL; static StringBlock *concat_strings (GSList *slist); %} %error-verbose %union { int int_val; char *str_val; StringBlock *stringblock_val; GSList *gslist_val; PoEntry *entry_val; PoComments comments_val; PoPrevious previous_val; MsgStrX *msgstrx_val; } %token MSGCTXT PREVIOUS_MSGCTXT OBSOLETE_MSGCTXT OBSOLETE_PREVIOUS_MSGCTXT %token MSGID MSGID_PLURAL PREVIOUS_MSGID PREVIOUS_MSGID_PLURAL %token OBSOLETE_MSGID OBSOLETE_MSGID_PLURAL OBSOLETE_PREVIOUS_MSGID OBSOLETE_PREVIOUS_MSGID_PLURAL %token MSGSTR OBSOLETE_MSGSTR INVALID %token MSGSTR_X %token STRING %token OBSOLETE_STRING %token COMMENT_STD %token COMMENT_POS %token COMMENT_SPECIAL %token COMMENT_RESERVED %type msgctx %type obsolete_msgctx %type previous_ctx %type obsolete_previous_ctx %type previous_id %type obsolete_previous_id %type previous_id_plural %type obsolete_previous_id_plural %type string_list %type obsolete_string_list %type really_obsolete_string_list %type msg_list %type obsolete_msg_list %type msgstr_x_list %type obsolete_msgstr_x_list %type msgstr_x %type obsolete_msgstr_x %type comments %type previous %type obsolete_previous %type msg %type obsolete_msg %start translation_unit %% translation_unit : msg_list { entries = g_slist_reverse ($1); obsolete_entries = NULL; } | msg_list obsolete_msg_list { entries = g_slist_reverse ($1); obsolete_entries = g_slist_reverse ($2); } ; msg_list : msg { $$ = g_slist_append (NULL, $1); } | msg_list msg { $$ = g_slist_prepend ($1, $2); } ; obsolete_msg_list : obsolete_msg { $$ = g_slist_append (NULL, $1); } | obsolete_msg_list obsolete_msg { $$ = g_slist_prepend ($1, $2); } ; comments : /* empty */ { $$.std = NULL; $$.pos = NULL; $$.spec = NULL; $$.res = NULL; } | comments COMMENT_STD { $$ = $1; $$.std = g_slist_append ($$.std, $2); } | comments COMMENT_POS { $$ = $1; $$.pos = g_slist_append ($$.pos, $2); } | comments COMMENT_SPECIAL { $$ = $1; $$.spec = g_slist_append ($$.spec, $2); } | comments COMMENT_RESERVED { $$ = $1; $$.res = g_slist_append ($$.res, $2); } ; previous_ctx : /* empty */ { $$ = NULL; } | PREVIOUS_MSGCTXT string_list { $$ = concat_strings($2); g_slist_free_custom ($2, g_free); } ; previous_id : /* empty */ { $$ = NULL; } | PREVIOUS_MSGID string_list { $$ = concat_strings($2); g_slist_free_custom ($2, g_free); } ; previous_id_plural : /* empty */ { $$ = NULL; } | PREVIOUS_MSGID_PLURAL string_list { $$ = concat_strings($2); g_slist_free_custom ($2, g_free); } ; previous : previous_ctx previous_id previous_id_plural { $$.ctx = $1; $$.id = $2; $$.id_plural = $3; } ; obsolete_previous_ctx : /* empty */ { $$ = NULL; } | OBSOLETE_PREVIOUS_MSGCTXT string_list { $$ = concat_strings($2); g_slist_free_custom ($2, g_free); } ; obsolete_previous_id : /* empty */ { $$ = NULL; } | OBSOLETE_PREVIOUS_MSGID string_list { $$ = concat_strings($2); g_slist_free_custom ($2, g_free); } ; obsolete_previous_id_plural : /* empty */ { $$ = NULL; } | OBSOLETE_PREVIOUS_MSGID_PLURAL string_list { $$ = concat_strings($2); g_slist_free_custom ($2, g_free); } ; obsolete_previous : obsolete_previous_ctx obsolete_previous_id obsolete_previous_id_plural { $$.ctx = $1; $$.id = $2; $$.id_plural = $3; } ; msgstr_x : MSGSTR MSGSTR_X string_list { $$ = g_new(MsgStrX, 1); $$->n = atoi($2); $$->str = concat_strings ($3); g_free ($2); g_slist_free_custom ($3, g_free); } ; obsolete_msgstr_x : OBSOLETE_MSGSTR MSGSTR_X obsolete_string_list { $$ = g_new(MsgStrX, 1); $$->n = atoi($2); $$->str = concat_strings ($3); g_free ($2); g_slist_free_custom ($3, g_free); } ; msgstr_x_list : msgstr_x { $$ = g_slist_append (NULL, $1); } | msgstr_x_list msgstr_x { $$ = g_slist_append ($1, $2); } ; obsolete_msgstr_x_list : obsolete_msgstr_x { $$ = g_slist_append (NULL, $1); } | obsolete_msgstr_x_list obsolete_msgstr_x { $$ = g_slist_append ($1, $2); } ; msgctx : /* empty */ { $$ = NULL; } | MSGCTXT string_list { $$ = concat_strings ($2); g_slist_free_custom ($2, g_free); } ; obsolete_msgctx : /* empty */ { $$ = NULL; } | OBSOLETE_MSGCTXT obsolete_string_list { $$ = concat_strings ($2); g_slist_free_custom ($2, g_free); } ; msg : comments previous msgctx MSGID string_list MSGSTR string_list { GSList *l; $$ = g_new (PoEntry, 1); $$->ctx = $3; $$->id = concat_strings ($5); $$->id_plural = NULL; $$->str = concat_strings ($7); $$->msgstrxs = NULL; $$->comments = $1; $$->previous = $2; $$->is_fuzzy = $$->is_c_format = 0; for (l = $$->comments.spec; l != NULL; l = l->next) { char *s = l->data; if (strstr (s, " fuzzy") != NULL) { $$->is_fuzzy = 1; } if (strstr (s, " c-format") != NULL) { $$->is_c_format = 1; } } g_slist_free_custom ($5, g_free); g_slist_free_custom ($7, g_free); } | comments previous msgctx MSGID string_list MSGID_PLURAL string_list msgstr_x_list { GSList *l; $$ = g_new (PoEntry, 1); $$->ctx = $3; $$->id = concat_strings ($5); $$->id_plural = concat_strings ($7); $$->str = NULL; $$->msgstrxs = $8; $$->comments = $1; $$->previous = $2; $$->is_fuzzy = $$->is_c_format = 0; for (l = $$->comments.spec; l != NULL; l = l->next) { char *s = l->data; if (strstr (s, " fuzzy") != NULL) { $$->is_fuzzy = 1; } if (strstr (s, " c-format") != NULL) { $$->is_c_format = 1; } } g_slist_free_custom ($5, g_free); g_slist_free_custom ($7, g_free); } ; obsolete_msg : comments obsolete_previous obsolete_msgctx OBSOLETE_MSGID obsolete_string_list OBSOLETE_MSGSTR obsolete_string_list { GSList *l; $$ = g_new (PoEntry, 1); $$->ctx = $3; $$->id = concat_strings ($5); $$->id_plural = NULL; $$->str = concat_strings ($7); $$->msgstrxs = NULL; $$->comments = $1; $$->previous = $2; $$->is_fuzzy = $$->is_c_format = 0; for (l = $$->comments.spec; l != NULL; l = l->next) { char *s = l->data; if (strstr (s, " fuzzy") != NULL) { $$->is_fuzzy = 1; } if (strstr (s, " c-format") != NULL) { $$->is_c_format = 1; } } g_slist_free_custom ($5, g_free); g_slist_free_custom ($7, g_free); } | comments obsolete_previous obsolete_msgctx OBSOLETE_MSGID obsolete_string_list OBSOLETE_MSGID_PLURAL obsolete_string_list obsolete_msgstr_x_list { GSList *l; $$ = g_new (PoEntry, 1); $$->ctx = $3; $$->id = concat_strings ($5); $$->id_plural = concat_strings ($7); $$->str = NULL; $$->msgstrxs = $8; $$->comments = $1; $$->previous = $2; $$->is_fuzzy = $$->is_c_format = 0; for (l = $$->comments.spec; l != NULL; l = l->next) { char *s = l->data; if (strstr (s, " fuzzy") != NULL) { $$->is_fuzzy = 1; } if (strstr (s, " c-format") != NULL) { $$->is_c_format = 1; } } g_slist_free_custom ($5, g_free); g_slist_free_custom ($7, g_free); } ; string_list : STRING { $$ = g_slist_append (NULL, $1); } | string_list STRING { $$ = g_slist_append ($1, $2); } ; obsolete_string_list : STRING { $$ = g_slist_append (NULL, $1); } | STRING really_obsolete_string_list { $$ = g_slist_prepend ($2, $1); } ; really_obsolete_string_list : OBSOLETE_STRING { $$ = g_slist_append (NULL, $1); } | really_obsolete_string_list OBSOLETE_STRING { $$ = g_slist_append ($1, $2); } ; /* ---------- ---------- */ %% #include extern char potext[]; extern int column; void po_init_parser (void) { } static StringBlock* concat_strings (GSList *slist) { GSList *l; int total_len = 0, i = 0; char *p; StringBlock *ret = g_new(StringBlock, 1); ret->num_lines = 0; for (l = slist; l != NULL; l = l->next) { total_len += strlen (l->data); ret->num_lines++; } ret->str = g_malloc (total_len + 1); ret->line_lengths = g_malloc (sizeof(int) * ret->num_lines); p = ret->str; for (l = slist; l != NULL; l = l->next) { char *s = l->data; int len = strlen (s); if (len > 0) { g_memmove (p, s, len); p += len; } ret->line_lengths[i++] = len; } ret->str[total_len] = '\0'; return ret; } void poerror (const char *s) { fflush (stdout); po_error (_("Parse error at line %d: %s\n"), polineno, s); } PoFile * po_read (char *fn) { PoFile *pof; po_scan_open_file (fn); po_init_parser (); poparse (); po_scan_close_file (); pof = g_new (PoFile, 1); pof->entries = entries; pof->obsolete_entries = obsolete_entries; return pof; } potool-0.16/poedit.1000066400000000000000000000047721202505426200143320ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH POEDIT 1 "September 15, 2012" .\" Please adjust this date whenever revising the manpage. .SH NAME poedit \- program to aid editing gettext po files .SH SYNOPSIS .B poedit .RI [\-a] .RI [\-p] .RI [\-n] .RI .sp .B potooledit .RI [\-a] .RI [\-p] .RI [\-n] .RI .SH DESCRIPTION .B poedit is a shell script, which uses .BR potool (1), .BR iconv (1) and your favourite editor to help you edit gettext po files. .P It first retrieves only the untranslated entries from the file (or, if .BR \-a is specified, reorders the entries so that the translated ones are grouped separately from the untranslated ones) and puts them into a temporary file. Then recodes the file to the charmap of your current locale, and runs your favourite editor on the temporary file so you can add new translations. After you have finished, it recodes the file back to the original charset and merges the new translations back into the original file. .P .B poedit is also known as .B potooledit on Debian systems, to avoid a name clash with an unrelated program of the same name. .SH OPTIONS .TP .B \-a causes poedit to include already translated entries as well in the temporary file for editing (they are grouped separately, though). .br Without this option, only the untranslated entries (and the file header) are presented for editing. .TP .B \-p causes poedit to keep the formatting of the file intact. Without this option, all strings will be re-wrapped at newlines or word boundaries to fit in 80 columns. .TP .B \-n causes poedit not to do .I any charset recoding before nor after editing the file. .br You should only use this option if you know what you are doing. Be particularly careful when using this option (without .BR \-a ) on files that are in an encoding incompatible with your locale's charmap. In that case, the intermediate file to be edited will probably only contain ASCII characters, which means your editor will be free to interpret this as your default locale encoding. This in turn, will make the file invalid when it is merged together with the already translated messages. See Debian bug #297074 for an example of this happening. .SH CAVEATS By default, the program re-wraps lines in all strings in the edited file. See the .B \-p option. .SH SEE ALSO .BR potool (1), .BR postats (1), .BR locale\ charmap (1), .BR msgmerge (1), .BR msgfmt (1). .br .SH AUTHOR Poedit was written by Zbigniew Chyla and is now being maintained by Marcin Owsiany . potool-0.16/poedit.pl.1000066400000000000000000000052671202505426200147440ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH POEDIT 1 "15 września 2012" .\" Proszę aktualizować datę przy zmianach treści .SH NAZWA poedit \- program wspomagający edycję plików po gettext .SH SKŁADNIA .B poedit .RI [\-a] .RI [\-p] .RI [\-n] .RI .sp .B potooledit .RI [\-a] .RI [\-p] .RI [\-n] .RI .SH OPIS .B poedit to skrypt powłoki, wspomagający edycję plików po gettext przy pomocy Twojego ulubionego edytora. Używa on także poleceń .BR potool (1) oraz .BR iconv (1). .P W pierwszej kolejności poedit pobiera nieprzetłumaczone wpisy z podanego pliku (lub, jeśli podano opcję .BR \-a , zmienia kolejność wpisów tak, aby przetłumaczone wpisy były skupione osobno, a nieprzetłumaczone - osobno) i umieszcza je w pliku tymczasowym. Następnie zmienia kodowanie pliku na takie, jakiego używa locale środowiska, i otwiera go w Twoim ulubionym edytorze, umożliwiając dodanie nowych tłumaczeń. Po zamknięciu edytora, przekodowuje plik tymczasowy z powrotem do oryginalnego kodowania, i włącza zmienione tłumaczenia z powrotem od oryginalnego pliku. .P .B poedit jest także znany pod nazwą .B potooledit w systemie Debian, aby uniknąć kolizji z innym programem o tej samej nazwie. .SH OPCJE .TP .B \-a powoduje także włączenie przetłumaczonych wpisów do tymczasowego pliku do edycji (grupuje je jednak oddzielnie). .br Bez tej opcji tylko nieprzetłumaczone wpisy (i nagłówek pliku) są przedstawione do edycji. .TP .B \-p powoduje zachowanie oryginalnego formatowania. Bez tej opcji program zawija na znakach końca linii lub między wyrazami wszystkie linie w edytowanych plikach tak aby zmieściły się w 80 kolumnach. .TP .B \-n powoduje .I zaniechanie jakiejkolwiek zmiany kodowania przed lub po edycji pliku. .br Należy unikać używania tej opcji bez konkretnej potrzeby lub zrozumienia jej konsekwencji (zwłaszcza gdy nie używa się .BR \-a ) w przypadku plików w kodowaniu niezgodnym z kodowaniem bieżącego locale. W tym przypadku tymczasowy plik do edycji będzie zawierał prawdopodobnie jedynie znaki ASCII, w związku z czym edytor będzie mógł zinterpretować jego kodowanie jako kodowanie locale. To z kolei spowoduje, że po połączeniu z tymczasowym plikiem, wyjściowy będzie nieprawidłowy. Zgłoszenie błędu Debiana #297074 zawiera przykładowy opis takiej sytuacji. .SH PRZESTROGI Domyślnie ten program zawija po swojemu wszystkie linie w edytowanych plikach. Patrz też opcja .B \-p .SH ZOBACZ TAKŻE .BR potool (1), .BR postats (1), .BR locale\ charmap (1), .BR msgmerge (1), .BR msgfmt (1). .SH AUTOR Potool został napisany przez Zbigniewa Chylę, a obecnie jego opiekunem jest Marcin Owsiany . potool-0.16/postats.1000066400000000000000000000016421202505426200145340ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH POSTATS 1 "September 24, 2007" .\" Please adjust this date whenever revising the manpage. .SH NAME postats \- summarize translation progress of gettext po files .SH SYNOPSIS .B postats .RI [ \-f ] .RI [ FILENAME\ ... ] .SH DESCRIPTION .B postats is a simple shell script, which uses .BR potool (1) and .BR wc (1) displays the count of translated and non-translated entries (with the percentage) in the specified files. If no files are specified, it defaults to all files with extension ".po" in the current directory. It also displays a summary count for all the files. .SH OPTIONS .TP .B \-f causes postats do include the counts of fuzzy entries as well. .SH SEE ALSO .BR potool (1), .BR wc (1), .BR msgmerge (1), .BR msgfmt (1). .br .SH AUTHOR postats was written by Zbigniew Chyla and is currently being maintained by Marcin Owsiany . potool-0.16/postats.pl.1000066400000000000000000000017441202505426200151510ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH POSTATS 1 "24 września 2007" .\" Proszę aktualizować datę przy zmianach treści .SH NAZWA postats \- podsumowuje postęp tłumaczenia plików po gettext .SH SKŁADNIA .B postats .RI [ \-f ] .RI [ PLIK\ ... ] .SH OPIS .B postats to prosty skrypt powłoki, który wyświetla ilość (oraz stosunek) przetłumaczonych i nieprzetłumaczonych wpisów w podanych plikach po, używając do tego celu programów .BR potool (1) oraz .BR wc (1). Jeśli nie podano plików, domyślnie działa na wszystkich plikach z rozszerzeniem ".po" w bieżącym katalogu. postats wyświetla także łączne podsumowanie wszystkich podanych plików. .SH OPCJE .TP .B \-f sprawia, że postats wyświetla także ilość wpisów "fuzzy". .SH ZOBACZ TAKŻE .BR potool (1), .BR wc (1), .BR msgmerge (1), .BR msgfmt (1). .br .SH AUTOR postats został napisany przez Zbigniewa Chylę a obecnie jego opiekunem jest Marcin Owsiany . potool-0.16/potool.1000066400000000000000000000065711202505426200143610ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH POTOOL 1 "September 15, 2012" .\" Please adjust this date whenever revising the manpage. .SH NAME potool \- program for manipulating gettext po files .SH SYNOPSIS .B potool .RI FILENAME1 .RI [ " FILENAME2 " ] .RI [\-f " f|nf|t|nt|nth|o|no"] .RI [\-n " ctxt|id|str|cmt|ucmt|pcmt|scmt|dcmt|tr|linf"]... .RI [\-s] .RI [\-p] .RI [\-c] .sp .B potool .RI \-h .SH DESCRIPTION .B potool works in two (so far) modes. The first mode requires providing one file name, and works as a filter. In the second mode, the program .I replaces the translations in .RI FILENAME1 with the translations from .RI FILENAME2. (So FILENAME1 is the base po file, while FILENAME2 is our working copy.) .SH OPTIONS .TP .B \-f filter Determines which po file entries should be .I retained. In the second mode, the filters are applied only to .RI FILENAME2 (the working copy). Existing filters are: .br t \- translated entries .br nt \- untranslated entries .br nth \- untranslated entries and the header .br f \- fuzzy entries .br nf \- entries that are not fuzzy .br o \- obsolete entries .br no \- non-obsolete entries .br It is possible to stack filters, by specifying multiple -f options. .TP .B \-n filter Determines which po file entries parts should .I not be retained. Any number of -n options is allowed. Valid parameters are: .br ctxt \- don't write 'ctxt' parts .br id \- don't write 'id' parts .br str \- don't write 'str' parts .br tr \- don't write translations .br ucmt \- don't write user's comments .br pcmt \- don't write the comments regarding position in source files .br scmt \- don't write special comments ('#, fuzzy, c-format, ...') .br dcmt \- don't write reserved comments (usually starting with a dot) .br cmt \- don't write any comments .br linf \- change source line numbers to '1'. .sp The last parameter is useful when you need to compare two po or pot files using .BR diff (1) as it usually returns lots of unimportant line number changes otherwise. .TP .B \-s Don't display the entries themselves, only their count. .TP .B \-p causes potool to keep the formatting of the file intact. Without this option, all strings will be re-wrapped in the output at newlines or word boundaries to fit in 80 columns. .TP .B \-c Overwrite all msgstrs with their msgids. .TP .B \-h Display short usage help. .SH EXAMPLES .TP potool x.po -s -ft displays the number of translated entries. See also .BR postats (1). .TP potool x.po -nstr Deletes all translations - so you can start from scratch! :-) .TP potool x.po -ft && potool x.po -fnt displays firstly the translated and then the non-translated entries from file x.po (reverse order is not recommended because of the first "header" entry). The output contains all information from x.po, with the difference that untranslated entries are located together in a single place. .TP potool x.po -fnt > tmp.po && editor tmp.po && potool x.po tmp.po lets you easily add new translations, without looking at the already translated entries .P The last two examples are implemented as the .BR potooledit (1) program. .SH CAVEATS By default, the program re-wraps lines in all strings in the output. See the .B \-p option. .SH SEE ALSO .BR potooledit (1), .BR postats (1), .BR msgmerge (1), .BR msgfmt (1). .br .SH AUTHOR Potool was written by Zbigniew Chyla and is now being maintained by Marcin Owsiany . potool-0.16/potool.c000066400000000000000000000442161202505426200144410ustar00rootroot00000000000000/* * potool is a program aiding editing of po files * Copyright (C) 1999-2002 Zbigniew Chyla * Copyright (C) 2000-2012 Marcin Owsiany * * see LICENSE for licensing info */ #include #include #include #include #include #include #include #include #include #include "i18n.h" #include "common.h" #include "po-gram.h" #define RMARGIN 80 typedef gboolean po_filter_func (PoEntry *); void po_error(const gchar *format, ...) { va_list ap; va_start(ap, format); g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, ap); va_end(ap); exit(1); } void stringblock_free(StringBlock *block) { if (block == NULL) return; g_free (block->str); g_free (block->line_lengths); g_free (block); } void msgstrx_free(MsgStrX *msgstrx) { stringblock_free (msgstrx->str); g_free (msgstrx); } StringBlock* stringblock_dup(StringBlock *block) { if (block == NULL) return NULL; StringBlock *ret = g_new(StringBlock, 1); *ret = *block; ret->str = g_strdup (ret->str); ret->line_lengths = malloc(sizeof(int) * ret->num_lines); memcpy(ret->line_lengths, block->line_lengths, sizeof(int) * ret->num_lines); return ret; } void po_list_str_dup(GSList *list) { GSList *l; for (l = list; l != NULL; l = l->next) { char *s = l->data; l->data = g_strdup (s); } } void po_list_stringblock_dup(GSList *list) { GSList *l; for (l = list; l != NULL; l = l->next) { StringBlock *s = l->data; l->data = stringblock_dup (s); } } void po_list_msgstrx_dup(GSList *list) { GSList *l; for (l = list; l != NULL; l = l->next) { MsgStrX *s = l->data; MsgStrX *n = g_new (MsgStrX, 1); n->n = s->n; n->str = stringblock_dup(s->str); l->data = n; } } PoEntry * po_entry_copy (PoEntry *ret, PoEntry *po) { if (ret == NULL) ret = g_new (PoEntry, 1); ret->comments.std = g_slist_copy (po->comments.std); po_list_str_dup(ret->comments.std); ret->comments.pos = g_slist_copy (po->comments.pos); po_list_str_dup(ret->comments.pos); ret->comments.res = g_slist_copy (po->comments.res); po_list_str_dup(ret->comments.res); ret->comments.spec = g_slist_copy (po->comments.spec); po_list_str_dup(ret->comments.spec); ret->previous.ctx = stringblock_dup (po->previous.ctx); ret->previous.id = stringblock_dup (po->previous.id); ret->previous.id_plural = stringblock_dup (po->previous.id_plural); ret->is_fuzzy = po->is_fuzzy; ret->is_c_format = po->is_c_format; ret->ctx = stringblock_dup (po->ctx); ret->id = stringblock_dup (po->id); ret->id_plural = stringblock_dup (po->id_plural); ret->str = stringblock_dup (po->str); ret->msgstrxs = g_slist_copy (po->msgstrxs); po_list_msgstrx_dup(ret->msgstrxs); return ret; } void po_entry_free_contents (PoEntry *po) { g_slist_free_custom (po->comments.std, g_free); g_slist_free_custom (po->comments.pos, g_free); g_slist_free_custom (po->comments.res, g_free); g_slist_free_custom (po->comments.spec, g_free); g_slist_free_custom (po->msgstrxs, msgstrx_free); stringblock_free (po->previous.id); stringblock_free (po->previous.id_plural); stringblock_free (po->previous.ctx); stringblock_free (po->id); stringblock_free (po->id_plural); stringblock_free (po->ctx); stringblock_free (po->str); } void po_entry_free (PoEntry *po) { po_entry_free_contents (po); g_free (po); } void po_free (PoFile *pof) { g_slist_free_custom (pof->entries, po_entry_free); g_slist_free_custom (pof->obsolete_entries, po_entry_free); g_free (pof); } /* --- PoEntry filters --- */ gint msgstrx_is_same_firstchar (gconstpointer a, gconstpointer b) { const MsgStrX *as = a, *bs = b; return ! (as == bs || (as && bs && ((as->str == bs->str) || (as->str && as->str->str && bs->str && bs->str->str && as->str->str[0] == bs->str->str[0])))); } static gboolean po_filter_translated (PoEntry *po) { if (po->str && po->str->str) return po->str->str[0] != '\0'; /* With plural forms, only return true if ALL forms are translated. The * list is guaranteed to be non-empty by the grammar */ else { int one_empty_line[] = { 0 }; StringBlock empty_block = { "", 1, one_empty_line }; MsgStrX empty = { &empty_block, 0 }; return NULL == g_slist_find_custom (po->msgstrxs, &empty, msgstrx_is_same_firstchar); } } static gboolean po_filter_not_translated (PoEntry *po) { if (po->str && po->str->str) return po->str->str[0] == '\0'; /* With plural forms, only return true if ANY forms are not translated. * The list is guaranteed to be non-empty by the grammar */ else { int one_empty_line[] = { 0 }; StringBlock empty_block = { "", 1, one_empty_line }; MsgStrX empty = { &empty_block, 0 }; return NULL != g_slist_find_custom (po->msgstrxs, &empty, msgstrx_is_same_firstchar); } } static gboolean po_filter_not_translated_and_header (PoEntry *po) { if (po->id->str[0] == '\0') return 1; else return po_filter_not_translated (po); } static gboolean po_filter_fuzzy (PoEntry *po) { return po->is_fuzzy; } static gboolean po_filter_not_fuzzy (PoEntry *po) { return !po->is_fuzzy; } /* -- */ static void po_apply_filter (PoFile *pof, po_filter_func *filter) { GSList *npo_list, *l; for (npo_list = NULL, l = pof->entries; l != NULL; l = l->next) { if (filter ((PoEntry *) l->data)) { npo_list = g_slist_prepend (npo_list, l->data); } else { po_entry_free (l->data); } } g_slist_free (pof->entries); pof->entries = g_slist_reverse (npo_list); for (npo_list = NULL, l = pof->obsolete_entries; l != NULL; l = l->next) { if (filter ((PoEntry *) l->data)) { npo_list = g_slist_prepend (npo_list, l->data); } else { po_entry_free (l->data); } } g_slist_free (pof->obsolete_entries); pof->obsolete_entries = g_slist_reverse (npo_list); } typedef enum { FUZZY_FILTER = 1 << 0, NOT_FUZZY_FILTER = 1 << 1, TRANSLATED_FILTER = 1 << 2, NOT_TRANSLATED_FILTER = 1 << 3, NOT_TRANSLATED_H_FILTER = 1 << 4, // same as NOT_TRANSLATED_FILTER but includes msgid "" header OBSOLETE_FILTER = 1 << 5, NOT_OBSOLETE_FILTER = 1 << 6, } PoFilters; static void po_apply_filters (PoFile *pof, PoFilters filters) { if ((filters & FUZZY_FILTER) != 0) { po_apply_filter (pof, po_filter_fuzzy); } if ((filters & NOT_FUZZY_FILTER) != 0) { po_apply_filter (pof, po_filter_not_fuzzy); } if ((filters & TRANSLATED_FILTER) != 0) { po_apply_filter (pof, po_filter_translated); } if ((filters & NOT_TRANSLATED_FILTER) != 0) { po_apply_filter (pof, po_filter_not_translated); } if ((filters & NOT_TRANSLATED_H_FILTER) != 0) { po_apply_filter (pof, po_filter_not_translated_and_header); } if ((filters & OBSOLETE_FILTER) != 0) { g_slist_free_custom (pof->entries, po_entry_free); pof->entries = NULL; } if ((filters & NOT_OBSOLETE_FILTER) != 0) { g_slist_free_custom (pof->obsolete_entries, po_entry_free); pof->obsolete_entries = NULL; } } static void po_copy_msgid (PoFile *pof) { GSList *l; for (l = pof->entries; l != NULL; l = l->next) { PoEntry *po = l->data; if (po->str) { stringblock_free (po->str); po->str = stringblock_dup (po->id); } else { MsgStrX *m = g_new (MsgStrX, 1); m->n = 0; m->str = stringblock_dup (po->id); g_slist_free_custom (po->msgstrxs, msgstrx_free); po->msgstrxs = g_slist_append(NULL, m); } } } /* --- */ typedef enum { NO_CTX = 1 << 0, NO_ID = 1 << 1, NO_STR = 1 << 2, NO_STD_COMMENT = 1 << 3, NO_POS_COMMENT = 1 << 4, NO_SPEC_COMMENT = 1 << 5, NO_RES_COMMENT = 1 << 6, NO_PREVIOUS = 1 << 7, NO_TRANSLATION = 1 << 8, NO_LINF = 1 << 9 } po_write_modes; enum { SEP1 = ' ', SEP2 = '\t' }; int potool_printf(char *format, ...) { va_list ap; int ret; va_start(ap, format); ret = vprintf(format, ap); if (ret < 0) po_error(_("printf() failed with code %d: %s"), ret, strerror(errno)); va_end(ap); return ret; } static void print_multi_line (const StringBlock *s, int start_offset, const char *prefix, gboolean preserve_wrapping) { int slen, prefix_len; char *eol_ptr; gboolean has_final_eol; char **lines, **ln; enum { max_len = 77 }; if (preserve_wrapping) { int i, offset = 0; for (i = 0; i < s->num_lines; i++) { int line_len = s->line_lengths[i]; if (i > 0) { potool_printf ("%s", prefix); } potool_printf ("\"%.*s\"\n", line_len, s->str + offset); offset += line_len; } return; } slen = strlen (s->str); eol_ptr = strstr (s->str, "\\n"); if ((eol_ptr == NULL || (eol_ptr - s->str + 2 == slen)) && slen < (RMARGIN - 2 - start_offset)) { potool_printf ("\"%s\"\n", s->str); return; } potool_printf ("\"\"\n"); prefix_len = strlen (prefix); has_final_eol = strcmp (s->str + slen - 2, "\\n") == 0; lines = g_strsplit (s->str, "\\n", 0); for (ln = lines; *ln != NULL; ln++) { char *cur; int offset; gboolean line_has_eol; #if GLIB_MAJOR_VERSION == 2 if (*ln[0] == '\0' && *(ln + 1) == NULL) continue; #endif potool_printf ("%s\"", prefix); line_has_eol = has_final_eol || *(ln + 1) != NULL; offset = prefix_len; cur = *ln; do { int word_len = 0; int eol_len; int ret; while (cur[word_len] != SEP1 && cur[word_len] != SEP2 && cur[word_len] != '\0') word_len++; while (cur[word_len] == SEP1 || cur[word_len] == SEP2) word_len++; if (line_has_eol && cur[word_len] == '\0' && (word_len == 0 || (cur[word_len - 1] != SEP1 && cur[word_len - 1] != SEP2))) { eol_len = 2; } else { eol_len = 0; } if (offset + word_len + eol_len > max_len) { potool_printf ("\"\n%s\"", prefix); offset = prefix_len; } if ((ret = fwrite(cur, 1, word_len, stdout)) != word_len) po_error(_("fwrite() failed, returned %d instead of %d: %s"), ret, word_len, strerror(errno)); offset += word_len; cur += word_len; } while (*cur != '\0'); if (line_has_eol) { if (offset + 2 > max_len) { potool_printf ("\"\n%s\"\\n", prefix); } else { potool_printf ("\\n"); } } potool_printf ("\"\n"); } g_strfreev (lines); } static void write_msgstr (char *prefix, StringBlock *str, GSList *strn, po_write_modes mode, gboolean preserve_wrapping) { int prefix_len = strlen(prefix); if (!(mode & NO_TRANSLATION)) { if (str && str->str) { potool_printf ("%smsgstr ", prefix); print_multi_line (str, 7 + prefix_len, prefix, preserve_wrapping); } else { GSList *x; for (x = strn; x != NULL; x = x->next) { MsgStrX *m = x->data; potool_printf ("%smsgstr[%d] ", prefix, m->n); print_multi_line (m->str, 10 + prefix_len, prefix, preserve_wrapping); } } } else { potool_printf ("%smsgstr \"\"\n", prefix); } } static void po_write (PoFile *pof, po_write_modes mode, gboolean preserve_wrapping) { GSList *l; for (l = pof->entries; l != NULL; l = l->next) { PoEntry *po = l->data; GSList *ll; if (!(mode & NO_STD_COMMENT)) { for (ll = po->comments.std; ll != NULL; ll = ll->next) { potool_printf ("#%s\n", (char *) ll->data); } } if (!(mode & NO_RES_COMMENT)) { for (ll = po->comments.res; ll != NULL; ll = ll->next) { potool_printf ("#%s\n", (char *) ll->data); } } if (!(mode & NO_POS_COMMENT)) { if (!(mode & NO_LINF)) { for (ll = po->comments.pos; ll != NULL; ll = ll->next) { potool_printf ("#:%s\n", (char *) ll->data); } } else { for (ll = po->comments.pos; ll != NULL; ll = ll->next) { char *s = g_strdup ((char *) ll->data); char *l, *r; l = r = s; while (*r != '\0') { if (*r == ':') { *l++ = ':'; *l++ = '1'; while (isdigit (*++r)) ; } else { *l++ = *r++; } } *l = '\0'; potool_printf ("#:%s\n", s); g_free (s); } } } if (!(mode & NO_SPEC_COMMENT)) { for (ll = po->comments.spec; ll != NULL; ll = ll->next) { potool_printf ("#,%s\n", (char *) ll->data); } } if (!(mode & NO_PREVIOUS)) { if (po->previous.ctx) { potool_printf ("#| msgctxt "); print_multi_line (po->previous.ctx, 11, "", preserve_wrapping); } if (po->previous.id) { potool_printf ("#| msgid "); print_multi_line (po->previous.id, 9, "", preserve_wrapping); } if (po->previous.id_plural) { potool_printf ("#| msgid_plural "); print_multi_line (po->previous.id, 16, "", preserve_wrapping); } } if ((!(mode & NO_CTX)) && po->ctx) { potool_printf ("msgctxt "); print_multi_line (po->ctx, 8, "", preserve_wrapping); } if (!(mode & NO_ID)) { potool_printf ("msgid "); print_multi_line (po->id, 6, "", preserve_wrapping); if (po->id_plural) { potool_printf ("msgid_plural "); print_multi_line (po->id_plural, 13, "", preserve_wrapping); } } if (!(mode & NO_STR)) { write_msgstr ("", po->str, po->msgstrxs, mode, preserve_wrapping); } if (l->next != NULL) { potool_printf ("\n"); } } if (pof->obsolete_entries != NULL) { potool_printf ("\n"); } for (l = pof->obsolete_entries; l != NULL; l = l->next) { PoEntry *po = l->data; GSList *ll; if (!(mode & NO_STD_COMMENT)) { for (ll = po->comments.std; ll != NULL; ll = ll->next) { potool_printf ("#%s\n", (char *) ll->data); } } if (!(mode & NO_SPEC_COMMENT)) { for (ll = po->comments.spec; ll != NULL; ll = ll->next) { potool_printf ("#,%s\n", (char *) ll->data); } } if (!(mode & NO_PREVIOUS)) { if (po->previous.ctx) { potool_printf ("#~| msgctxt "); print_multi_line (po->previous.ctx, 12, "", preserve_wrapping); } if (po->previous.id) { potool_printf ("#~| msgid "); print_multi_line (po->previous.id, 10, "", preserve_wrapping); } if (po->previous.id_plural) { potool_printf ("#~| msgid_plural "); print_multi_line (po->previous.id, 17, "", preserve_wrapping); } } if ((!(mode & NO_CTX)) && po->ctx) { potool_printf ("#~ msgctxt "); print_multi_line (po->ctx, 11, "#~ ", preserve_wrapping); } if (!(mode & NO_ID)) { potool_printf ("#~ msgid "); print_multi_line (po->id, 9, "#~ ", preserve_wrapping); if (po->id_plural) { potool_printf ("#~ msgid_plural "); print_multi_line (po->id_plural, 16, "#~ ", preserve_wrapping); } } if (!(mode & NO_STR)) { write_msgstr ("#~ ", po->str, po->msgstrxs, mode, preserve_wrapping); } if (l->next != NULL) { potool_printf ("\n"); } } } /* - */ typedef GHashTable PoEntry_set; static PoEntry_set * po_set_create (GSList *po_list) { GSList *l; PoEntry_set *hash = g_hash_table_new (g_str_hash, g_str_equal); for (l = po_list; l != NULL; l = l->next) { PoEntry *po = l->data; g_hash_table_insert (hash, po->id->str, po); } return hash; } static PoEntry_set * po_set_update (PoEntry_set *po_set, GSList *po_list) { GSList *l; for (l = po_list; l != NULL; l = l->next) { PoEntry *po = (PoEntry *) l->data, *hpo; if ((hpo = g_hash_table_lookup (po_set, po->id->str)) != NULL) { po_entry_free_contents (hpo); /* making a deep copy, since we are about to free po_list */ po_entry_copy (hpo, po); } else { g_warning (_("Unknown msgid: %s"), po->id->str); } } return po_set; } int main (int argc, char **argv) { int c; /* -- */ gboolean istats = FALSE; gboolean copy_msgid = FALSE; gboolean preserve_wrapping = FALSE; PoFilters ifilters = 0; po_write_modes write_mode = 0; while ((c = getopt (argc, argv, "f:n:scph")) != EOF) { switch (c) { case 'h' : fprintf (stderr, _( "Usage: %s FILENAME1 [FILENAME2] [FILTERS] [-s] [-c] [-p] [-h]\n" "\n" ), argv[0]); exit (EXIT_SUCCESS); break; case 'n' : if (strcmp (optarg, "ctxt") == 0) { write_mode |= NO_CTX; } else if (strcmp (optarg, "id") == 0) { write_mode |= NO_ID; } else if (strcmp (optarg, "str") == 0) { write_mode |= NO_STR; } else if (strcmp (optarg, "cmt") == 0) { write_mode |= NO_STD_COMMENT | NO_POS_COMMENT | NO_SPEC_COMMENT | NO_RES_COMMENT; } else if (strcmp (optarg, "ucmt") == 0) { write_mode |= NO_STD_COMMENT; } else if (strcmp (optarg, "pcmt") == 0) { write_mode |= NO_POS_COMMENT; } else if (strcmp (optarg, "scmt") == 0) { write_mode |= NO_SPEC_COMMENT; } else if (strcmp (optarg, "dcmt") == 0) { write_mode |= NO_RES_COMMENT; } else if (strcmp (optarg, "tr") == 0) { write_mode |= NO_TRANSLATION; } else if (strcmp (optarg, "linf") == 0) { write_mode |= NO_LINF; } else { po_error (_("Unknown parameter for -n option!")); } break; case 's' : istats = TRUE; break; case 'c': copy_msgid = TRUE; break; case 'p': preserve_wrapping = TRUE; break; case 'f' : if (strcmp (optarg, "f") == 0) { ifilters |= FUZZY_FILTER; } else if (strcmp (optarg, "nf") == 0) { ifilters |= NOT_FUZZY_FILTER; } else if (strcmp (optarg, "t") == 0) { ifilters |= TRANSLATED_FILTER; } else if (strcmp (optarg, "nt") == 0) { ifilters |= NOT_TRANSLATED_FILTER; } else if (strcmp (optarg, "nth") == 0) { ifilters |= NOT_TRANSLATED_H_FILTER; } else if (strcmp (optarg, "o") == 0) { ifilters |= OBSOLETE_FILTER; } else if (strcmp (optarg, "no") == 0) { ifilters |= NOT_OBSOLETE_FILTER; } else { po_error (_("Unknown filter \"%s\"!"), optarg); } break; case ':' : po_error (_("Invalid parameter!")); break; case '?' : po_error (_("Invalid option!")); break; default : g_assert_not_reached (); } } if (optind >= argc) { po_error (_("Input file not specified!")); } if (argc - optind == 1) { PoFile *pof; char *ifn = argv[optind]; pof = po_read (ifn); po_apply_filters (pof, ifilters); if (istats) { potool_printf (_("%d\n"), g_slist_length (pof->entries)); } else { if (copy_msgid) { po_copy_msgid (pof); } po_write (pof, write_mode, preserve_wrapping); } po_free (pof); } else { PoFile *bpof, *pof; PoEntry_set *bpo_set; char *bfn = argv[optind], *fn = argv[optind + 1]; bpof = po_read (bfn); bpo_set = po_set_create (bpof->entries); pof = po_read (fn); po_apply_filters (pof, ifilters); if (copy_msgid) { po_copy_msgid (pof); } bpo_set = po_set_update (bpo_set, pof->entries); po_write (bpof, write_mode, preserve_wrapping); g_hash_table_destroy (bpo_set); po_free (bpof); po_free (pof); } if (fflush(stdout) != 0) po_error(_("fflush(stdout) failed: %s"), strerror(errno)); return 0; } potool-0.16/potool.pl.1000066400000000000000000000077201202505426200147700ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH POTOOL 1 "21 września 2007" .\" Proszę aktualizować datę przy zmianach treści .SH NAZWA potool \- program do manipulowania plikami po gettext .SH SKŁADNIA .B potool .RI PLIK1 .RI [ " PLIK2 " ] .RI [\-f " f|nf|t|nt|nth|o|no"] .RI [\-n " ctxt|id|str|cmt|ucmt|pcmt|scmt|dcmt|tr|linf"]... .RI [\-s] .RI [\-p] .RI [\-c] .sp .B potool .RI \-h .SH OPIS .B potool pracuje w jednym z dwóch (na razie) trybów. W pierwszym wymaga podania jednej nazwy pliku i działa wówczas jak filtr. W drugim - powoduje .I zastąpienie tłumaczeń w pliku .RI PLIK1 tłumaczeniami z pliku .RI PLIK2 (zatem pierwszy plik jest plikiem bazowym, zaś drugi - naszym roboczym). .SH OPCJE .TP .B \-f filtr opisuje filtr, który określa, jakie wpisy w pliku .po powinny być .I zachowane (jest to filtr działający przy odczycie pliku). W drugim trybie pracy filtr uwzględniany jest tylko dla pliku .RI PLIK2 (roboczego). Istniejące filtry: .br t \- wpisy przetłumaczone, .br nt \- wpisy nie przetłumaczone, .br nth \- wpisy nie przetłumaczone i nagłówek, .br f \- wpisy 'fuzzy', .br nf \- wpisy bez oznaczenia fuzzy, .br o \- wpisy nieużywane (oznaczone przedrostkiem "#~ ") .br no \- wpisy używane .br Filtry można na siebie nakładać, używając kilku opcji -f. .TP .B \-n filtr działa w obu trybach pracy tak samo i określa, jakie informacje w każdym z wpisów .I nie powinny być wyświetlane przy wypisywaniu ich przez program. Dozwolona jest dowolna liczba opcji -n. Dopuszczalne parametry: .br ctxt \- nie wypisuj części 'ctxt' .br id \- nie wypisuj części 'id' .br str \- nie wypisuj części 'str' .br tr \- nie wypisuj tłumaczeń (lecz pustą część 'str') .br ucmt \- nie wypisuj komentarzy użytkownika .br pcmt \- nie wypisuj komentarzy określających położenie w plikach .br scmt \- nie wypisuj komentarzy specjalnych ('#, fuzzy, c-format, ...') .br dcmt \- nie wyświetlaj komentarzy zarezerwowanych (głównie rozpoczynających się kropką - '#. ...' .br cmt \- nie wyświetlaj żadnych komentarzy (połączenie ucmt, pcmt, scmt, dcmt) .br linf \- usuwaj informację o numerach linii w komentarzach określających położenie w plikach. .sp Ostatni parametr powoduje zamianę numerów linii na '1'. Jest to przydatne w przypadku porównywania dwóch plików po lub pot przy pomocy .BR diff (1), gdyż w zazwyczaj jego wyjście jest zaciemnione wieloma informacjami o mało interesujących zmianach numerów linii. .TP .B \-s powoduje wypisanie tylko liczby wpisów zamiast ich treści .TP .B \-p powoduje zachowanie oryginalnego formatowania. Bez tej opcji program zawija na znakach końca linii lub między wyrazami wszystkie linie na wyjściu tak aby zmieściły się w 80 kolumnach. .TP .B \-c kopiuje we wszystkich wpisach część 'id' do 'str' (być może zastępując tłumaczenie) .TP .B \-h wyświetla krótką informację na temat użycia. .SH PRZYKŁADY .TP potool x.po -s -ft wyświetla liczbę przetłumaczonych wpisów. Patrz także .BR postats (1). .TP potool x.po -nstr oczyszcza plik z tłumaczeń - a więc możemy zaczynać od zera ;) .TP potool x.po -ft && potool x.po -fnt wyświetla z pliku najpierw wpisy przetłumaczone, a następnie nie posiadające tłumaczenia (ze względu na pierwszy wpis nie zaleca się stosowania odwrotnej kolejności). Plik taki zawiera wszystkie informacje z x.po, natomiast braki w tłumaczeniach są skupione w jednym miejscu. .TP potool x.po -fnt > tmp.po && editor tmp.po && potool x.po tmp.po pozwala na proste dodawanie nowych tłumaczeń, bez przeglądania starych. .P Ostatnie dwa przykłady są zaimplementowane jako program .BR potooledit (1). .SH PRZESTROGI Domyślnie ten program zawija po swojemu wszystkie linie na wyjściu. Patrz też opcja .B \-p .SH ZOBACZ TAKŻE .BR potooledit (1), .BR postats (1), .BR msgmerge (1), .BR msgfmt (1). .SH AUTOR Potool został napisany przez Zbigniewa Chylę, a obecnie jego opiekunem jest Marcin Owsiany . potool-0.16/scripts/000077500000000000000000000000001202505426200144415ustar00rootroot00000000000000potool-0.16/scripts/poedit000077500000000000000000000103361202505426200156560ustar00rootroot00000000000000#!/bin/bash # Copyright (C) 2000-2012 Marcin Owsiany # # Set up temporary directory # POTMP=`mktemp -d -t poedit.XXXXXX` || exit 1 function usage() { echo "Usage: poedit [ -a ] [ -p ] [ -n ] " >&2 exit 1 } # # Check what msgs to include # INCLUDE_ALL_MSGS=no IGNORE_ENCODING=no PRESERVE_WRAPPING=no TEMP=`getopt -o anp -n 'poedit' -- "$@"` if [ $? != 0 ] ; then usage ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" while true ; do case "$1" in -a) INCLUDE_ALL_MSGS=yes shift ;; -n) IGNORE_ENCODING=yes shift ;; -p) PRESERVE_WRAPPING=yes shift ;; --) shift break ;; *) echo "Internal error!" >&2 exit 1 ;; esac done POFILE="$1" TMPFILE="$POTMP/`basename -- "$POFILE"`" TMPFILE2="$TMPFILE.tmp" # # Some sanity checks # [ -z "$POFILE" ] && usage if ! [ -w "$POFILE" ]; then echo "$POFILE: not writable" >&2 exit 1 fi if [ -n "$EDITOR" ]; then EDITCMD="$EDITOR" elif which sensible-editor >/dev/null 2>&1; then EDITCMD="sensible-editor" else echo '$EDITOR is not set, and sensible-editor is not available' >&2 exit 1 fi if [ $PRESERVE_WRAPPING = yes ]; then potool="potool -p" else potool="potool" fi # # Get file encoding # if [ $IGNORE_ENCODING = no ] ; then input_encoding=$($potool -ft -fnth "$POFILE" | egrep -m 1 -i '^"Content-Type:' | perl -p -e 's,^.*charset=(.*?)( *;.*)?\\n"$,$1,') if [ -z "$input_encoding" ] ; then echo "Failed to retrieve encoding from the content-type header." 1>&2 echo "Make sure the file has a proper header before running $0" 1>&2 exit 1 fi locale_encoding=$(locale charmap) if [ -z "$locale_encoding" ] ; then echo "Failed to retrieve the locale charmap. Something is very wrong." 1>&2 exit 1 fi fi # # Filter the file # if [ "$INCLUDE_ALL_MSGS" = "yes" ] then $potool "$POFILE" -ft -fno > "$TMPFILE" || { echo "Running '$potool \"$POFILE\" -ft -fno > \"$TMPFILE\"' failed with code $?" >&2; exit 1; } echo >> "$TMPFILE" $potool "$POFILE" -fnt >> "$TMPFILE" || { echo "Running '$potool \"$POFILE\" -fnt >> \"$TMPFILE\"' failed with code $?" >&2; exit 1; } echo >> "$TMPFILE" $potool "$POFILE" -ft -fo >> "$TMPFILE" || { echo "Running '$potool \"$POFILE\" -ft -fo >> \"$TMPFILE\"' failed with code $?" >&2; exit 1; } else $potool "$POFILE" -fnth > "$TMPFILE" || { echo "Running '$potool \"$POFILE\" -fnth > \"$TMPFILE\"' failed with code $?" >&2; exit 1; } fi if [ $IGNORE_ENCODING = no ] ; then # # Recode the file so it is in the locale's encoding # iconv -f "$input_encoding" -t "$locale_encoding" < "$TMPFILE" > "$TMPFILE2" if [ $? -ne 0 ]; then echo "Recoding from [$input_encoding] to [$locale_encoding] failed." 1>&2 echo "Temp. file: $TMPFILE" 1>&2 exit 1 fi # # Fix the charset information # change-po-charset "$locale_encoding" "$TMPFILE2" > "$TMPFILE" if [ $? -ne 0 ]; then echo "Failed to substitute the encoding attribute in the header." 1>&2 echo "Make sure the file has a proper header before running $0" 1>&2 echo "Temp. file: $TMPFILE2" 1>&2 exit 1 fi fi # # Run editor and update the file on success # $EDITCMD "$TMPFILE" editor_ret="$?" if [ $editor_ret -ne 0 ]; then echo "$EDITCMD exited abnormally (code $editor_ret), not updating the po file" 1>&2 exit 1 fi if [ $IGNORE_ENCODING = no ] ; then # # Change the charset information back # change-po-charset "$input_encoding" "$TMPFILE" > "$TMPFILE2" if [ $? -ne 0 ]; then echo "Failed to substitute the encoding attribute in the header." 1>&2 echo "Temp. file: " $TMPFILE 1>&2 exit 1 fi # # Recode the file back to the original encoding # iconv -f "$locale_encoding" -t "$input_encoding" < "$TMPFILE2" > "$TMPFILE" if [ $? -ne 0 ]; then echo "Recoding back from [$locale_encoding] to [$input_encoding] failed." 1>&2 echo "Temp. file: " $TMPFILE2 1>&2 exit 1 fi fi mv "$POFILE" "$POFILE~" || { echo "Failed to rename \"$POFILE\" to \"$POFILE~\""; exit 1; } $potool "$POFILE~" "$TMPFILE" > "$POFILE" if [ $? -eq 0 ]; then printf "Before: %s/%s\n" `$potool -ft -s "$POFILE~"` `$potool -s "$POFILE~"` printf "After: %s/%s\n" `$potool -ft -s "$POFILE"` `$potool -s "$POFILE"` rm -f "$POFILE~" "$TMPFILE" else mv -f "$POFILE~" "$POFILE" echo "Merging $POFILE with $TMPFILE failed" >&2 exit 1 fi rm -Rf "$POTMP" potool-0.16/scripts/postats000077500000000000000000000023521202505426200160660ustar00rootroot00000000000000#!/bin/bash # Copyright (C) 2000-207 Marcin Owsiany if [ "$1" = "-f" ] ; then fuzzy=1 shift fi if [ $# -gt 0 ]; then files=$* else files=*.po fi ( ntr=0 nall=0 for a in $files; do [ -f $a ] || continue tr=`potool $a -ft -s 2>/dev/null` [ $? -eq 0 ] || { echo "Error: \"potool $a -ft -s\" failed"; continue ; } all=`potool $a -s 2>/dev/null` [ $? -eq 0 ] || { echo "Error: \"potool $a -s\" failed"; continue ; } fuzzy=`potool $a -ff -s 2>/dev/null` [ $? -eq 0 ] || { echo "Error: \"potool $a -ff -s\" failed"; continue ; } if [ -n "$fuzzy" ] ; then printf '%-24s - %5s/%3s/%-5s (%3s%%) -%s\n' ${a} ${tr} ${fuzzy} ${all} $((${tr}*100/${all})) $(($all-$tr)) else printf '%-24s - %5s/%-5s (%3s%%) -%s\n' ${a} ${tr} ${all} $((${tr}*100/${all})) $(($all-$tr)) fi ntr=$((${ntr}+${tr})) nfuzzy=$((${nfuzzy}+${fuzzy})) nall=$((${nall}+${all})) done if [ -n "$fuzzy" ] ; then [ $nall -gt 0 ] && printf '%-24s - %5s/%3s/%-5s (%s%%) -%s\n' "x(100%)x" ${ntr} ${nfuzzy} ${nall} $((${ntr}*100/${nall})) $(($nall-$ntr)) else [ $nall -gt 0 ] && printf '%-24s - %5s/%-5s (%s%%) -%s\n' "x(100%)x" ${ntr} ${nall} $((${ntr}*100/${nall})) $(($nall-$ntr)) fi ) | sort -nt'(' -k 1 potool-0.16/scripts/poupdate000077500000000000000000000003751202505426200162150ustar00rootroot00000000000000#!/bin/bash MO_DIR=/usr/local/share/locale/pl/LC_MESSAGES if [ $# -gt 0 ]; then files=$* else files=*.po fi for f in $files; do [ -f $f ] || continue d=`echo $f | sed 's/\.po//'` echo $d rm -f ${MO_DIR}/$d.mo msgfmt $f -o ${MO_DIR}/$d.mo done potool-0.16/tests/000077500000000000000000000000001202505426200141145ustar00rootroot00000000000000potool-0.16/tests/1/000077500000000000000000000000001202505426200142545ustar00rootroot00000000000000potool-0.16/tests/1/f no.po000066400000000000000000000032221202505426200154350ustar00rootroot00000000000000# A test for potool, based on translation of gnome-games.po to Polish msgid "" msgstr "" "Project-Id-Version: gnome-games\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-11-12 15:56+0100\n" "PO-Revision-Date: 2006-11-15 21:14+0100\n" "Last-Translator: wadim dziedzic \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: ../aisleriot/aisleriot.schemas.in.h:1 msgid "Select the style of control" msgstr "Wybierz rodzaj sterowania" #: ../aisleriot/aisleriot.schemas.in.h:3 msgid "Select to click on the source then the destination." msgstr "" #: ../some/file.cc:1 #, fuzzy #| msgid "What is your name?" msgid "What was your name?" msgstr "Jak sie nazywasz?" #: ../gtali/gyahtzee.c:150 #, c-format msgid "%s wins the game with %d point" msgid_plural "%s wins the game with %d points" msgstr[0] "%s wygral(a) gre %d punktem" msgstr[1] "%s wygral(a) gre z %d punktami" msgstr[2] "%s wygral(a) gre z %d punktami" # should be treated as untranslated, but is treated as translated because # potool does not know about nplurals #: ../a.c:150 #, c-format msgid "%s bla" msgid_plural "%s blas" msgstr[0] "%s wygral(a) gre punktem" #: ../same-gnome/ui.c:76 #, c-format msgid "%d point" msgid_plural "%d points" msgstr[0] "%d punkt" msgstr[1] "%d punkty" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oja" msgid_plural "%d ojas" msgstr[0] "" msgstr[1] "" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oje" msgid_plural "%d ojes" msgstr[0] "" potool-0.16/tests/1/f nt.po000066400000000000000000000006551202505426200154510ustar00rootroot00000000000000#: ../aisleriot/aisleriot.schemas.in.h:3 msgid "Select to click on the source then the destination." msgstr "" #: ../same-gnome/ui.c:76 #, c-format msgid "%d point" msgid_plural "%d points" msgstr[0] "%d punkt" msgstr[1] "%d punkty" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oja" msgid_plural "%d ojas" msgstr[0] "" msgstr[1] "" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oje" msgid_plural "%d ojes" msgstr[0] "" potool-0.16/tests/1/f nth.po000066400000000000000000000017331202505426200156170ustar00rootroot00000000000000# A test for potool, based on translation of gnome-games.po to Polish msgid "" msgstr "" "Project-Id-Version: gnome-games\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-11-12 15:56+0100\n" "PO-Revision-Date: 2006-11-15 21:14+0100\n" "Last-Translator: wadim dziedzic \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: ../aisleriot/aisleriot.schemas.in.h:3 msgid "Select to click on the source then the destination." msgstr "" #: ../same-gnome/ui.c:76 #, c-format msgid "%d point" msgid_plural "%d points" msgstr[0] "%d punkt" msgstr[1] "%d punkty" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oja" msgid_plural "%d ojas" msgstr[0] "" msgstr[1] "" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oje" msgid_plural "%d ojes" msgstr[0] "" potool-0.16/tests/1/f o.po000066400000000000000000000003571202505426200152650ustar00rootroot00000000000000 #~ msgid "unknown" #~ msgstr "nieznany" #, fuzzy #~| msgid "Load CD-ROM drivers from removable media?" #~ msgid "Load OEM supported drivers from driver injection disk?" #~ msgstr "Zaladowac sterowniki CD-ROMu z urzadzenia zewnetrznego?" potool-0.16/tests/1/f t.po000066400000000000000000000027231202505426200152710ustar00rootroot00000000000000# A test for potool, based on translation of gnome-games.po to Polish msgid "" msgstr "" "Project-Id-Version: gnome-games\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-11-12 15:56+0100\n" "PO-Revision-Date: 2006-11-15 21:14+0100\n" "Last-Translator: wadim dziedzic \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: ../aisleriot/aisleriot.schemas.in.h:1 msgid "Select the style of control" msgstr "Wybierz rodzaj sterowania" #: ../some/file.cc:1 #, fuzzy #| msgid "What is your name?" msgid "What was your name?" msgstr "Jak sie nazywasz?" #: ../gtali/gyahtzee.c:150 #, c-format msgid "%s wins the game with %d point" msgid_plural "%s wins the game with %d points" msgstr[0] "%s wygral(a) gre %d punktem" msgstr[1] "%s wygral(a) gre z %d punktami" msgstr[2] "%s wygral(a) gre z %d punktami" # should be treated as untranslated, but is treated as translated because # potool does not know about nplurals #: ../a.c:150 #, c-format msgid "%s bla" msgid_plural "%s blas" msgstr[0] "%s wygral(a) gre punktem" #~ msgid "unknown" #~ msgstr "nieznany" #, fuzzy #~| msgid "Load CD-ROM drivers from removable media?" #~ msgid "Load OEM supported drivers from driver injection disk?" #~ msgstr "Zaladowac sterowniki CD-ROMu z urzadzenia zewnetrznego?" potool-0.16/tests/1/in.po000066400000000000000000000036011202505426200152220ustar00rootroot00000000000000# A test for potool, based on translation of gnome-games.po to Polish msgid "" msgstr "" "Project-Id-Version: gnome-games\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-11-12 15:56+0100\n" "PO-Revision-Date: 2006-11-15 21:14+0100\n" "Last-Translator: wadim dziedzic \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: ../aisleriot/aisleriot.schemas.in.h:1 msgid "Select the style of control" msgstr "Wybierz rodzaj sterowania" #: ../aisleriot/aisleriot.schemas.in.h:3 msgid "Select to click on the source then the destination." msgstr "" #: ../some/file.cc:1 #, fuzzy #| msgid "What is your name?" msgid "What was your name?" msgstr "Jak sie nazywasz?" #: ../gtali/gyahtzee.c:150 #, c-format msgid "%s wins the game with %d point" msgid_plural "%s wins the game with %d points" msgstr[0] "%s wygral(a) gre %d punktem" msgstr[1] "%s wygral(a) gre z %d punktami" msgstr[2] "%s wygral(a) gre z %d punktami" # should be treated as untranslated, but is treated as translated because # potool does not know about nplurals #: ../a.c:150 #, c-format msgid "%s bla" msgid_plural "%s blas" msgstr[0] "%s wygral(a) gre punktem" #: ../same-gnome/ui.c:76 #, c-format msgid "%d point" msgid_plural "%d points" msgstr[0] "%d punkt" msgstr[1] "%d punkty" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oja" msgid_plural "%d ojas" msgstr[0] "" msgstr[1] "" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oje" msgid_plural "%d ojes" msgstr[0] "" #~ msgid "unknown" #~ msgstr "nieznany" #, fuzzy #~| msgid "Load CD-ROM drivers from removable media?" #~ msgid "Load OEM supported drivers from driver injection disk?" #~ msgstr "Zaladowac sterowniki CD-ROMu z urzadzenia zewnetrznego?" potool-0.16/tests/2/000077500000000000000000000000001202505426200142555ustar00rootroot00000000000000potool-0.16/tests/2/in.po000066400000000000000000000030361202505426200152250ustar00rootroot00000000000000# A test for potool, based on translation of gnome-games.po to Polish msgid "" msgstr "" "Project-Id-Version: gnome-games\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-11-12 15:56+0100\n" "PO-Revision-Date: 2006-11-15 21:14+0100\n" "Last-Translator: wadim dziedzic \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: ../aisleriot/aisleriot.schemas.in.h:1 msgid "Select the style of control" msgstr "Wybierz rodzaj sterowania" #: ../aisleriot/aisleriot.schemas.in.h:3 msgid "Select to click on the source then the destination." msgstr "" #: ../gtali/gyahtzee.c:150 #, c-format msgid "%s wins the game with %d point" msgid_plural "%s wins the game with %d points" msgstr[0] "%s wygral(a) gre %d punktem" msgstr[1] "%s wygral(a) gre z %d punktami" msgstr[2] "%s wygral(a) gre z %d punktami" # should be treated as untranslated, but is treated as translated because # potool does not know about nplurals #: ../a.c:150 #, c-format msgid "%s bla" msgid_plural "%s blas" msgstr[0] "%s wygral(a) gre punktem" #: ../same-gnome/ui.c:76 #, c-format msgid "%d point" msgid_plural "%d points" msgstr[0] "%d punkt" msgstr[1] "%d punkty" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oja" msgid_plural "%d ojas" msgstr[0] "" msgstr[1] "" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oje" msgid_plural "%d ojes" msgstr[0] "" potool-0.16/tests/2/work.po000066400000000000000000000031071202505426200156000ustar00rootroot00000000000000# A test for potool, based on translation of gnome-games.po to Polish msgid "" msgstr "" "Project-Id-Version: gnome-games\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-11-12 15:56+0100\n" "PO-Revision-Date: 2006-11-15 21:14+0100\n" "Last-Translator: wadim dziedzic \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: ../aisleriot/aisleriot.schemas.in.h:1 msgid "Select the style of control" msgstr "Wybierz rodzaj sterowaniaX" #: ../aisleriot/aisleriot.schemas.in.h:3 msgid "Select to click on the source then the destination." msgstr "X" #: ../gtali/gyahtzee.c:150 #, c-format msgid "%s wins the game with %d point" msgid_plural "%s wins the game with %d points" msgstr[0] "%s wygral(a) gre %d punktemX" msgstr[1] "%s wygral(a) gre z %d punktamiX" msgstr[2] "%s wygral(a) gre z %d punktamiX" # should be treated as untranslated, but is treated as translated because # potool does not know about nplurals #: ../a.c:150 #, c-format msgid "%s bla" msgid_plural "%s blas" msgstr[0] "%s wygral(a) gre punktemX" #: ../same-gnome/ui.c:76 #, c-format msgid "%d point" msgid_plural "%d points" msgstr[0] "%d punktX" msgstr[1] "%d punktyX" msgstr[2] "X" #: ../ble.c:1 #, c-format msgid "%d oja" msgid_plural "%d ojas" msgstr[0] "X" msgstr[1] "X" msgstr[2] "X" #: ../ble.c:1 #, c-format msgid "%d oje" msgid_plural "%d ojes" msgstr[0] "X" msgstr[1] "X" msgstr[2] "X" potool-0.16/tests/3/000077500000000000000000000000001202505426200142565ustar00rootroot00000000000000potool-0.16/tests/3/in.po000066400000000000000000000036011202505426200152240ustar00rootroot00000000000000# A test for potool, based on translation of gnome-games.po to Polish msgid "" msgstr "" "Project-Id-Version: gnome-games\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-11-12 15:56+0100\n" "PO-Revision-Date: 2006-11-15 21:14+0100\n" "Last-Translator: wadim dziedzic \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: ../aisleriot/aisleriot.schemas.in.h:1 msgid "Select the style of control" msgstr "Wybierz rodzaj sterowania" #: ../aisleriot/aisleriot.schemas.in.h:3 msgid "Select to click on the source then the destination." msgstr "" #: ../some/file.cc:1 #, fuzzy #| msgid "What is your name?" msgid "What was your name?" msgstr "Jak sie nazywasz?" #: ../gtali/gyahtzee.c:150 #, c-format msgid "%s wins the game with %d point" msgid_plural "%s wins the game with %d points" msgstr[0] "%s wygral(a) gre %d punktem" msgstr[1] "%s wygral(a) gre z %d punktami" msgstr[2] "%s wygral(a) gre z %d punktami" # should be treated as untranslated, but is treated as translated because # potool does not know about nplurals #: ../a.c:150 #, c-format msgid "%s bla" msgid_plural "%s blas" msgstr[0] "%s wygral(a) gre punktem" #: ../same-gnome/ui.c:76 #, c-format msgid "%d point" msgid_plural "%d points" msgstr[0] "%d punkt" msgstr[1] "%d punkty" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oja" msgid_plural "%d ojas" msgstr[0] "" msgstr[1] "" msgstr[2] "" #: ../ble.c:1 #, c-format msgid "%d oje" msgid_plural "%d ojes" msgstr[0] "" #~ msgid "unknown" #~ msgstr "nieznany" #, fuzzy #~| msgid "Load CD-ROM drivers from removable media?" #~ msgid "Load OEM supported drivers from driver injection disk?" #~ msgstr "Zaladowac sterowniki CD-ROMu z urzadzenia zewnetrznego?" potool-0.16/tests/4-wrapping/000077500000000000000000000000001202505426200161045ustar00rootroot00000000000000potool-0.16/tests/4-wrapping/in.po000066400000000000000000000016021202505426200170510ustar00rootroot00000000000000# A test for potool, based on translation of gnome-games.po to Polish msgid "" msgstr "" "Project-Id-Version: gnome-games\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-11-12 15:56+0100\n" "PO-Revision-Date: 2006-11-15 21:14+0100\n" "Last-Translator: wadim dziedzic \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: ../aisleriot/aisleriot.schemas.in.h:1 msgid "Select the " "style of con" "trol" msgstr "Wybierz" " rodzaj sterow" "ania" #, fuzzy #~| msgid "Load CD-ROM drivers from removable media?" #~ msgid "Load OEM supported" #~ " drivers from " #~ "driver injec" #~ "tion disk?" #~ msgstr "Zaladowac sterowniki CD-ROMu z urzadzenia zewnetrznego?" potool-0.16/tests/mini.po000066400000000000000000000003171202505426200154110ustar00rootroot00000000000000# A tiny po file for potool debugging. msgid "" msgstr "" "Project-Id-Version: gnome-games\n" #: ../aisleriot/aisleriot.schemas.in.h:1 msgid "Select the style of control" msgstr "Wybierz rodzaj sterowania" potool-0.16/tests/test000066400000000000000000000017601202505426200150220ustar00rootroot00000000000000#!/bin/bash set -e set -x function potool_test() { local dir="$1" local desc="$2" local opts="$3" local out="$4" if [ -z "$out" ]; then out="in.po"; fi rm -f $dir/out.po echo TESTING $dir with "$desc" ${WRAPPER} ../potool $opts $dir/in.po > $dir/out.po diff -u "$dir/$out" $dir/out.po rm -f $dir/out.po } potool_test 1 "no filter" "" (cd 1 && ls -1 | egrep -v '^(in.po|CVS)$') | while read out; do potool_test 1 "-${out/.po}" "-${out/.po}" "$out" done for dir in 2 do echo TESTING $dir/work.po ${WRAPPER} ../potool $dir/in.po $dir/work.po > $dir/out.po diff -u $dir/work.po $dir/out.po rm -f $dir/out.po done function poedit_test() { local dir="$1"; shift local desc="$1"; shift local opts="$1"; shift echo TESTING $dir with "$desc" cp $dir/in.po $dir/work.po PATH="$(pwd)/../scripts:$(pwd)/../:$PATH" EDITOR=: poedit $opts $dir/work.po diff -u $dir/in.po $dir/work.po rm -f $dir/work.po } poedit_test 3 "no options" "" poedit_test 3 "-a" "-a" poedit_test 4-wrapping "-p" "-p"