From ec43c635cc65145dc4c36b4b284b86119534533e Mon Sep 17 00:00:00 2001 From: axel Date: Wed, 4 Jan 2006 22:51:02 +1000 Subject: Add i18n through gettext, as well as a Swedish translation darcs-hash:20060104125102-ac50b-5bf026578a69bd94f7a7a3c8dee0ebccd95e5c24.gz --- Makefile.in | 165 +++++-- builtin.c | 398 ++++++++-------- builtin.h | 19 +- builtin_commandline.c | 45 +- builtin_set.c | 59 +-- builtin_ulimit.c | 12 +- common.c | 10 +- common.h | 12 +- complete.c | 9 +- configure.ac | 18 +- doc_src/doc.hdr | 61 +++ env.c | 14 +- event.c | 3 +- exec.c | 21 +- exec.h | 2 +- fish.spec.in | 1 + init/completions/ls.fish | 2 +- input.c | 37 +- io.c | 3 +- main.c | 5 +- parser.c | 194 ++++++-- parser.h | 2 +- po/sv.po | 1140 ++++++++++++++++++++++++++++++++++++++++++++++ proc.c | 54 ++- reader.c | 27 +- signal.c | 63 +-- tokenizer.c | 53 ++- translate.c | 78 ++++ translate.h | 27 ++ wildcard.c | 11 +- 30 files changed, 1999 insertions(+), 546 deletions(-) create mode 100644 po/sv.po create mode 100644 translate.c create mode 100644 translate.h diff --git a/Makefile.in b/Makefile.in index 2ce7a9de..c2301d57 100644 --- a/Makefile.in +++ b/Makefile.in @@ -38,6 +38,7 @@ INSTALL:=@INSTALL@ prefix = @prefix@ exec_prefix = @exec_prefix@ +datadir = @datadir@ bindir = @bindir@ mandir = @mandir@ sysconfdir = @sysconfdir@ @@ -46,13 +47,15 @@ fishfile = @fishfile@ fishinputfile = @fishinputfile@ docdir = @docdir@ +HAVE_GETTEXT=@HAVE_GETTEXT@ + # All objects used by fish, that are compiled from an ordinary .c file # using an ordinary .h file. COMMON_OBJS := function.o builtin.o common.o complete.o env.o exec.o \ expand.o highlight.o history.o kill.o parser.o proc.o reader.o \ sanity.o tokenizer.o util.o wildcard.o wgetopt.o wutil.o input.o \ output.o intern.o env_universal.o env_universal_common.o \ - input_common.o event.o signal.o io.o + input_common.o event.o signal.o io.o translate.o # builtin_help.h exists, but builtin_help.c is autogenerated COMMON_OBJS_WITH_HEADER := builtin_help.o @@ -154,8 +157,12 @@ MANUALS:=doc_src/fish.1 @XSEL_MAN_PATH@ \ doc_src/builtin_doc/man/man1/tokenize.1 \ doc_src/builtin_doc/man/man1/count.1 +#All translation message catalogs +TRANSLATIONS_SRC := $(wildcard po/*.po) +TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo) + #Make everything needed for installing fish -all: $(PROGRAMS) user_doc +all: $(PROGRAMS) user_doc # User documentation, describing the features of the fish shell. user_doc: doc.h Doxyfile.user user_doc.head.html @@ -205,6 +212,28 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr cat $*.txt >>$@; echo "*/" >>$@ +# Compile translation file +%.gmo:%.po + if test $(HAVE_GETTEXT) = 1; then \ + msgfmt $*.po -o $*.gmo; \ + fi + +# Update existing po file or copy messages.pot +%.po: messages.pot + if test $(HAVE_GETTEXT) = 1;then \ + if test -f $*.po; then \ + msgmerge -U --backup=existing --no-wrap $*.po messages.pot;\ + else \ + cp messages.pot $*.po;\ + fi; \ + fi + +# Create a template translation object +messages.pot: *.c *.h + if test $(HAVE_GETTEXT) = 1;then \ + xgettext -k_ -kN_ --no-wrap *.c *.h -o messages.pot; \ + fi + # Generate the internal help functions by making doxygen create # man-pages which are then converted into C code. The convertion path # looks like this: @@ -266,7 +295,7 @@ builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh bui echo "}" >>$@ #man -- doc_src/builtin_doc/man/man1/`basename $@ .c`.1 | cat -s | ./gen_hdr2 >>$@ -install: all +install: all install-translations $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) for i in $(PROGRAMS); do\ $(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \ @@ -294,7 +323,7 @@ install: all @echo If you want to use fish as the default shell, remember to first @echo add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'. -uninstall: +uninstall: uninstall-translations for i in $(PROGRAMS); do \ rm -f $(DESTDIR)$(bindir)/$$i; \ done; @@ -307,6 +336,21 @@ uninstall: rm $(DESTDIR)$(mandir)/man1/$$i; \ done; +install-translations: all + if test $(HAVE_GETTEXT) = 1; then \ + for i in $(TRANSLATIONS); do \ + $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/locale/$$(basename $$i .gmo)/LC_MESSAGES; \ + $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/locale/$$(basename $$i .gmo)/LC_MESSAGES/fish.mo; \ + done; \ + fi + +uninstall-translations: all + if test $(HAVE_GETTEXT) = 1; then \ + for i in $(TRANSLATIONS_SRC); do \ + rm -f $(DESTDIR)$(datadir)/locale/$$(basename $$i .po)/LC_MESSAGES/fish.mo; \ + done; \ + fi + # The fish shell fish: $(FISH_OBJS) $(CC) $(FISH_OBJS) $(LDFLAGS) -o $@ @@ -346,18 +390,20 @@ depend: # # Uses install instead of mkdir so build won't fail if the directory # exists -fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog +fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog $(TRANSLATIONS_SRC) rm -rf fish-@PACKAGE_VERSION@ $(INSTALL) -d fish-@PACKAGE_VERSION@ $(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src $(INSTALL) -d fish-@PACKAGE_VERSION@/init $(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions $(INSTALL) -d fish-@PACKAGE_VERSION@/tests + $(INSTALL) -d fish-@PACKAGE_VERSION@/translations cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/ cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/ cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/ cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/ + cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/translations/ tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar rm -rf fish-@PACKAGE_VERSION@ @@ -394,66 +440,85 @@ clean: rm -rf doc_src/builtin_doc rm -rf fish-@PACKAGE_VERSION@ rm -rf xsel-0.9.6/ + rm $(TRANSLATIONS) # DO NOT DELETE THIS LINE -- make depend depends on it. builtin.o: config.h util.h wutil.h builtin.h function.h complete.h proc.h -builtin.o: parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h +builtin.o: io.h parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h builtin.o: tokenizer.h builtin_help.h wildcard.h input_common.h input.h -builtin.o: intern.h -builtin_commandline.o: config.h util.h builtin.h common.h wgetopt.h reader.h -builtin_commandline.o: proc.h parser.h tokenizer.h input_common.h input.h +builtin.o: intern.h event.h signal.h +builtin_commandline.o: signal.h config.h util.h builtin.h common.h wgetopt.h +builtin_commandline.o: reader.h proc.h io.h parser.h tokenizer.h +builtin_commandline.o: input_common.h input.h builtin_help.o: config.h util.h common.h builtin_help.h -builtin_set.o: config.h util.h builtin.h env.h expand.h common.h wgetopt.h -builtin_set.o: proc.h parser.h -common.o: config.h util.h wutil.h common.h expand.h proc.h wildcard.h -common.o: parser.h -complete.o: config.h util.h tokenizer.h wildcard.h proc.h parser.h function.h -complete.o: complete.h builtin.h env.h exec.h expand.h common.h reader.h -complete.o: history.h intern.h wutil.h -env.o: config.h util.h wutil.h proc.h common.h env.h sanity.h expand.h -env.o: history.h reader.h parser.h env_universal.h env_universal_common.h -env_universal.o: util.h common.h wutil.h env_universal_common.h -env_universal.o: env_universal.h -env_universal_common.o: util.h common.h wutil.h env_universal_common.h -exec.o: config.h util.h common.h wutil.h proc.h exec.h parser.h builtin.h -exec.o: function.h env.h wildcard.h sanity.h expand.h env_universal.h -exec.o: env_universal_common.h -expand.o: config.h util.h common.h wutil.h env.h proc.h parser.h expand.h -expand.o: wildcard.h exec.h tokenizer.h complete.h -fishd.o: util.h common.h wutil.h env_universal_common.h -fish_pager.o: config.h util.h wutil.h common.h complete.h output.h +builtin_set.o: signal.h config.h util.h builtin.h env.h expand.h common.h +builtin_set.o: wgetopt.h proc.h io.h parser.h +builtin_ulimit.o: config.h util.h builtin.h common.h wgetopt.h +common.o: config.h signal.h util.h wutil.h common.h expand.h proc.h io.h +common.o: wildcard.h parser.h +complete.o: signal.h config.h util.h tokenizer.h wildcard.h proc.h io.h +complete.o: parser.h function.h complete.h builtin.h env.h exec.h expand.h +complete.o: common.h reader.h history.h intern.h wutil.h +env.o: config.h signal.h util.h wutil.h proc.h io.h common.h env.h sanity.h +env.o: expand.h history.h reader.h parser.h env_universal.h +env.o: env_universal_common.h input_common.h event.h +env_universal.o: config.h signal.h util.h common.h wutil.h +env_universal.o: env_universal_common.h env_universal.h +env_universal_common.o: signal.h util.h common.h wutil.h +env_universal_common.o: env_universal_common.h +event.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h +event.o: event.h +exec.o: signal.h config.h util.h common.h wutil.h proc.h io.h exec.h parser.h +exec.o: builtin.h function.h env.h wildcard.h sanity.h expand.h +exec.o: env_universal.h env_universal_common.h +expand.o: signal.h config.h util.h common.h wutil.h env.h proc.h io.h +expand.o: parser.h expand.h wildcard.h exec.h tokenizer.h complete.h +fishd.o: signal.h util.h common.h wutil.h env_universal_common.h +fish_pager.o: config.h signal.h util.h wutil.h common.h complete.h output.h fish_pager.o: input_common.h env_universal.h env_universal_common.h -fish_tests.o: config.h util.h common.h proc.h reader.h builtin.h function.h -fish_tests.o: complete.h wutil.h env.h expand.h parser.h tokenizer.h -function.o: config.h util.h function.h proc.h parser.h common.h intern.h -highlight.o: config.h util.h wutil.h highlight.h tokenizer.h proc.h parser.h -highlight.o: builtin.h function.h env.h expand.h sanity.h common.h complete.h -highlight.o: output.h +fish_tests.o: config.h signal.h util.h common.h proc.h io.h reader.h +fish_tests.o: builtin.h function.h complete.h wutil.h env.h expand.h parser.h +fish_tests.o: tokenizer.h output.h exec.h event.h +function.o: signal.h config.h util.h function.h proc.h io.h parser.h common.h +function.o: intern.h event.h +highlight.o: signal.h config.h util.h wutil.h highlight.h tokenizer.h proc.h +highlight.o: io.h parser.h builtin.h function.h env.h expand.h sanity.h +highlight.o: common.h complete.h output.h history.o: config.h util.h wutil.h history.h common.h reader.h env.h sanity.h -input.o: config.h util.h wutil.h reader.h proc.h common.h sanity.h -input.o: input_common.h input.h parser.h env.h expand.h +input.o: config.h signal.h util.h wutil.h reader.h proc.h io.h common.h +input.o: sanity.h input_common.h input.h parser.h env.h expand.h event.h input_common.o: config.h util.h common.h wutil.h input_common.h input_common.o: env_universal.h env_universal_common.h intern.o: config.h util.h common.h intern.h -kill.o: config.h util.h wutil.h kill.h proc.h sanity.h common.h env.h -kill.o: expand.h exec.h parser.h -main.o: config.h util.h common.h reader.h builtin.h function.h complete.h -main.o: wutil.h env.h sanity.h proc.h parser.h expand.h intern.h +io.o: config.h util.h wutil.h exec.h proc.h io.h common.h +key_reader.o: input_common.h +kill.o: signal.h config.h util.h wutil.h kill.h proc.h io.h sanity.h common.h +kill.o: env.h expand.h exec.h parser.h +main.o: config.h signal.h util.h common.h reader.h builtin.h function.h +main.o: complete.h wutil.h env.h sanity.h proc.h io.h parser.h expand.h +main.o: intern.h exec.h event.h output.h translate.h mimedb.o: config.h xdgmime.h util.h -output.o: config.h util.h wutil.h expand.h common.h output.h highlight.h -parser.o: config.h util.h common.h wutil.h proc.h parser.h tokenizer.h exec.h -parser.o: wildcard.h function.h builtin.h builtin_help.h env.h expand.h -parser.o: reader.h sanity.h env_universal.h env_universal_common.h -proc.o: config.h util.h wutil.h proc.h common.h reader.h sanity.h env.h -reader.o: config.h util.h wutil.h highlight.h reader.h proc.h parser.h -reader.o: complete.h history.h common.h sanity.h env.h exec.h expand.h -reader.o: tokenizer.h kill.h input_common.h input.h function.h output.h -sanity.o: config.h util.h common.h sanity.h proc.h history.h reader.h kill.h -sanity.o: wutil.h +output.o: config.h signal.h util.h wutil.h expand.h common.h output.h +output.o: highlight.h +parser.o: signal.h config.h util.h common.h wutil.h proc.h io.h parser.h +parser.o: tokenizer.h exec.h wildcard.h function.h builtin.h builtin_help.h +parser.o: env.h expand.h reader.h sanity.h env_universal.h +parser.o: env_universal_common.h event.h translate.h msgnrs.h +proc.o: config.h signal.h util.h wutil.h proc.h io.h common.h reader.h +proc.o: sanity.h env.h parser.h event.h +reader.o: config.h signal.h util.h wutil.h highlight.h reader.h proc.h io.h +reader.o: parser.h complete.h history.h common.h sanity.h env.h exec.h +reader.o: expand.h tokenizer.h kill.h input_common.h input.h function.h +reader.o: output.h +sanity.o: signal.h config.h util.h common.h sanity.h proc.h io.h history.h +sanity.o: reader.h kill.h wutil.h set_color.o: config.h +signal.o: config.h signal.h common.h util.h wutil.h event.h reader.h proc.h +signal.o: io.h tokenize.o: config.h tokenizer.o: config.h util.h wutil.h tokenizer.h common.h wildcard.h +translate.o: msgnrs.h common.h util.h util.o: config.h util.h common.h wutil.h wgetopt.o: config.h wgetopt.h wutil.h wildcard.o: config.h util.h wutil.h complete.h common.h wildcard.h reader.h diff --git a/builtin.c b/builtin.c index 745a09cf..d8987fe8 100644 --- a/builtin.c +++ b/builtin.c @@ -11,7 +11,7 @@ 2). Add a line like hash_put( &builtin, L"NAME", &builtin_NAME ); to builtin_init. This will enable the parser to find the builtin function. - 3). Add a line like hash_put( desc, L"NAME", L"Bla bla bla" ); to the proper part of builtin_get_desc, containing a short description of what the builtin does. This description is used by the completion system. + 3). Add a line like hash_put( desc, L"NAME", _(L"Bla bla bla") ); to the proper part of builtin_get_desc, containing a short description of what the builtin does. This description is used by the completion system. 4). Create a file doc_src/NAME.txt, containing the manual for the builtin in Doxygen-format. Check the other builtin manuals for proper syntax. @@ -61,6 +61,7 @@ #include "intern.h" #include "event.h" #include "signal.h" +#include "translate.h" /** The default prompt for the read command @@ -76,7 +77,7 @@ /** The send stuff to foreground message */ -#define FG_MSG L"Send job %d, '%ls' to foreground\n" +#define FG_MSG _( L"Send job %d, '%ls' to foreground\n" ) /** Print modes for the jobs builtin @@ -234,9 +235,8 @@ static int builtin_bind( wchar_t **argv ) if(long_options[opt_index].flag != 0) break; sb_printf( sb_err, - L"%ls%ls %ls\n", - argv[0], BUILTIN_ERR_UNKNOWN, + argv[0], long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); @@ -331,13 +331,10 @@ static int builtin_block( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); return 1; @@ -370,13 +367,13 @@ static int builtin_block( wchar_t **argv ) { if( scope != UNSET ) { - sb_printf( sb_err, L"%ls: Can not specify scope when removing block\n", argv[0] ); + sb_printf( sb_err, _( L"%ls: Can not specify scope when removing block\n" ), argv[0] ); return 1; } if( !global_event_block ) { - sb_printf( sb_err, L"%ls: No blocks defined\n", argv[0] ); + sb_printf( sb_err, _( L"%ls: No blocks defined\n" ), argv[0] ); return 1; } @@ -473,13 +470,10 @@ static int builtin_builtin( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); @@ -570,13 +564,10 @@ static int builtin_generic( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); return 1; @@ -633,13 +624,10 @@ static int builtin_exec( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); return 1; @@ -796,13 +784,10 @@ static int builtin_functions( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); @@ -840,10 +825,11 @@ static int builtin_functions( wchar_t **argv ) */ if( (erase + (desc!=0) + list) > 1 ) { - sb_append2( sb_err, - argv[0], - L": Invalid combination of options\n", - (void *)0); + sb_printf( sb_err, + _( L"%ls: Invalid combination of options\n" ), + argv[0] ); + + builtin_print_help( argv[0], sb_err ); return 1; @@ -864,7 +850,7 @@ static int builtin_functions( wchar_t **argv ) if( argc-woptind != 1 ) { sb_printf( sb_err, - L"%ls: Expected exactly one function name\n", + _( L"%ls: Expected exactly one function name\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); @@ -874,7 +860,7 @@ static int builtin_functions( wchar_t **argv ) if( !function_exists( func ) ) { sb_printf( sb_err, - L"%ls: Function '%ls' does not exist\n", + _( L"%ls: Function '%ls' does not exist\n" ), argv[0], func ); @@ -913,7 +899,7 @@ static int builtin_functions( wchar_t **argv ) { case 0: { - sb_append( sb_out, L"Current function definitions are:\n\n" ); + sb_append( sb_out, _( L"Current function definitions are:\n\n" ) ); al_init( &names ); function_get_names( &names, show_hidden ); names_arr = list_to_char_arr( &names ); @@ -1049,13 +1035,10 @@ static int builtin_function( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); res = 1; @@ -1078,7 +1061,7 @@ static int builtin_function( wchar_t **argv ) if( sig < 0 ) { sb_printf( sb_err, - L"%ls: Unknown signal %ls\n", + _( L"%ls: Unknown signal '%ls'\n" ), argv[0], woptarg ); res=1; @@ -1102,7 +1085,7 @@ static int builtin_function( wchar_t **argv ) if( !wcsvarname( woptarg ) ) { sb_printf( sb_err, - L"%ls: Invalid variable name %ls\n", + _( L"%ls: Invalid variable name '%ls'\n" ), argv[0], woptarg ); res=1; @@ -1164,7 +1147,7 @@ static int builtin_function( wchar_t **argv ) if( job_id == -1 ) { sb_printf( sb_err, - L"%ls: Cannot find calling job for event handler\n", + _( L"%ls: Cannot find calling job for event handler\n" ), argv[0] ); res=1; } @@ -1182,7 +1165,7 @@ static int builtin_function( wchar_t **argv ) if( errno || !end || *end ) { sb_printf( sb_err, - L"%ls: Invalid process id %ls\n", + _( L"%ls: Invalid process id %ls\n" ), argv[0], woptarg ); res=1; @@ -1219,7 +1202,7 @@ static int builtin_function( wchar_t **argv ) if( argc-woptind != 1 ) { sb_printf( sb_err, - L"%ls: Expected one argument, got %d\n", + _( L"%ls: Expected one argument, got %d\n" ), argv[0], argc-woptind ); res=1; @@ -1227,7 +1210,7 @@ static int builtin_function( wchar_t **argv ) else if( !(is_binding?wcsbindingname( argv[woptind] ) : wcsvarname( argv[woptind] ) )) { sb_printf( sb_err, - L"%ls: illegal function name '%ls'\n", + _( L"%ls: Illegal function name '%ls'\n" ), argv[0], argv[woptind] ); @@ -1237,7 +1220,7 @@ static int builtin_function( wchar_t **argv ) { sb_printf( sb_err, - L"%ls: the name '%ls' is reserved,\nand can not be used as a function name\n", + _( L"%ls: The name '%ls' is reserved,\nand can not be used as a function name\n" ), argv[0], argv[woptind] ); @@ -1253,9 +1236,10 @@ static int builtin_function( wchar_t **argv ) int chars=0; // builtin_print_help( argv[0], sb_err ); - - sb_append( sb_err, L"Current functions are: " ); - chars += wcslen( L"Current functions are: " ); + const wchar_t *cfa = _( L"Current functions are: " ); + sb_append( sb_err, cfa ); + chars += wcslen( cfa ); + al_init( &names ); function_get_names( &names, 0 ); names_arr = list_to_char_arr( &names ); @@ -1350,13 +1334,10 @@ static int builtin_random( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); return 1; @@ -1398,7 +1379,7 @@ static int builtin_random( wchar_t **argv ) if( errno || *end ) { sb_printf( sb_err, - L"%ls: Seed value '%ls' is not a valid number\n", + _( L"%ls: Seed value '%ls' is not a valid number\n" ), argv[0], argv[woptind] ); @@ -1412,7 +1393,7 @@ static int builtin_random( wchar_t **argv ) default: { sb_printf( sb_err, - L"%ls: Expected zero or one argument, got %d\n", + _( L"%ls: Expected zero or one argument, got %d\n" ), argv[0], argc-woptind ); builtin_print_help( argv[0], sb_err ); @@ -1488,13 +1469,10 @@ static int builtin_read( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0 ); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); return 1; @@ -1529,26 +1507,22 @@ static int builtin_read( wchar_t **argv ) if( ( place & ENV_UNEXPORT ) && ( place & ENV_EXPORT ) ) { - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_EXPUNEXP, - L"\n", - parser_current_line(), - L"\n", - (void *)0 ); + sb_printf( sb_err, + BUILTIN_ERR_EXPUNEXP, + argv[0], + parser_current_line() ); + + builtin_print_help( argv[0], sb_err ); return 1; } if( (place&ENV_LOCAL) && (place & ENV_GLOBAL) ) { - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_GLOCAL, - L"\n", - parser_current_line(), - L"\n", - (void *)0 ); + sb_printf( sb_err, + BUILTIN_ERR_GLOCAL, + argv[0], + parser_current_line() ); builtin_print_help( argv[0], sb_err ); return 1; @@ -1556,10 +1530,11 @@ static int builtin_read( wchar_t **argv ) if( woptind == argc ) { + sb_printf( sb_err, + BUILTIN_ERR_MISSING, + argv[0] ); + sb_append2( sb_err, - argv[0], - BUILTIN_ERR_MISSING, - L"\n", parser_current_line(), L"\n", (void *)0 ); @@ -1752,13 +1727,10 @@ static int builtin_status( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); return 1; @@ -1855,7 +1827,7 @@ static int builtin_exit( wchar_t **argv ) if( errno || *end != 0) { sb_printf( sb_err, - L"%ls: Argument must be an integer '%ls'\n", + _( L"%ls: Argument must be an integer '%ls'\n" ), argv[0], argv[1] ); builtin_print_help( argv[0], sb_err ); @@ -1866,7 +1838,7 @@ static int builtin_exit( wchar_t **argv ) default: sb_printf( sb_err, - L"%ls: Too many arguments\n", + _( L"%ls: Too many arguments\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); @@ -1910,11 +1882,9 @@ static int builtin_cd( wchar_t **argv ) dir_in = env_get( L"HOME" ); if( !dir_in ) { - sb_append2( sb_err, - argv[0], - L": Could not find home directory\n", - (void *)0 ); - + sb_printf( sb_err, + _( L"%ls: Could not find home directory\n" ), + argv[0] ); } } else @@ -1925,7 +1895,7 @@ static int builtin_cd( wchar_t **argv ) if( !dir ) { sb_printf( sb_err, - L"%ls: is not a directory or you do not have permission to enter it\n", + _( L"%ls: '%ls' is not a directory or you do not have permission to enter it\n" ), argv[0], dir_in ); sb_append2( sb_err, @@ -1937,7 +1907,7 @@ static int builtin_cd( wchar_t **argv ) if( wchdir( dir ) != 0 ) { sb_printf( sb_err, - L"%ls: '%ls' is not a directory\n", + _( L"%ls: '%ls' is not a directory\n" ), argv[0], dir ); sb_append2( sb_err, @@ -1952,7 +1922,7 @@ static int builtin_cd( wchar_t **argv ) if (!set_pwd(L"PWD")) { res=1; - sb_printf( sb_err, L"%ls: Could not set PWD variable\n", argv[0] ); + sb_printf( sb_err, _( L"%ls: Could not set PWD variable\n" ), argv[0] ); } free( dir ); @@ -2061,12 +2031,10 @@ static int builtin_complete( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - L": Unknown option ", - long_options[opt_index].name, - L"\n", - (void *)0 ); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); sb_append( sb_err, parser_current_line() ); // builtin_print_help( argv[0], sb_err ); @@ -2108,12 +2076,11 @@ static int builtin_complete( wchar_t **argv ) case 's': if( wcslen( woptarg ) > 1 ) { - sb_append2( sb_err, - argv[0], - L": Parameter too long ", - woptarg, - L"\n", - (void *)0); + sb_printf( sb_err, + _( L"%ls: Parameter '%ls' is too long\n" ), + argv[0], + woptarg ); + sb_append( sb_err, parser_current_line() ); // builtin_print_help( argv[0], sb_err ); @@ -2164,7 +2131,7 @@ static int builtin_complete( wchar_t **argv ) if( woptind != argc ) { sb_printf( sb_err, - L"%ls: Too many arguments\n", + _( L"%ls: Too many arguments\n" ), argv[0] ); sb_append( sb_err, parser_current_line() ); @@ -2231,7 +2198,7 @@ static int builtin_source( wchar_t ** argv ) if( argc != 2 ) { - sb_printf( sb_err, L"%ls: Expected exactly one argument, gor %d\n", argv[0], argc ); + sb_printf( sb_err, _( L"%ls: Expected exactly one argument, got %d\n" ), argv[0], argc ); builtin_print_help( argv[0], sb_err ); return 1; } @@ -2244,7 +2211,7 @@ static int builtin_source( wchar_t ** argv ) if( !S_ISREG(buf.st_mode) ) { - sb_printf( sb_err, L"%ls: '%ls' is not a file\n", argv[0], argv[1] ); + sb_printf( sb_err, _( L"%ls: '%ls' is not a file\n" ), argv[0], argv[1] ); builtin_print_help( argv[0], sb_err ); return 1; @@ -2269,7 +2236,7 @@ static int builtin_source( wchar_t ** argv ) if( res ) { sb_printf( sb_err, - L"%ls : Error while reading file '%ls'\n", + _( L"%ls: Error while reading file '%ls'\n" ), argv[0], argv[1] ); @@ -2341,18 +2308,16 @@ static int builtin_fg( wchar_t **argv ) j = job_get_from_pid( pid ); if( j != 0 ) { - sb_append2( sb_err, - argv[0], - L": Ambiguous job\n", - (void *)0); + sb_printf( sb_err, + _( L"%ls: Ambiguous job\n" ), + argv[0] ); } else { - sb_append2( sb_err, - argv[0], - L": Not a job (", - argv[1], - L")\n", (void *)0 ); + sb_printf( sb_err, + _( L"%ls: '%ls' is not a job\n" ), + argv[0], + argv[1] ); } builtin_print_help( argv[0], sb_err ); @@ -2366,10 +2331,9 @@ static int builtin_fg( wchar_t **argv ) if( j == 0 ) { - sb_append2( sb_err, - argv[0], - L": No suitable job\n", - (void *)0); + sb_printf( sb_err, + _( L"%ls: No suitable job\n" ), + argv[0] ); builtin_print_help( argv[0], sb_err ); return 1; } @@ -2413,18 +2377,21 @@ static int builtin_fg( wchar_t **argv ) /** Helper function for builtin_bg() */ -static void send_to_bg( job_t *j, wchar_t *name ) +static void send_to_bg( job_t *j, const wchar_t *name ) { if( j == 0 ) { - sb_append2( sb_err, L"bg", L": Unknown job ", name, L"\n", (void *)0 ); + sb_printf( sb_err, + _( L"%ls: Unknown job '%ls'\n" ), + L"bg", + name ); builtin_print_help( L"bg", sb_err ); return; } else { sb_printf( sb_err, - L"Send job %d '%ls' to background\n", + _(L"Send job %d '%ls' to background\n"), j->job_id, j->command ); } @@ -2444,7 +2411,7 @@ static int builtin_bg( wchar_t **argv ) job_t *j; for( j=first_job; ((j!=0) && (!j->constructed) && (!job_is_stopped(j))); j=j->next ) ; - send_to_bg( j, L"(default)"); + send_to_bg( j, _(L"(default)" ) ); return 0; } for( argv++; *argv != 0; argv++ ) @@ -2498,11 +2465,11 @@ static void builtin_jobs_print( job_t *j, int mode, int header ) /* Print table header before first job */ - sb_append( sb_out, L"Job\tGroup\t"); + sb_append( sb_out, _( L"Job\tGroup\t" )); #ifdef HAVE__PROC_SELF_STAT - sb_append( sb_out, L"CPU\t" ); + sb_append( sb_out, _( L"CPU\t" ) ); #endif - sb_append( sb_out, L"State\tCommand\n" ); + sb_append( sb_out, _( L"State\tCommand\n" ) ); } sb_printf( sb_out, L"%d\t%d\t", j->job_id, j->pgid ); @@ -2510,8 +2477,12 @@ static void builtin_jobs_print( job_t *j, int mode, int header ) #ifdef HAVE__PROC_SELF_STAT sb_printf( sb_out, L"%d%%\t", cpu_use(j) ); #endif - sb_append2( sb_out, job_is_stopped(j)?L"stopped\t":L"running\t", - j->command, L"\n", (void *)0 ); + sb_append2( sb_out, + job_is_stopped(j)?_(L"stopped"):_(L"running"), + L"\t", + j->command, + L"\n", + (void *)0 ); break; } @@ -2522,7 +2493,7 @@ static void builtin_jobs_print( job_t *j, int mode, int header ) /* Print table header before first job */ - sb_append( sb_out, L"Group\n"); + sb_append( sb_out, _( L"Group\n" )); } sb_printf( sb_out, L"%d\n", j->pgid ); break; @@ -2535,7 +2506,7 @@ static void builtin_jobs_print( job_t *j, int mode, int header ) /* Print table header before first job */ - sb_append( sb_out, L"Procces\n"); + sb_append( sb_out, _( L"Procces\n" )); } for( p=j->first_process; p; p=p->next ) @@ -2552,7 +2523,7 @@ static void builtin_jobs_print( job_t *j, int mode, int header ) /* Print table header before first job */ - sb_append( sb_out, L"Command\n"); + sb_append( sb_out, _( L"Command\n" )); } for( p=j->first_process; p; p=p->next ) @@ -2623,10 +2594,10 @@ static int builtin_jobs( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_printf( sb_err, - L"%ls: Unknown option '%ls'\n", - argv[0], - long_options[opt_index].name ); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); sb_append( sb_err, parser_current_line() ); @@ -2704,7 +2675,7 @@ static int builtin_jobs( wchar_t **argv ) if( errno || *end ) { sb_printf( sb_err, - L"%ls: Not a process id: '%ls'\n", + _( L"%ls: Not a process id: '%ls'\n" ), argv[0], argv[i] ); return 1; @@ -2719,7 +2690,7 @@ static int builtin_jobs( wchar_t **argv ) else { sb_printf( sb_err, - L"%ls: No suitable job: %d\n", + _( L"%ls: No suitable job: %d\n" ), argv[0], pid ); return 1; @@ -2745,7 +2716,7 @@ static int builtin_jobs( wchar_t **argv ) if( !found ) { sb_printf( sb_out, - L"%ls: There are no running jobs\n", + _( L"%ls: There are no jobs\n" ), argv[0] ); } @@ -2764,14 +2735,14 @@ static int builtin_for( wchar_t **argv ) if( argc < 3) { sb_printf( sb_err, - L"%ls: Expected at least two arguments\n", + _( L"%ls: Expected at least two arguments\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); } else if ( !wcsvarname(argv[1]) ) { sb_printf( sb_err, - L"%ls: '%ls' invalid variable name\n", + _( L"%ls: '%ls' invalid variable name\n" ), argv[0], argv[1] ); builtin_print_help( argv[0], sb_err ); @@ -2779,7 +2750,7 @@ static int builtin_for( wchar_t **argv ) else if (wcscmp( argv[2], L"in") != 0 ) { sb_printf( sb_err, - L"%ls: Second argument must be 'in'\n", + _( L"%ls: Second argument must be 'in'\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); } @@ -2841,7 +2812,7 @@ static int builtin_end( wchar_t **argv ) current_block->type == AND ) { sb_printf( sb_err, - L"%ls: Not inside of block\n", + _( L"%ls: Not inside of block\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); @@ -2965,7 +2936,7 @@ static int builtin_else( wchar_t **argv ) current_block->param1.if_state != 1) { sb_printf( sb_err, - L"%ls: not inside of if block\n", + _( L"%ls: Not inside of 'if' block\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); return 1; @@ -2997,10 +2968,11 @@ static int builtin_break_continue( wchar_t **argv ) if( argc != 1 ) { - sb_printf( sb_err, - L"%ls: Unknown option '%ls'\n", - argv[0], + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], argv[1] ); + builtin_print_help( argv[0], sb_err ); return 1; } @@ -3016,7 +2988,7 @@ static int builtin_break_continue( wchar_t **argv ) if( b == 0 ) { sb_printf( sb_err, - L"%ls: Not inside of loop\n", + _( L"%ls: Not inside of loop\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); return 1; @@ -3056,7 +3028,7 @@ static int builtin_return( wchar_t **argv ) if( errno || *end != 0) { sb_printf( sb_err, - L"%ls: Argument must be an integer '%ls'\n", + _( L"%ls: Argument must be an integer '%ls'\n" ), argv[0], argv[1] ); builtin_print_help( argv[0], sb_err ); @@ -3067,7 +3039,7 @@ static int builtin_return( wchar_t **argv ) } default: sb_printf( sb_err, - L"%ls: Too many arguments\n", + _( L"%ls: Too many arguments\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); return 1; @@ -3083,7 +3055,7 @@ static int builtin_return( wchar_t **argv ) if( b == 0 ) { sb_printf( sb_err, - L"%ls: Not inside of function\n", + _( L"%ls: Not inside of function\n" ), argv[0] ); builtin_print_help( argv[0], sb_err ); return 1; @@ -3112,7 +3084,7 @@ static int builtin_switch( wchar_t **argv ) if( argc != 2 ) { sb_printf( sb_err, - L"%ls : syntax error, expected exactly one argument, got %d\n", + _( L"%ls: Expected exactly one argument, got %d\n" ), argv[0], argc-1 ); @@ -3143,7 +3115,7 @@ static int builtin_case( wchar_t **argv ) if( current_block->type != SWITCH ) { sb_printf( sb_err, - L"%ls: syntax error, case command while not in switch block\n", + _( L"%ls: 'case' command while not in switch block\n" ), argv[0] ); builtin_print_help( L"case", sb_err ); return 1; @@ -3341,7 +3313,7 @@ int builtin_run( wchar_t **argv ) } else { - debug( 0, L"Unknown builtin: ", argv[0], 0 ); + debug( 0, _( L"Unknown builtin '%ls'" ), argv[0] ); } return 1; } @@ -3363,41 +3335,41 @@ const wchar_t *builtin_get_desc( const wchar_t *b ) hash_init( desc, &hash_wcs_func, &hash_wcs_cmp ); - hash_put( desc, L"block", L"Temporarily block delivery of events" ); - hash_put( desc, L"builtin", L"Run a builtin command" ); - hash_put( desc, L"complete", L"Edit command specific completions" ); - hash_put( desc, L"cd", L"Change working directory" ); - hash_put( desc, L"exit", L"Exit the shell" ); - hash_put( desc, L"function", L"Define a new function" ); - hash_put( desc, L"functions", L"List or remove functions" ); - hash_put( desc, L"end", L"End a block of commands" ); - hash_put( desc, L"else", L"Evaluate block if condition is false" ); - hash_put( desc, L"eval", L"Evaluate parameters as a command" ); - hash_put( desc, L"for", L"Perform a set of commands multiple times" ); - hash_put( desc, L".", L"Evaluate contents of file" ); - hash_put( desc, L"set", L"Handle environment variables" ); - hash_put( desc, L"fg", L"Send job to foreground" ); - hash_put( desc, L"bg", L"Send job to background" ); - hash_put( desc, L"jobs", L"Print currently running jobs" ); - hash_put( desc, L"read", L"Read a line of input into variables" ); - hash_put( desc, L"break", L"Stop the innermost loop" ); - hash_put( desc, L"continue", L"Skip the rest of the current lap of the innermost loop" ); - hash_put( desc, L"return", L"Stop the innermost currently evaluated function" ); - hash_put( desc, L"commandline", L"Set the commandline" ); - hash_put( desc, L"switch", L"Conditionally execute a block of commands" ); - hash_put( desc, L"case", L"Conditionally execute a block of commands" ); - hash_put( desc, L"command", L"Run a program" ); - hash_put( desc, L"if", L"Conditionally execute a command" ); - hash_put( desc, L"while", L"Perform a command multiple times" ); - hash_put( desc, L"bind", L"Handle key bindings"); - hash_put( desc, L"random", L"Generate random number"); - hash_put( desc, L"exec", L"Run command in current process"); - hash_put( desc, L"not", L"Negate exit status of job"); - hash_put( desc, L"or", L"Execute second command if first fails"); - hash_put( desc, L"and", L"Execute second command if first suceeds"); - hash_put( desc, L"begin", L"Create a block of code" ); - hash_put( desc, L"status", L"Return status information about fish" ); - hash_put( desc, L"ulimit", L"Set or get the shells resurce usage limits" ); + hash_put( desc, L"block", _( L"Temporarily block delivery of events" ) ); + hash_put( desc, L"builtin", _( L"Run a builtin command" ) ); + hash_put( desc, L"complete", _( L"Edit command specific completions" ) ); + hash_put( desc, L"cd", _( L"Change working directory" ) ); + hash_put( desc, L"exit", _( L"Exit the shell" ) ); + hash_put( desc, L"function", _( L"Define a new function" ) ); + hash_put( desc, L"functions", _( L"List or remove functions" ) ); + hash_put( desc, L"end", _( L"End a block of commands" ) ); + hash_put( desc, L"else", _( L"Evaluate block if condition is false" ) ); + hash_put( desc, L"eval", _( L"Evaluate parameters as a command" ) ); + hash_put( desc, L"for", _( L"Perform a set of commands multiple times" ) ); + hash_put( desc, L".", _( L"Evaluate contents of file" ) ); + hash_put( desc, L"set", _( L"Handle environment variables" ) ); + hash_put( desc, L"fg", _( L"Send job to foreground" ) ); + hash_put( desc, L"bg", _( L"Send job to background" ) ); + hash_put( desc, L"jobs", _( L"Print currently running jobs" ) ); + hash_put( desc, L"read", _( L"Read a line of input into variables" ) ); + hash_put( desc, L"break", _( L"Stop the innermost loop" ) ); + hash_put( desc, L"continue", _( L"Skip the rest of the current lap of the innermost loop" ) ); + hash_put( desc, L"return", _( L"Stop the innermost currently evaluated function" ) ); + hash_put( desc, L"commandline", _( L"Set the commandline" ) ); + hash_put( desc, L"switch", _( L"Conditionally execute a block of commands" ) ); + hash_put( desc, L"case", _( L"Conditionally execute a block of commands" ) ); + hash_put( desc, L"command", _( L"Run a program" ) ); + hash_put( desc, L"if", _( L"Conditionally execute a command" ) ); + hash_put( desc, L"while", _( L"Perform a command multiple times" ) ); + hash_put( desc, L"bind", _( L"Handle key bindings" )); + hash_put( desc, L"random", _( L"Generate random number" )); + hash_put( desc, L"exec", _( L"Run command in current process" )); + hash_put( desc, L"not", _( L"Negate exit status of job" )); + hash_put( desc, L"or", _( L"Execute second command if first fails" )); + hash_put( desc, L"and", _( L"Execute second command if first suceeds" )); + hash_put( desc, L"begin", _( L"Create a block of code" ) ); + hash_put( desc, L"status", _( L"Return status information about fish" ) ); + hash_put( desc, L"ulimit", _( L"Set or get the shells resurce usage limits" ) ); } return hash_get( desc, b ); diff --git a/builtin.h b/builtin.h index ea633be9..548a668e 100644 --- a/builtin.h +++ b/builtin.h @@ -20,31 +20,36 @@ enum /** Error message on missing argument */ -#define BUILTIN_ERR_MISSING L": Expected argument" +#define BUILTIN_ERR_MISSING _( L"%ls: Expected argument\n" ) /** Error message on invalid combination of options */ -#define BUILTIN_ERR_COMBO L": Invalid combination of options" +#define BUILTIN_ERR_COMBO _( L"%ls: Invalid combination of options\n" ) + +/** + Error message on invalid combination of options +*/ +#define BUILTIN_ERR_COMBO2 _( L"%ls: Invalid combination of options,\n%ls\n" ) /** Error message on multiple scope levels for variables */ -#define BUILTIN_ERR_GLOCAL L": Variable can only be one of universal, global and local" +#define BUILTIN_ERR_GLOCAL _( L"%ls: Variable can only be one of universal, global and local\n%ls\n" ) /** Error message for specifying both export and unexport to set/read */ -#define BUILTIN_ERR_EXPUNEXP L": Variable can't be both exported and unexported" +#define BUILTIN_ERR_EXPUNEXP _( L"%ls: Variable can't be both exported and unexported\n%ls\n" ) /** Error message for unknown switch */ -#define BUILTIN_ERR_UNKNOWN L": Unknown option" +#define BUILTIN_ERR_UNKNOWN _( L"%ls: Unknown option '%ls'\n" ) -#define BUILTIN_ERR_VARCHAR L"%ls: Invalid character in variable name: '%lc'. Only alphanumerical characters and underscores are valid in a variable name.\n" +#define BUILTIN_ERR_VARCHAR _( L"%ls: Invalid character '%lc' in variable name. Only alphanumerical characters and underscores are valid in a variable name.\n" ) -#define BUILTIN_ERR_VARNAME_ZERO L"%ls: Variable name can not be the empty string\n" +#define BUILTIN_ERR_VARNAME_ZERO _( L"%ls: Variable name can not be the empty string\n" ) /** Stringbuffer used to represent standard output diff --git a/builtin_commandline.c b/builtin_commandline.c index e000eeb6..532c380c 100644 --- a/builtin_commandline.c +++ b/builtin_commandline.c @@ -22,6 +22,7 @@ Functions used for implementing the commandline builtin. #include "tokenizer.h" #include "input_common.h" #include "input.h" +#include "translate.h" /** Which part of the comandbuffer are we operating on @@ -260,13 +261,10 @@ int builtin_commandline( wchar_t **argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0 ); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); return 1; @@ -322,10 +320,11 @@ int builtin_commandline( wchar_t **argv ) */ if( buffer_part || cut_at_cursor || append_mode || tokenize ) { + sb_printf(sb_err, + BUILTIN_ERR_COMBO, + argv[0] ); + sb_append2(sb_err, - argv[0], - BUILTIN_ERR_COMBO, - L"\n", parser_current_line(), L"\n", (void *)0); @@ -335,10 +334,11 @@ int builtin_commandline( wchar_t **argv ) if( argc == woptind ) { + sb_printf( sb_err, + BUILTIN_ERR_MISSING, + argv[0] ); + sb_append2( sb_err, - argv[0], - BUILTIN_ERR_MISSING, - L"\n", parser_current_line(), L"\n", (void *)0 ); @@ -394,22 +394,23 @@ int builtin_commandline( wchar_t **argv ) if( (tokenize || cut_at_cursor) && (argc-woptind) ) { - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_COMBO, - L",\n --cut-at-cursor and --tokenize can not be used when setting the commandline", - (void *)0 ); + sb_printf( sb_err, + BUILTIN_ERR_COMBO2, + argv[0], + L"--cut-at-cursor and --tokenize can not be used when setting the commandline" ); + + builtin_print_help( argv[0], sb_err ); return 1; } if( append_mode && !(argc-woptind) ) { - sb_append2( sb_err, + sb_printf( sb_err, + BUILTIN_ERR_COMBO2, argv[0], - BUILTIN_ERR_COMBO, - L",\n insertion mode switches can not be used when not in insertion mode", - (void *)0 ); + L"insertion mode switches can not be used when not in insertion mode" ); + builtin_print_help( argv[0], sb_err ); return 1; } diff --git a/builtin_set.c b/builtin_set.c index 44b096d6..c2bc5e94 100644 --- a/builtin_set.c +++ b/builtin_set.c @@ -20,6 +20,7 @@ Functions used for implementing the set builtin. #include "wgetopt.h" #include "proc.h" #include "parser.h" +#include "translate.h" /** Extract the name from a destination argument of the form name[index1 index2...] @@ -92,9 +93,7 @@ static int parse_fill_indexes( array_list_t *indexes, long l_ind = wcstol(src, &end, 10); if (end == src) { - wchar_t sbuf[256]; - swprintf(sbuf, 255, L"Invalid index starting at %ls\n", src); - sb_append(sb_err, sbuf); + sb_printf(sb_err, _(L"%ls: Invalid index starting at '%ls'\n"), L"set", src); return -1; } @@ -362,13 +361,11 @@ int builtin_set( wchar_t **argv ) if( query && (erase || list || global || local || universal || export || unexport ) ) { - sb_append2(sb_err, + sb_printf(sb_err, + BUILTIN_ERR_COMBO2, argv[0], - BUILTIN_ERR_COMBO, - L"\n", - parser_current_line(), - L"\n", - (void *)0); + parser_current_line() ); + builtin_print_help( argv[0], sb_err ); return 1; } @@ -377,13 +374,11 @@ int builtin_set( wchar_t **argv ) /* Check operation and modifiers sanity */ if( erase && list ) { - sb_append2(sb_err, + sb_printf(sb_err, + BUILTIN_ERR_COMBO2, argv[0], - BUILTIN_ERR_COMBO, - L"\n", - parser_current_line(), - L"\n", - (void *)0); + parser_current_line() ); + builtin_print_help( argv[0], sb_err ); return 1; } @@ -391,9 +386,8 @@ int builtin_set( wchar_t **argv ) if( local + global + universal > 1 ) { sb_printf( sb_err, - L"%ls%ls\n%ls\n", - argv[0], BUILTIN_ERR_GLOCAL, + argv[0], parser_current_line() ); builtin_print_help( argv[0], sb_err ); return 1; @@ -401,13 +395,10 @@ int builtin_set( wchar_t **argv ) if( export && unexport ) { - sb_append2(sb_err, - argv[0], + sb_printf( sb_err, BUILTIN_ERR_EXPUNEXP, - L"\n", - parser_current_line(), - L"\n", - (void *)0); + argv[0], + parser_current_line() ); builtin_print_help( argv[0], sb_err ); return 1; } @@ -493,12 +484,11 @@ int builtin_set( wchar_t **argv ) /* No arguments -- display name & value for all variables in scope */ if( erase ) { - sb_append2( sb_err, - argv[0], - L": Erase needs a variable name\n", - parser_current_line(), - L"\n", - (void *)0 ); + sb_printf( sb_err, + _(L"%ls: Erase needs a variable name\n%ls\n"), + argv[0], + parser_current_line() ); + builtin_print_help( argv[0], sb_err ); retcode = 1; } @@ -531,12 +521,11 @@ int builtin_set( wchar_t **argv ) /* There are some arguments, we have at least a variable name */ if( erase && al_get_count(&values) != 0 ) { - sb_append2( sb_err, - argv[0], - L": Values cannot be specfied with erase\n", - parser_current_line(), - L"\n", - (void *)0 ); + sb_printf( sb_err, + _(L"%ls: Values cannot be specfied with erase\n%ls\n"), + argv[0], + parser_current_line() ); + builtin_print_help( argv[0], sb_err ); retcode = 1; } diff --git a/builtin_ulimit.c b/builtin_ulimit.c index b9635c9b..f20e7ec8 100644 --- a/builtin_ulimit.c +++ b/builtin_ulimit.c @@ -17,6 +17,7 @@ Functions used for implementing the ulimit builtin. #include "builtin.h" #include "common.h" #include "wgetopt.h" +#include "translate.h" /** Struct describing a resource limit @@ -344,13 +345,10 @@ int builtin_ulimit( wchar_t ** argv ) case 0: if(long_options[opt_index].flag != 0) break; - sb_append2( sb_err, - argv[0], - BUILTIN_ERR_UNKNOWN, - L" ", - long_options[opt_index].name, - L"\n", - (void *)0 ); + sb_printf( sb_err, + BUILTIN_ERR_UNKNOWN, + argv[0], + long_options[opt_index].name ); builtin_print_help( argv[0], sb_err ); return 1; diff --git a/common.c b/common.c index 2ce43d9e..da0c6ba7 100644 --- a/common.c +++ b/common.c @@ -724,6 +724,7 @@ void fish_setlocale(int category, const wchar_t *locale) { char *lang = wcs2str( locale ); setlocale(category,lang); + free( lang ); /* Use ellipsis if on known unicode system, otherwise use $ @@ -784,11 +785,16 @@ int writeb( tputs_arg_t b ) void die_mem() { - debug( 0, L"Out of memory, shutting down fish." ); + /* + Do not translate this message, and do not send it through the + usual channels. This increases the odds that the message gets + through correctly, even if we are out of memory. + */ + fwprintf( stderr, L"Out of memory, shutting down fish.\n" ); exit(1); } -void debug( int level, wchar_t *msg, ... ) +void debug( int level, const wchar_t *msg, ... ) { va_list va; string_buffer_t sb; diff --git a/common.h b/common.h index 5176b4e4..77de61ca 100644 --- a/common.h +++ b/common.h @@ -134,7 +134,6 @@ wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b ); */ wchar_t *wcsdupcat2( const wchar_t *a, ... ); -#ifndef HAVE_WCSNDUP /** Returns a newly allocated wide character string wich is a copy of the string in, but of length c or shorter. The returned string is @@ -142,7 +141,6 @@ wchar_t *wcsdupcat2( const wchar_t *a, ... ); length. */ wchar_t *wcsndup( const wchar_t *in, int c ); -#endif /** Converts from wide char to digit in the specified base. If d is not @@ -185,19 +183,14 @@ size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz ); */ size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz ); -#ifndef HAVE_WCSDUP /** Create a duplicate string. Wide string version of strdup. Will automatically exit if out of memory. */ wchar_t *wcsdup(const wchar_t *in); -#endif -#ifndef HAVE_WCSLEN size_t wcslen(const wchar_t *in); -#endif -#ifndef HAVE_WCSCASECMP /** Case insensitive string compare function. Wide string version of strcasecmp. @@ -210,9 +203,7 @@ size_t wcslen(const wchar_t *in); a user-supplied string should be considered a bug. */ int wcscasecmp( const wchar_t *a, const wchar_t *b ); -#endif -#ifndef HAVE_WCSNCASECMP /** Case insensitive string compare function. Wide string version of strncasecmp. @@ -225,7 +216,6 @@ int wcscasecmp( const wchar_t *a, const wchar_t *b ); a user-supplied string should be considered a bug. */ int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count ); -#endif /** Test if the given string is a valid variable name @@ -314,7 +304,7 @@ void common_destroy(); will print the string 'fish: Pi = 3.141', given that debug_level is 1 or higher, and that program_name is 'fish'. */ -void debug( int level, wchar_t *msg, ... ); +void debug( int level, const wchar_t *msg, ... ); /** Replace special characters with backslash escape sequences. Newline is diff --git a/complete.c b/complete.c index 7280c04b..af2a5f54 100644 --- a/complete.c +++ b/complete.c @@ -35,6 +35,7 @@ #include "reader.h" #include "history.h" #include "intern.h" +#include "translate.h" #include "wutil.h" @@ -746,7 +747,7 @@ int complete_is_valid_option( const wchar_t *str, str[0] = opt[j]; str[1]=0; al_push( errors, - wcsdupcat2(L"Unknown option \'", str, L"\'", 0) ); + wcsdupcat2(_( L"Unknown option: " ), L"'", str, L"'", 0) ); } opt_found = 0; @@ -765,12 +766,12 @@ int complete_is_valid_option( const wchar_t *str, if( hash_get_count( &gnu_match_hash )==0) { al_push( errors, - wcsdupcat2(L"Unknown option \'", opt, L"\'", 0) ); + wcsdupcat2( _(L"Unknown option: "), L"'", opt, L"\'", 0) ); } else { al_push( errors, - wcsdupcat2(L"Multiple matches for option \'", opt, L"\'", 0) ); + wcsdupcat2( _(L"Multiple matches for option: "), L"'", opt, L"\'", 0) ); } } } @@ -845,7 +846,7 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig ) if( al_get_count( &l )>0 ) { wchar_t *ln = (wchar_t *)al_get(&l, 0 ); - if( wcscmp( ln, L"unknown" ) != 0 ) + if( wcscmp( ln, _(L"unknown") ) != 0 ) { desc = wcsdupcat( COMPLETE_SEP_STR, ln); /* diff --git a/configure.ac b/configure.ac index 9a623d92..0694e0df 100644 --- a/configure.ac +++ b/configure.ac @@ -53,6 +53,9 @@ else AC_SUBST( PREFIX, [$prefix]) fi +AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory]) +AC_SUBST( [LOCALEDIR], [$datadir/locale]) + AC_SUBST(fishdir,[/fish.d]) AC_SUBST(fishfile,[/fish]) AC_SUBST(fishinputfile,[/fish_inputrc]) @@ -63,6 +66,7 @@ if test -z $docdir; then AC_SUBST(docdir,[$datadir/doc/fish]) fi + AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] ) AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] ) AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] ) @@ -113,6 +117,7 @@ else AC_MSG_RESULT(no) fi + # Check for RLIMIT_NPROC in sys/resource.h. AC_MSG_CHECKING([for RLIMIT_NPROC in sys/resource.h]) AC_TRY_COMPILE([#include ], @@ -125,18 +130,17 @@ else AC_MSG_RESULT(no) fi +AC_CHECK_LIB(socket, connect, rt, nanosleep) +AC_CHECK_FUNCS(wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext) -AC_CHECK_LIB(socket, connect) -AC_CHECK_LIB(rt, nanosleep) - -AC_CHECK_FUNCS(wcsdup wcsndup wcslen wcscasecmp wcsncasecmp) +AC_CHECK_FUNC(gettext, AC_SUBST(HAVE_GETTEXT,1), AC_SUBST(HAVE_GETTEXT,0) ) # Check if we have ncurses, and use it rather than curses if possible. AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])]) -#Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an -#ugly kludge to force NetBSD to use ncurses, since NetBSDs own version -#does not properly support terminfo. +# Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an +# ugly kludge to force NetBSD to use ncurses, since NetBSDs own version +# does not properly support terminfo. AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)]) AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish]) diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index 0cf0eb97..7c1c4856 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -975,7 +975,68 @@ it's initalization files to function properly. To solve this problem, either copy the initialization files to each fish users home directory, or install them in /etc. +\section i18n Translating fish to other languages + +Fish uses the GNU gettext library to implement translation to multiple +languages. If fish is not available in your language, please consider +making a translation. Currently, only the shell itself can be +translated, a future version of fish should also include translated +manuals. + +To make a translation of fish, you will first need the sourcecode, +available from the fish +homepage. Download the latest version, and then extract it using a +command like tar -zxf fish-VERSION.tar.gz. + +Next, cd into the newly created fish directory using cd +fish-VERSION. + +You will now need to configure the sourcecode using the command +./configure. This step might take a while. + +Before you continue, you will need to know the ISO 639 language code +of the language you are translating to. These codes can be found here. For +example, the language code for Uighur is ug. + +Now you have the sourcecode and it is properly configured. Lets start +translating. To do this, first create an empty translation table for +the language you wish to translate to by writing make +po/[LANGUAGE CODE].po in the fish terminal. For example, if you +are translating to Uighur, you should write make +po/ug.po. This should create the file po/ug.po, a template +translation table containing all the strings that need to be +translated. + +Now you are all set up to translate fish to a new language. Open the +newly created .po file in your editor of choice, and start +translating. The .po file format is rather simple. It contains pairs +of string in a format like: +
+msgid "%ls: No suitable job\n"
+msgstr ""
+
+ +The first line is the english string to translate, the second line +should contain your translation. For example, in swedish the above +might become: + +
+msgid "%ls: No suitable job\n"
+msgstr "%ls: Inget jobb matchar\n"
+
+ +%s, %ls, %d and other tokens beginning with a '%' are +placeholders. These will be replaced by a value by fish at +runtime. You must always take care to use exactly the same +placeholders in the same order in your translation. (Actually, there +are ways to avoid this, but they are to complicated for this short +introduction. See the full manual for the printf C function for more +information.) + +Once you have provided a translation for fish, please send it to fish-users@lists.sf.net. \section todo Missing features and bugs diff --git a/env.c b/env.c index 13a0dc82..dc60cb8e 100644 --- a/env.c +++ b/env.c @@ -41,6 +41,7 @@ #include "env_universal.h" #include "input_common.h" #include "event.h" +#include "translate.h" /** Command used to start fishd @@ -190,7 +191,7 @@ static void start_fishd() if( !pw ) { - debug( 0, L"Could not get user information" ); + debug( 0, _( L"Could not get user information" ) ); return; } @@ -417,7 +418,7 @@ void env_init() free( uname ); } - env_universal_init( env_get( L"FISHD_SOKET_DIR"), + env_universal_init( env_get( L"FISHD_SOCKET_DIR"), env_get( L"USER" ), &start_fishd, &universal_callback ); @@ -499,6 +500,11 @@ void env_set( const wchar_t *key, if( wcscmp(key, L"LANG" )==0 ) { fish_setlocale(LC_ALL,val); + /* Make change known to gettext. */ + { + extern int _nl_msg_cat_cntr; + ++_nl_msg_cat_cntr; + } } if( wcscmp( key, L"umask" ) == 0) @@ -754,7 +760,7 @@ wchar_t *env_get( const wchar_t *key ) wchar_t *next = history_get( i-add_current ); if( !next ) { - debug( 1, L"No history at idx %d\n", i ); + debug( 1, _( L"No history at idx %d\n" ), i ); break; } @@ -914,7 +920,7 @@ void env_pop() else { debug( 0, - L"Tried to pop empty environment stack." ); + _( L"Tried to pop empty environment stack." ) ); sanity_lose(); } } diff --git a/event.c b/event.c index 4abdaf00..374b4f41 100644 --- a/event.c +++ b/event.c @@ -19,6 +19,7 @@ #include "common.h" #include "event.h" #include "signal.h" +#include "translate.h" /** Number of signals that can be queued before an overflow occurs @@ -486,7 +487,7 @@ static void event_fire_delayed() if( lst->overflow ) { - debug( 0, L"Signal list overflow. Signals have been ignored" ); + debug( 0, _( L"Signal list overflow. Signals have been ignored." ) ); } /* diff --git a/exec.c b/exec.c index a2e982a2..69baf8a9 100644 --- a/exec.c +++ b/exec.c @@ -36,6 +36,7 @@ #include "expand.h" #include "signal.h" #include "env_universal.h" +#include "translate.h" /** Prototype for the getpgid library function. The prototype for this @@ -48,15 +49,15 @@ pid_t getpgid( pid_t pid ); /** file descriptor redirection error message */ -#define FD_ERROR L"An error occurred while redirecting file descriptor %d" +#define FD_ERROR _( L"An error occurred while redirecting file descriptor %d" ) /** file redirection error message */ -#define FILE_ERROR L"An error occurred while redirecting file '%ls'" +#define FILE_ERROR _( L"An error occurred while redirecting file '%ls'" ) /** fork error message */ -#define FORK_ERROR L"Could not create child process - exiting" +#define FORK_ERROR _( L"Could not create child process - exiting" ) /** @@ -421,7 +422,7 @@ static void launch_process( process_t *p ) execve (wcs2str(p->actual_cmd), wcsv2strv( (const wchar_t **) p->argv), env_export_arr( 0 ) ); debug( 0, - L"Failed to execute process %ls", + _( L"Failed to execute process '%ls'" ), p->actual_cmd ); wperror( L"execve" ); exit(1); @@ -580,7 +581,7 @@ static int handle_new_child( job_t *j, process_t *p ) if( getpgid( p->pid) != j->pgid ) { debug( 1, - L"Could not send process %d from group %d to group %d", + _( L"Could not send process %d from group %d to group %d" ), p->pid, getpgid( p->pid), j->pgid ); @@ -592,7 +593,7 @@ static int handle_new_child( job_t *j, process_t *p ) { if( tcsetpgrp (0, j->pgid) ) { - debug( 1, L"Could not send job %d ('%ls')to foreground", + debug( 1, _( L"Could not send job %d ('%ls') to foreground" ), j->job_id, j->command ); wperror( L"tcsetpgrp" ); @@ -604,7 +605,7 @@ static int handle_new_child( job_t *j, process_t *p ) { if( tcsetpgrp (0, j->pgid) ) { - debug( 1, L"Could not send job %d ('%ls')to foreground", + debug( 1, _( L"Could not send job %d ('%ls') to foreground" ), j->job_id, j->command ); wperror( L"tcsetpgrp" ); @@ -766,7 +767,7 @@ void exec( job_t *j ) // fwprintf( stderr, L"run function %ls\n", argv[0] ); if( def == 0 ) { - debug( 0, L"Unknown function %ls", p->argv[0] ); + debug( 0, _( L"Unknown function '%ls'" ), p->argv[0] ); break; } parser_push_block( FUNCTION_CALL ); @@ -874,7 +875,7 @@ void exec( job_t *j ) { builtin_stdin=-1; debug( 1, - L"Unknown input redirection type %d", + _( L"Unknown input redirection type %d" ), in->io_mode); break; } @@ -1201,7 +1202,7 @@ int exec_subshell( const wchar_t *cmd, if( !cmd ) { debug( 1, - L"Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %s", + _( L"Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %s." ), PACKAGE_BUGREPORT ); return 0; } diff --git a/exec.h b/exec.h index f023f7b9..aa4e93fb 100644 --- a/exec.h +++ b/exec.h @@ -16,7 +16,7 @@ /** pipe redirection error message */ -#define PIPE_ERROR L"An error occurred while setting up pipe" +#define PIPE_ERROR _(L"An error occurred while setting up pipe") /** Initialize the exec library diff --git a/fish.spec.in b/fish.spec.in index 34074e7f..97d7e29d 100644 --- a/fish.spec.in +++ b/fish.spec.in @@ -67,6 +67,7 @@ fi %config %_sysconfdir/fish.d/fish_*.fish %dir %_sysconfdir/fish.d/completions %config %_sysconfdir/fish.d/completions/*.fish +%_datadir/locale/*/fish.cat %changelog * Tue Nov 29 2005 Axel Liljencrantz 1.17.0-0 diff --git a/init/completions/ls.fish b/init/completions/ls.fish index 68fe5de1..d15c5f6a 100644 --- a/init/completions/ls.fish +++ b/init/completions/ls.fish @@ -70,6 +70,6 @@ for i in ls ll la complete -c $i -s X -d "sort by extension" complete -c $i -s 1 -d "List one file per line" complete -c $i -l help -d "Display help and exit" - complete -c $i -l version -d "Output version and exit" + complete -c $i -l version -d "Display version and exit" end diff --git a/input.c b/input.c index fbf3c136..6ca5df1a 100644 --- a/input.c +++ b/input.c @@ -50,6 +50,7 @@ implementation in fish is as of yet incomplete. #include "env.h" #include "expand.h" #include "event.h" +#include "translate.h" static void input_read_inputrc( wchar_t *fn ); @@ -402,7 +403,7 @@ static wchar_t *input_symbolic_sequence( const wchar_t *in ) in++; if( c < L'a' || c > L'z' ) { - debug( 1, L"Invalid Control sequence" ); + debug( 1, _( L"Invalid Control sequence" ) ); return 0; } if( has_meta ) @@ -514,7 +515,7 @@ static wchar_t *input_symbolic_sequence( const wchar_t *in ) } if( !res ) { - debug( 1, L"Could not parse sequence %ls", in ); + debug( 1, _( L"Could not parse sequence '%ls'" ), in ); return 0; } if( !*in || *in == L'\n') @@ -678,7 +679,7 @@ static wchar_t *input_expand_sequence( const wchar_t *in ) if( *in != L'-' ) { error=1; - debug( 1, L"Invalid sequence - no dash after control\n" ); + debug( 1, _( L"Invalid sequence - no dash after control\n" ) ); break; } in++; @@ -696,7 +697,7 @@ static wchar_t *input_expand_sequence( const wchar_t *in ) *(out++)=*in-L'A'+1; break; } - debug( 1, L"Invalid sequence - Control-nothing?\n" ); + debug( 1, _( L"Invalid sequence - Control-nothing?\n" ) ); error = 1; break; @@ -711,12 +712,12 @@ static wchar_t *input_expand_sequence( const wchar_t *in ) if( *in != L'-' ) { error=1; - debug( 1, L"Invalid sequence - no dash after meta\n" ); + debug( 1, _( L"Invalid sequence - no dash after meta\n" ) ); break; } if( !*(in+1) ) { - debug( 1, L"Invalid sequence - Meta-nothing?" ); + debug( 1, _( L"Invalid sequence - Meta-nothing?" ) ); error=1; break; } @@ -761,7 +762,7 @@ static wchar_t *input_expand_sequence( const wchar_t *in ) { if( wcslen( res ) == 0 ) { - debug( 1, L"Invalid sequence - '%ls' expanded to zero characters", in_orig ); + debug( 1, _( L"Invalid sequence - '%ls' expanded to zero characters" ), in_orig ); error =1; res = 0; } @@ -825,7 +826,7 @@ void input_parse_inputrc_line( wchar_t *cmd ) { inputrc_error = 1; debug( 1, - L"Mismatched $endif in inputrc file" ); + _( L"Mismatched $endif in inputrc file" ) ); } } return; @@ -877,7 +878,7 @@ void input_parse_inputrc_line( wchar_t *cmd ) if( !*cmd ) { debug( 1, - L"Mismatched quote" ); + _( L"Mismatched quote" ) ); inputrc_error = 1; return; } @@ -891,7 +892,7 @@ void input_parse_inputrc_line( wchar_t *cmd ) if( *cmd != L':' ) { debug( 1, - L"Expected a \':\'" ); + _( L"Expected a \':\'" ) ); inputrc_error = 1; return; } @@ -936,16 +937,16 @@ void input_parse_inputrc_line( wchar_t *cmd ) if( wcscmp( set, L"set" ) != 0 ) { - debug( 1, L"I don\'t know what %ls means", set ); + debug( 1, _( L"I don\'t know what '%ls' means" ), set ); } else if( end ) { - debug( 1, L"Expected end of line, got '%ls'", end ); + debug( 1, _( L"Expected end of line, got '%ls'" ), end ); } else if( (!key) || (!value) ) { - debug( 1, L"Syntax: set KEY VALUE" ); + debug( 1, _( L"Syntax: set KEY VALUE" ) ); } else { @@ -1011,7 +1012,7 @@ void input_parse_inputrc_line( wchar_t *cmd ) if( !cmd ) { debug( 1, - L"Unable to parse binding" ); + _( L"Unable to parse binding" ) ); inputrc_error = 1; return; } @@ -1037,7 +1038,7 @@ void input_parse_inputrc_line( wchar_t *cmd ) } - debug( 1, L"I don\'t know what %ls means", cmd ); + debug( 1, _( L"I don\'t know what %ls means" ), cmd ); } /** @@ -1063,7 +1064,7 @@ static void input_read_inputrc( wchar_t *fn ) case -1: { debug( 1, - L"Error while reading input information from file: %s", + _( L"Error while reading input information from file '%ls'" ), fn ); wperror( L"fgetws2 (read_ni)" ); @@ -1168,6 +1169,8 @@ static void add_common_bindings() add_terminfo_mapping( name[i], (key_backspace), L"Backspace", L"backward-delete-char" ); add_mapping( name[i], L"\x7f", L"Backspace", L"backward-delete-char" ); + add_mapping( name[i], L"\e[H", L"Home", L"beginning-of-line" ); + add_mapping( name[i], L"\e[F", L"End", L"end-of-line" ); add_terminfo_mapping( name[i], (key_home), L"Home", L"beginning-of-line" ); add_terminfo_mapping( name[i], (key_end), L"End", L"end-of-line" ); @@ -1288,7 +1291,7 @@ int input_init() if( setupterm( 0, STDOUT_FILENO, 0) == ERR ) { - debug( 0, L"Could not set up terminal" ); + debug( 0, _( L"Could not set up terminal" ) ); exit(1); } hash_init( &all_mappings, &hash_wcs_func, &hash_wcs_cmp ); diff --git a/io.c b/io.c index 2e4f4f30..1f340c2e 100644 --- a/io.c +++ b/io.c @@ -32,6 +32,7 @@ Utilities for io redirection. #include "exec.h" #include "common.h" #include "io.h" +#include "translate.h" @@ -69,7 +70,7 @@ void io_buffer_read( io_data_t *d ) if( errno != EAGAIN ) { debug( 1, - L"An error occured while reading output from code block on fd %d", + _(L"An error occured while reading output from code block on fd %d"), d->param1.pipe_fd[0] ); wperror( L"io_buffer_read" ); } diff --git a/main.c b/main.c index e4be0c64..88a49677 100644 --- a/main.c +++ b/main.c @@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "exec.h" #include "event.h" #include "output.h" +#include "translate.h" /** Parse init files @@ -207,7 +208,8 @@ int main( int argc, char **argv ) if( force_interactive ) is_interactive_session=1; - + + translate_init(); proc_init(); output_init(); event_init(); @@ -300,6 +302,7 @@ int main( int argc, char **argv ) exec_destroy(); event_destroy(); output_destroy(); + translate_destroy(); intern_free_all(); diff --git a/parser.c b/parser.c index 599a01f7..0e2f9dae 100644 --- a/parser.c +++ b/parser.c @@ -35,6 +35,8 @@ The fish parser. Contains functions for parsing code. #include "sanity.h" #include "env_universal.h" #include "event.h" +#include "translate.h" +#include "msgnrs.h" /** Length of the lineinfo string used for describing the current tokenizer position */ #define LINEINFO_SIZE 128 @@ -55,93 +57,188 @@ The fish parser. Contains functions for parsing code. Message about reporting bugs, used on weird internal error to hopefully get them to report stuff. */ -#define BUGREPORT_MSG L"If this error can be reproduced, please send a bug report to %s." +#define BUGREPORT_MSG _( L"If this error can be reproduced, please send a bug report to %s.") /** Error message for improper use of the exec builtin */ -#define EXEC_ERR_MSG L"this command can not be used in a pipeline" +#define EXEC_ERR_MSG _(L"This command can not be used in a pipeline") /** Error message for tokenizer error. The tokenizer message is appended to this message. */ -#define TOK_ERR_MSG L"Tokenizer error: '%ls'" +#define TOK_ERR_MSG _( L"Tokenizer error: '%ls'") /** Error message for short circut command error. */ -#define COND_ERR_MSG L"Short circut command requires additional command" +#define COND_ERR_MSG _( L"Short circut command requires additional command") /** Error message on reaching maximum recusrion depth */ -#define RECURSION_ERR_MSG L"Maximum recursion depth reached. Accidental infinite loop?" +#define RECURSION_ERR_MSG _( L"Maximum recursion depth reached. Accidental infinite loop?") /** Error message used when the end of a block can't be located */ -#define BLOCK_END_ERR_MSG L"Could not locate end of block. The 'end' command is missing, misspelled or a preceding ';' is missing." +#define BLOCK_END_ERR_MSG _( L"Could not locate end of block. The 'end' command is missing, misspelled or a preceding ';' is missing.") /** Error message on reaching maximum number of block calls */ -#define BLOCK_ERR_MSG L"Maximum number of nested blocks reached." +#define BLOCK_ERR_MSG _( L"Maximum number of nested blocks reached.") /** Error message when a non-string token is found when expecting a command name */ -#define CMD_ERR_MSG L"Expected a command string, got token of type '%ls'" +#define CMD_ERR_MSG _( L"Expected a command string, got token of type '%ls'.") /** Error message when encountering an illegal command name */ -#define ILLEGAL_CMD_ERR_MSG L"Illegal command name '%ls'" +#define ILLEGAL_CMD_ERR_MSG _( L"Illegal command name '%ls'.") /** Error message for wildcards with no matches */ -#define WILDCARD_ERR_MSG L"Warning: No match for wildcard '%ls'" +#define WILDCARD_ERR_MSG _( L"Warning: No match for wildcard '%ls'. The command will not be executed.") /** Error when using case builtin outside of switch block */ -#define INVALID_CASE_ERR_MSG L"'case' builtin not inside of switch block" +#define INVALID_CASE_ERR_MSG _( L"'case' builtin not inside of switch block") /** Error when using loop control builtins (break or continue) outside of loop */ -#define INVALID_LOOP_ERR_MSG L"Loop control command while not inside of loop" +#define INVALID_LOOP_ERR_MSG _( L"Loop control command while not inside of loop" ) /** Error when using else builtin outside of if block */ -#define INVALID_ELSE_ERR_MSG L"'else' builtin not inside of if block" +#define INVALID_ELSE_ERR_MSG _( L"'else' builtin not inside of if block" ) /** Error when using end builtin outside of block */ -#define INVALID_END_ERR_MSG L"'end' command outside of block" +#define INVALID_END_ERR_MSG _( L"'end' command outside of block") /** Error message for Posix-style assignment */ -#define COMMAND_ASSIGN_ERR_MSG L"Unknown command '%ls'. Did you mean 'set VARIABLE VALUE'? For information on setting variable values, see the manual section on the set command by typing 'help set'." +#define COMMAND_ASSIGN_ERR_MSG _( L"Unknown command '%ls'. Did you mean 'set VARIABLE VALUE'? For information on setting variable values, see the manual section on the set command by typing 'help set'.") /** Error for invalid redirection token */ -#define REDIRECT_TOKEN_ERR_MSG L"Expected redirection specification, got token of type '%ls'" +#define REDIRECT_TOKEN_ERR_MSG _( L"Expected redirection specification, got token of type '%ls'") /** Error when encountering redirection without a command */ -#define INVALID_REDIRECTION_ERR_MSG L"Encountered redirection when expecting a command name. Fish does not allow a redirection operation before a command." +#define INVALID_REDIRECTION_ERR_MSG _( L"Encountered redirection when expecting a command name. Fish does not allow a redirection operation before a command.") + +/** + Error for evaluating null pointer +*/ +#define EVAL_NULL_ERR_MSG _( L"Tried to evaluate null pointer." ) + +/** + Error for evaluating in illegal scope +*/ +#define INVALID_SCOPE_ERR_MSG _( L"Tried to evaluate buffer using invalid block scope of type '%ls'." ) + /** Error for wrong token type */ -#define UNEXPECTED_TOKEN_ERR_MSG L"Unexpected token of type '%ls'" +#define UNEXPECTED_TOKEN_ERR_MSG _( L"Unexpected token of type '%ls'") + +/** + Unexpected error in parser_get_filename() +*/ +#define MISSING_COMMAND_ERR_MSG _( L"Error while searching for command '%ls'" ) + + +/** + While block description +*/ +#define WHILE_BLOCK _( L"'while' block" ) + + +/** + For block description +*/ +#define FOR_BLOCK _( L"'for' block" ) + + +/** + If block description +*/ +#define IF_BLOCK _( L"'if' conditional block" ) + + +/** + function definition block description +*/ +#define FUNCTION_DEF_BLOCK _( L"function definition block" ) + + +/** + Function invocation block description +*/ +#define FUNCTION_CALL_BLOCK _( L"function invocation block" ) + + +/** + Switch block description +*/ +#define SWITCH_BLOCK _( L"'switch' block" ) + + +/** + Fake block description +*/ +#define FAKE_BLOCK _( L"unexecutable block" ) + + +/** + Top block description +*/ +#define TOP_BLOCK _( L"global root block" ) + + +/** + Command substitution block description +*/ +#define SUBST_BLOCK _( L"command substitution block" ) + + +/** + Begin block description +*/ +#define BEGIN_BLOCK _( L"unconditional block" ) + + +/** + And block description +*/ +#define AND_BLOCK _( L"'and' conditional block" ) + + +/** + block description +*/ +#define OR_BLOCK _( L"'or' conditional block" ) + + +/** + Unknown block description +*/ +#define UNKNOWN_BLOCK _( L"unknown/invalid block" ) + /** Last error code */ int error_code; @@ -322,48 +419,48 @@ void parser_pop_block() free( old ); } -wchar_t *parser_get_block_desc( int block ) +const wchar_t *parser_get_block_desc( int block ) { switch( block ) { case WHILE: - return L"while block"; + return WHILE_BLOCK; case FOR: - return L"for block"; + return FOR_BLOCK; case IF: - return L"'if' conditional block"; + return IF_BLOCK; case FUNCTION_DEF: - return L"function definition block"; + return FUNCTION_DEF_BLOCK; case FUNCTION_CALL: - return L"function invocation block"; + return FUNCTION_CALL_BLOCK; case SWITCH: - return L"switch block"; + return SWITCH_BLOCK; case FAKE: - return L"unexecutable block"; + return FAKE_BLOCK; case TOP: - return L"global root block"; + return TOP_BLOCK; case SUBST: - return L"command substitution block"; + return SUBST_BLOCK; case BEGIN: - return L"unconditional block"; + return BEGIN_BLOCK; case AND: - return L"'and' conditional command"; + return AND_BLOCK; case OR: - return L"'or' conditional command"; + return OR_BLOCK; default: - return L"unknown/invalid block"; + return UNKNOWN_BLOCK; } } @@ -714,7 +811,7 @@ wchar_t *get_filename( const wchar_t *cmd ) break; default: debug( 1, - L"Error while searching for command %ls", + MISSING_COMMAND_ERR_MSG, new_cmd ); wperror( L"access" ); } @@ -724,7 +821,6 @@ wchar_t *get_filename( const wchar_t *cmd ) free( new_cmd ); } } - return 0; } @@ -793,13 +889,13 @@ void parser_destroy() if( !f ) { debug( 1, - L"Could not write profiling information to file '%s'", + _(L"Could not write profiling information to file '%s'"), profile ); } else { fwprintf( f, - L"Time\tSum\tCommand\n", + _(L"Time\tSum\tCommand\n"), al_get_count( &profile_data ) ); print_profile( &profile_data, 0, f ); fclose( f ); @@ -949,7 +1045,7 @@ wchar_t *parser_current_line() { swprintf( lineinfo, LINEINFO_SIZE, - L"%ls (line %d): %n", + _(L"%ls (line %d): %n"), file, lineno, &offset ); @@ -1135,7 +1231,7 @@ static void parse_job_main_loop( process_t *p, { error( SYNTAX_ERROR, tok_get_pos( tok ), - L"Could not expand string '%ls'", + _(L"Could not expand string '%ls'"), tok_last(tok) ); } @@ -1237,7 +1333,7 @@ static void parse_job_main_loop( process_t *p, if( error_code == 0 ) error( SYNTAX_ERROR, tok_get_pos( tok ), - L"Invalid IO redirection" ); + _(L"Invalid IO redirection") ); tok_next(tok); } else @@ -1280,8 +1376,7 @@ static void parse_job_main_loop( process_t *p, { error( SYNTAX_ERROR, tok_get_pos( tok ), - L"Requested redirection to something " - L"that is not a file descriptor %ls", + _(L"Requested redirection to something that is not a file descriptor %ls"), target ); tok_next(tok); @@ -1672,7 +1767,7 @@ static int parse_job( process_t *p, { error( EVAL_ERROR, tok_get_pos( tok ), - L"Unknown command '%ls'", + _(L"Unknown command '%ls'"), (wchar_t *)al_get( &args, 0 ) ); } @@ -2046,7 +2141,9 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type ) if( !cmd ) { debug( 1, - L"Tried to evaluate null pointer. " BUGREPORT_MSG, + EVAL_NULL_ERR_MSG ); + debug( 1, + BUGREPORT_MSG, PACKAGE_BUGREPORT ); return 1; } @@ -2056,8 +2153,11 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type ) (block_type != SUBST)) { debug( 1, - L"Tried to evaluate buffer using invalid block scope of type '%ls'. " BUGREPORT_MSG, - parser_get_block_desc( block_type ), + INVALID_SCOPE_ERR_MSG, + parser_get_block_desc( block_type ) ); + + debug( 1, + BUGREPORT_MSG, PACKAGE_BUGREPORT ); return 1; } @@ -2092,8 +2192,8 @@ int eval( const wchar_t *cmd, io_data_t *io, int block_type ) if( current_block == 0 ) { debug( 0, - L"End of block mismatch. " - L"Program terminating. " + _(L"End of block mismatch. Program terminating.") ); + debug( 0, BUGREPORT_MSG, PACKAGE_BUGREPORT ); exit(1); diff --git a/parser.h b/parser.h index 368da65e..0c23b1dd 100644 --- a/parser.h +++ b/parser.h @@ -283,7 +283,7 @@ void parser_pop_block(); /** Return a description of the given blocktype */ -wchar_t *parser_get_block_desc( int block ); +const wchar_t *parser_get_block_desc( int block ); /** diff --git a/po/sv.po b/po/sv.po new file mode 100644 index 00000000..1a5d13a6 --- /dev/null +++ b/po/sv.po @@ -0,0 +1,1140 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: fish 1.20.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2006-01-04 12:52+0100\n" +"Last-Translator: Axel Liljencrantz \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: builtin.c:80 +#, c-format +msgid "Send job %d, '%ls' to foreground\n" +msgstr "Skicka job %d, '%ls' till förgrunden\n" + +#: builtin.c:370 +#, c-format +msgid "%ls: Can not specify scope when removing block\n" +msgstr "%ls: Can inte specificera blocknivå vid blockradering\n" + +#: builtin.c:376 +#, c-format +msgid "%ls: No blocks defined\n" +msgstr "%ls: Inga block är definerade\n" + +#: builtin.c:829 builtin.h:28 +#, c-format +msgid "%ls: Invalid combination of options\n" +msgstr "%ls: Ogiltig kombination av block\n" + +#: builtin.c:853 +#, c-format +msgid "%ls: Expected exactly one function name\n" +msgstr "%ls: Förväntade exakt ett funktionsnamn\n" + +#: builtin.c:863 +#, c-format +msgid "%ls: Function '%ls' does not exist\n" +msgstr "%ls: Funktionen '%ls' existerar inte\n" + +#: builtin.c:902 +msgid "" +"Current function definitions are:\n" +"\n" +msgstr "" +"Nuvarande funktionsdefinitioner är:\n" +"\n" + +#: builtin.c:1064 +#, c-format +msgid "%ls: Unknown signal '%ls'\n" +msgstr "%ls: Okänd signal '%ls'\n" + +#: builtin.c:1088 +#, c-format +msgid "%ls: Invalid variable name '%ls'\n" +msgstr "%ls: Ogiltigt variabelnamn '%ls'\n" + +#: builtin.c:1150 +#, c-format +msgid "%ls: Cannot find calling job for event handler\n" +msgstr "%ls: Kan inte hitta anropande job för händelsehanterare\n" + +#: builtin.c:1168 +#, c-format +msgid "%ls: Invalid process id %ls\n" +msgstr "%ls: Ogiltigt processid %ls\n" + +#: builtin.c:1205 +#, c-format +msgid "%ls: Expected one argument, got %d\n" +msgstr "%ls: Förväntade ett argument, fick %d\n" + +#: builtin.c:1213 +#, c-format +msgid "%ls: Illegal function name '%ls'\n" +msgstr "%ls: Ogiltigt funktionsnamn '%ls'\n" + +#: builtin.c:1223 +#, c-format +msgid "" +"%ls: The name '%ls' is reserved,\n" +"and can not be used as a function name\n" +msgstr "" +"%ls: Namnet '%ls' är reserverat,\n" +" och kan inte användas som funktionsnamn\n" + +#: builtin.c:1239 +msgid "Current functions are: " +msgstr "Nuvarande funktioner är: " + +#: builtin.c:1382 +#, c-format +msgid "%ls: Seed value '%ls' is not a valid number\n" +msgstr "%ls: Seedningsvärde '%ls' är inte ett giltigt nummer\n" + +#: builtin.c:1396 +#, c-format +msgid "%ls: Expected zero or one argument, got %d\n" +msgstr "%ls: Förväntade noll eller ett argument, fick %d\n" + +#: builtin.c:1830 builtin.c:3031 +#, c-format +msgid "%ls: Argument must be an integer '%ls'\n" +msgstr "%ls: Argumentet '%d' är inte ett heltal\n" + +#: builtin.c:1841 builtin.c:2134 builtin.c:3042 +#, c-format +msgid "%ls: Too many arguments\n" +msgstr "%ls: För många argument\n" + +#: builtin.c:1886 +#, c-format +msgid "%ls: Could not find home directory\n" +msgstr "%ls: Kunde inte hitta hemkatalogen\n" + +#: builtin.c:1898 +#, c-format +msgid "%ls: '%ls' is not a directory or you do not have permission to enter it\n" +msgstr "%ls: '%ls' är inte en katalog, eller så har du inte rättigheter att läsa denna katalog\n" + +#: builtin.c:1910 +#, c-format +msgid "%ls: '%ls' is not a directory\n" +msgstr "%ls: '%ls' är inte en katalog\n" + +#: builtin.c:1925 +#, c-format +msgid "%ls: Could not set PWD variable\n" +msgstr "%ls: Kunde inte sätta variableln PWD\n" + +#: builtin.c:2080 +#, c-format +msgid "%ls: Parameter '%ls' is too long\n" +msgstr "%ls: Parametern '%ls' är för lång\n" + +#: builtin.c:2201 builtin.c:3087 +#, c-format +msgid "%ls: Expected exactly one argument, got %d\n" +msgstr "%ls: Förväntade exakt ett argument, fick %d\n" + +#: builtin.c:2214 +#, c-format +msgid "%ls: '%ls' is not a file\n" +msgstr "%ls: '%ls' är inte en fil\n" + +#: builtin.c:2239 +#, c-format +msgid "%ls: Error while reading file '%ls'\n" +msgstr "%ls: Ett fel uppstod medan filen '%ls' lästed\n" + +#: builtin.c:2312 +#, c-format +msgid "%ls: Ambiguous job\n" +msgstr "%ls: Mer än ett job matchar\n" + +#: builtin.c:2318 +#, c-format +msgid "%ls: '%ls' is not a job\n" +msgstr "%ls: '%ls' är inte ett jobb\n" + +#: builtin.c:2335 +#, c-format +msgid "%ls: No suitable job\n" +msgstr "%ls: Inget jobb matchar\n" + +#: builtin.c:2385 +#, c-format +msgid "%ls: Unknown job '%ls'\n" +msgstr "%ls: Okänt jobb '%ls'\n" + +#: builtin.c:2394 +#, c-format +msgid "Send job %d '%ls' to background\n" +msgstr "Skicka jobb %d '%ls' till bakgrunden\n" + +#: builtin.c:2414 +msgid "(default)" +msgstr "(standard)" + +#: builtin.c:2468 +msgid "Job\tGroup\t" +msgstr "Jobb\tGrupp\t" + +#: builtin.c:2470 +msgid "CPU\t" +msgstr "CPU\t" + +#: builtin.c:2472 +msgid "State\tCommand\n" +msgstr "Tillstånd\tKommando\n" + +#: builtin.c:2481 proc.c:612 +msgid "stopped" +msgstr "stannat" + +#: builtin.c:2481 +msgid "running" +msgstr "kör" + +#: builtin.c:2496 +msgid "Group\n" +msgstr "Grupp\n" + +#: builtin.c:2509 +msgid "Procces\n" +msgstr "Process\n" + +#: builtin.c:2526 +msgid "Command\n" +msgstr "Kommando\n" + +#: builtin.c:2678 +#, c-format +msgid "%ls: Not a process id: '%ls'\n" +msgstr "%ls: '%ls' är inte ett processid\n" + +#: builtin.c:2693 +#, c-format +msgid "%ls: No suitable job: %d\n" +msgstr "%ls: Inget passande jobb: %d\n" + +#: builtin.c:2719 +#, c-format +msgid "%ls: There are no jobs\n" +msgstr "%ls: Det finns inga jobb\n" + +#: builtin.c:2738 +#, c-format +msgid "%ls: Expected at least two arguments\n" +msgstr "%ls: Förväntade minst två argument\n" + +#: builtin.c:2745 +#, c-format +msgid "%ls: '%ls' invalid variable name\n" +msgstr "%ls: '%ls' är ett ogiltigt variabelnamn\n" + +#: builtin.c:2753 +#, c-format +msgid "%ls: Second argument must be 'in'\n" +msgstr "%ls: Andra argumentet måste vara 'in'\n" + +#: builtin.c:2815 +#, c-format +msgid "%ls: Not inside of block\n" +msgstr "%ls: Inte i ett block\n" + +#: builtin.c:2939 +#, c-format +msgid "%ls: Not inside of 'if' block\n" +msgstr "%ls: Inte i ett 'if' block\n" + +#: builtin.c:2991 +#, c-format +msgid "%ls: Not inside of loop\n" +msgstr "%ls: Inte i en loop\n" + +#: builtin.c:3058 +#, c-format +msgid "%ls: Not inside of function\n" +msgstr "%ls: Inte i en funktion\n" + +#: builtin.c:3118 +#, c-format +msgid "%ls: 'case' command while not in switch block\n" +msgstr "%ls: 'case' kommandot kan bara användas i ett 'switch' block\n" + +#: builtin.c:3316 +#, c-format +msgid "Unknown builtin '%ls'" +msgstr "Okänt inbyggt kommando '%ls'" + +#: builtin.c:3338 +msgid "Temporarily block delivery of events" +msgstr "Blockera tillfälligt leverans av händelser" + +#: builtin.c:3339 +msgid "Run a builtin command" +msgstr "Utför ett inbyggt kommando" + +#: builtin.c:3340 +msgid "Edit command specific completions" +msgstr "Ändra kommando-specifika kompletteringar" + +#: builtin.c:3341 +msgid "Change working directory" +msgstr "Ändra nuvarande katalog" + +#: builtin.c:3342 +msgid "Exit the shell" +msgstr "Avsluta fish" + +#: builtin.c:3343 +msgid "Define a new function" +msgstr "Definera ny funktion" + +#: builtin.c:3344 +msgid "List or remove functions" +msgstr "Visa och ta bort funktioner" + +#: builtin.c:3345 +msgid "End a block of commands" +msgstr "Avsluta ett block av kommandon" + +#: builtin.c:3346 +msgid "Evaluate block if condition is false" +msgstr "Utför block om ett villkor är uppfyllt" + +#: builtin.c:3347 +msgid "Evaluate parameters as a command" +msgstr "Utför argument som kommandon" + +#: builtin.c:3348 +msgid "Perform a set of commands multiple times" +msgstr "Utför ett block flera gånger" + +#: builtin.c:3349 +msgid "Evaluate contents of file" +msgstr "Utför filinnehåll som kommandon" + +#: builtin.c:3350 +msgid "Handle environment variables" +msgstr "Redigera miljövariabler" + +#: builtin.c:3351 +msgid "Send job to foreground" +msgstr "Skick jobb till förgrunden" + +#: builtin.c:3352 +msgid "Send job to background" +msgstr "Skicka jobb till bakgrunden" + +#: builtin.c:3353 +msgid "Print currently running jobs" +msgstr "Skriv ut nuvarande jobb" + +#: builtin.c:3354 +msgid "Read a line of input into variables" +msgstr "Läs in en rad till en variabel" + +#: builtin.c:3355 +msgid "Stop the innermost loop" +msgstr "Avbryt den innersta loopen" + +#: builtin.c:3356 +msgid "Skip the rest of the current lap of the innermost loop" +msgstr "Avbryt nuvarande varv i den innersta loopen" + +#: builtin.c:3357 +msgid "Stop the innermost currently evaluated function" +msgstr "Avbryt den innersta utförda funktionen" + +#: builtin.c:3358 +msgid "Set the commandline" +msgstr "Sätt kommandoraden" + +#: builtin.c:3359 builtin.c:3360 +msgid "Conditionally execute a block of commands" +msgstr "Utför ett block av kommandon om ett villkor är uppfyllt" + +#: builtin.c:3361 +msgid "Run a program" +msgstr "Kör ett program" + +#: builtin.c:3362 +msgid "Conditionally execute a command" +msgstr "Utför ett kommando om ett villkor är uppfyllt" + +#: builtin.c:3363 +msgid "Perform a command multiple times" +msgstr "Utför ett kommando upprepade gånger" + +#: builtin.c:3364 +msgid "Handle key bindings" +msgstr "Hantera tangentbordsgenvägar för fish" + +#: builtin.c:3365 +msgid "Generate random number" +msgstr "Generera ett slumptal" + +#: builtin.c:3366 +msgid "Run command in current process" +msgstr "Kör ett kommando i den nuvarande processen" + +#: builtin.c:3367 +msgid "Negate exit status of job" +msgstr "Negera resultatet av ett kommando" + +#: builtin.c:3368 +msgid "Execute second command if first fails" +msgstr "Utför ett kommando om föregående kommando misslyckades" + +#: builtin.c:3369 +msgid "Execute second command if first suceeds" +msgstr "Utför ett kommando om föregående kommando lyckades" + +#: builtin.c:3370 +msgid "Create a block of code" +msgstr "Skape ett kodblock" + +#: builtin.c:3371 +msgid "Return status information about fish" +msgstr "Visa information om fish" + +#: builtin.c:3372 +msgid "Set or get the shells resurce usage limits" +msgstr "Visa eller redigera skalets resursanvändningsgränser" + +#: builtin_set.c:96 +#, fuzzy, c-format +msgid "%ls: Invalid index starting at '%ls'\n" +msgstr "%ls: Ogiltigt index vid '%ls'" + +#: builtin_set.c:488 +#, fuzzy, c-format +msgid "" +"%ls: Erase needs a variable name\n" +"%ls\n" +msgstr "%ls: Radering kräver ett variabelnamn\n%ls\n" + +#: builtin_set.c:525 +#, fuzzy, c-format +msgid "" +"%ls: Values cannot be specfied with erase\n" +"%ls\n" +msgstr "" +"%ls: Värden kan inte specificeras vid radering\n" +"%ls\n" + +#: complete.c:750 complete.c:769 +msgid "Unknown option: " +msgstr "Okänt argument: " + +#: complete.c:774 +msgid "Multiple matches for option: " +msgstr "Mer än ett argument passar: " + +#: complete.c:849 wildcard.c:276 +msgid "unknown" +msgstr "okänd" + +#: env.c:194 +msgid "Could not get user information" +msgstr "Kunde inte hitta information om användare" + +#: env.c:763 +#, c-format +msgid "No history at idx %d\n" +msgstr "Ingen historieinformation för index %d\n" + +#: env.c:923 +msgid "Tried to pop empty environment stack." +msgstr "Försökte ta bort element från tom variabelstack" + +#: event.c:490 +msgid "Signal list overflow. Signals have been ignored." +msgstr "Signallistan är full. Signaler har ignorerats." + +#: exec.c:52 +#, c-format +msgid "An error occurred while redirecting file descriptor %d" +msgstr "Ett fel inträffade vid IO dirigering av filidentifierare %d" + +#: exec.c:56 +#, c-format +msgid "An error occurred while redirecting file '%ls'" +msgstr "Ett fel inträffade vid IO dirigering av filen '%ls'" + +#: exec.c:60 +msgid "Could not create child process - exiting" +msgstr "Kunde inte skapa barnprocess - avslutar programmet" + +#: exec.c:425 +#, c-format +msgid "Failed to execute process '%ls'" +msgstr "Misslyckades med att exekvera processen '%ls'" + +#: exec.c:584 +#, c-format +msgid "Could not send process %d from group %d to group %d" +msgstr "Kunde inte skicka process %d från grupp %d till grupp %d" + +#: exec.c:596 exec.c:608 proc.c:854 proc.c:866 +#, c-format +msgid "Could not send job %d ('%ls') to foreground" +msgstr "Kunde inte skicka jobb %d ('%ls') till förgrunden" + +#: exec.c:770 +#, c-format +msgid "Unknown function '%ls'" +msgstr "Okänd funktion '%ls'" + +#: exec.c:878 +#, c-format +msgid "Unknown input redirection type %d" +msgstr "Okänd IO dirigering av typ %d" + +#: exec.c:1205 +#, c-format +msgid "Sent null command to subshell. This is a fish bug. If it can be reproduced, please send a bug report to %s." +msgstr "Skickade null-kommando till subskal. Detta är en fish-bug. Om du kan reproducera den, skicka en rapport till %s." + +#: input.c:406 +msgid "Invalid Control sequence" +msgstr "Ogiltig kontroll-sekvens" + +#: input.c:518 +#, c-format +msgid "Could not parse sequence '%ls'" +msgstr "Kunde inte tolka sekvens '%ls'" + +#: input.c:682 +msgid "Invalid sequence - no dash after control\n" +msgstr "Ogiltig sekvens - inget bindestreck efter 'kontroll'\n" + +#: input.c:700 +msgid "Invalid sequence - Control-nothing?\n" +msgstr "Ogiltig sekvens - Kontroll-ingenting?\n" + +#: input.c:715 +msgid "Invalid sequence - no dash after meta\n" +msgstr "Ogiltig sekvens - inget bindestreck efter 'meta'\n" + +#: input.c:720 +msgid "Invalid sequence - Meta-nothing?" +msgstr "Ogiltig sekvens - Meta-ingenting?" + +#: input.c:765 +#, c-format +msgid "Invalid sequence - '%ls' expanded to zero characters" +msgstr "Ogiltig sekvens - '%ls' expanderades till en tom sträng" + +#: input.c:829 +msgid "Mismatched $endif in inputrc file" +msgstr "$endif matchade inte i inputrc-fil" + +#: input.c:881 +msgid "Mismatched quote" +msgstr "Citat-tecknen matchar inte varandra" + +#: input.c:895 +msgid "Expected a ':'" +msgstr "Förväntade ett ':'" + +#: input.c:940 +#, c-format +msgid "I don't know what '%ls' means" +msgstr "Vet inte vad '%ls' betyder" + +#: input.c:944 +#, c-format +msgid "Expected end of line, got '%ls'" +msgstr "Förväntade radslut, fick '%ls'" + +#: input.c:949 +msgid "Syntax: set KEY VALUE" +msgstr "Syntax: set NAMN VÄRDE" + +#: input.c:1015 +msgid "Unable to parse binding" +msgstr "Kunde inte tolka tangentbordsgenväg" + +#: input.c:1041 +#, fuzzy, c-format +msgid "I don't know what %ls means" +msgstr "Vet inte vad '%ls' betyder" + +#: input.c:1067 +#, c-format +msgid "Error while reading input information from file '%ls'" +msgstr "Ett fel uppstod under inläsning av filen '%ls'" + +#: input.c:1294 +msgid "Could not set up terminal" +msgstr "Kunde inte initiera terminalen" + +#: io.c:73 +#, c-format +msgid "An error occured while reading output from code block on fd %d" +msgstr "Ett fel inträffade under inläsning från kodblock på filidentifierare %d" + +#: parser.c:60 +#, c-format +msgid "If this error can be reproduced, please send a bug report to %s." +msgstr "Om du kan reproducera detta fel, var vänlig skicka en buggrapport till %s" + +#: parser.c:65 +msgid "This command can not be used in a pipeline" +msgstr "Detta kommando kan ej användas i en pipeline" + +#: parser.c:71 +#, c-format +msgid "Tokenizer error: '%ls'" +msgstr "Följande fel inträffade vid symboluppdelning: '%ls'" + +#: parser.c:76 +msgid "Short circut command requires additional command" +msgstr "Kortslutningkommandon kräver två följande kommandon" + +#: parser.c:81 +msgid "Maximum recursion depth reached. Accidental infinite loop?" +msgstr "Maximalt rekursionsdjup uppnått. Oavsiktlig oändlig loop?" + +#: parser.c:86 +msgid "Could not locate end of block. The 'end' command is missing, misspelled or a preceding ';' is missing." +msgstr "Kunde inte hitta slutet på ett kodblock. Kommandot 'end' kan saknas, vara felstavat eller ett ';' kan saknas." + +#: parser.c:91 +msgid "Maximum number of nested blocks reached." +msgstr "Maximalt antal nästade block har uppnåtts." + +#: parser.c:96 +#, c-format +msgid "Expected a command string, got token of type '%ls'." +msgstr "Förväntade att hitta ett kommandonamn, hittade en symbol av typen '%ls'." + +#: parser.c:101 +#, c-format +msgid "Illegal command name '%ls'." +msgstr "Ogiltigt kommandonamn '%ls'." + +#: parser.c:106 +#, c-format +msgid "Warning: No match for wildcard '%ls'. The command will not be executed." +msgstr "Varning: Inga matchningar för wildcardet '%ls', kommandot kommer ej utföras." + +#: parser.c:111 +msgid "'case' builtin not inside of switch block" +msgstr "Det inbyggda kommandot 'case' får bara användas i ett 'switch'-block." + +#: parser.c:116 +msgid "Loop control command while not inside of loop" +msgstr "Loopstyrningskommandon får bara användas i loopar." + +#: parser.c:121 +msgid "'else' builtin not inside of if block" +msgstr "Det inbyggda kommandot 'else' får bara användas i ett if-block" + +#: parser.c:126 +msgid "'end' command outside of block" +msgstr "Det inbyggda kommandot 'end' får bara användas i ett block" + +#: parser.c:131 +#, c-format +msgid "Unknown command '%ls'. Did you mean 'set VARIABLE VALUE'? For information on setting variable values, see the manual section on the set command by typing 'help set'." +msgstr "Okänt kommando '%ls'. Menade du 'set VARIABEL VÄRDE'? För mer information om hur man tilldelar variabler värden, se manualsektionen om det inbyggda kommandot 'set' genom att skriva 'help set'." + +#: parser.c:136 +#, c-format +msgid "Expected redirection specification, got token of type '%ls'" +msgstr "Förväntade en IO dirigering, hittade en symbol av typen '%ls'" + +#: parser.c:141 +msgid "Encountered redirection when expecting a command name. Fish does not allow a redirection operation before a command." +msgstr "Förväntade ett kommandonamn, hittade en IO dirigering. Fish tillåter into IO dirigeringar före kommandonamn" + +#: parser.c:146 +msgid "Tried to evaluate null pointer." +msgstr "Försökte evaluera nollpekare." + +#: parser.c:151 +#, c-format +msgid "Tried to evaluate buffer using invalid block scope of type '%ls'." +msgstr "Försökte evaluera ett block av kommandon med ogiltig blocknivå '%ls'" + +#: parser.c:157 +#, c-format +msgid "Unexpected token of type '%ls'" +msgstr "Oväntad symbol av typ '%ls'" + +#: parser.c:162 +#, c-format +msgid "Error while searching for command '%ls'" +msgstr "Ett fel uppstod under sökning efter kommandot '%ls'" + +#: parser.c:168 +msgid "'while' block" +msgstr "'while' block" + +#: parser.c:174 +msgid "'for' block" +msgstr "'for' block" + +#: parser.c:180 +msgid "'if' conditional block" +msgstr "'if' villkorligt block" + +#: parser.c:186 +msgid "function definition block" +msgstr "funktionsdefinition-block" + +#: parser.c:192 +msgid "function invocation block" +msgstr "funktionsanropp-block" + +#: parser.c:198 +msgid "'switch' block" +msgstr "'switch' block" + +#: parser.c:204 +msgid "unexecutable block" +msgstr "oexekverbart block" + +#: parser.c:210 +msgid "global root block" +msgstr "globalt rot-block" + +#: parser.c:216 +msgid "command substitution block" +msgstr "kommandosubstitution-block" + +#: parser.c:222 +msgid "unconditional block" +msgstr "'begin' ovillkorligen exekverat block" + +#: parser.c:228 +msgid "'and' conditional block" +msgstr "'and' villkorligt block" + +#: parser.c:234 +msgid "'or' conditional block" +msgstr "'or' villkorligt block" + +#: parser.c:240 +msgid "unknown/invalid block" +msgstr "okänt/ogiltigt block" + +#: parser.c:892 +#, c-format +msgid "Could not write profiling information to file '%s'" +msgstr "Kunde inte skrive profileringsinformation till filen '%s'" + +#: parser.c:898 +msgid "Time\tSum\tCommand\n" +msgstr "Tid\tSumma\tKommando\n" + +#: parser.c:1048 +#, c-format +msgid "%ls (line %d): %n" +msgstr "%ls (rad %d): %n" + +#: parser.c:1234 +#, c-format +msgid "Could not expand string '%ls'" +msgstr "Kunde inte expandera strängen '%ls'" + +#: parser.c:1336 +msgid "Invalid IO redirection" +msgstr "Ogiltig IO omdirigering" + +#: parser.c:1379 +#, c-format +msgid "Requested redirection to something that is not a file descriptor %ls" +msgstr "IO omdirigering till någonting som inte är en filidentifierare" + +#: parser.c:1770 +#, c-format +msgid "Unknown command '%ls'" +msgstr "Okänt kommando '%ls'" + +#: parser.c:2195 +msgid "End of block mismatch. Program terminating." +msgstr "Blockslut matchar inte. Programmet avslutas." + +#: proc.c:143 +msgid "Job inconsistency" +msgstr "Jobb i ogiltigt tillstånd" + +#: proc.c:481 +#, c-format +msgid "\rJob %d, '%ls' has %ls" +msgstr "\rJobb %d, '%ls' har %ls" + +#: proc.c:557 +#, c-format +msgid "%ls: Job %d, '%ls' terminated by signal %ls (%ls)" +msgstr "%ls: Jobb %d, '%ls' avslutat av signal %ls (%ls)" + +#: proc.c:565 +#, c-format +msgid "%ls: Process %d, '%ls' from job %d, '%ls' terminated by signal %ls (%ls)" +msgstr "Process %d, '%ls', från jobb %d, '%ls' avslutat av signal %ls (%ls)" + +#: proc.c:596 +msgid "ended" +msgstr "avslutat" + +#: proc.c:811 +msgid "An error occured while reading output from code block" +msgstr "Ett fel inträffade medan utdata lästes från kodblock" + +#: proc.c:978 proc.c:988 proc.c:998 +msgid "Could not return shell to foreground" +msgstr "Kunde inte återställa skalet till förgrunden" + +#: proc.c:1021 +msgid "Job command" +msgstr "Jobb kommando" + +#: proc.c:1024 proc.c:1051 +msgid "Process list pointer" +msgstr "Processlistepekare" + +#: proc.c:1027 +msgid "Job list pointer" +msgstr "Joblistepekare" + +#: proc.c:1038 +#, c-format +msgid "More than one job in foreground: job 1: '%ls' job 2: '%ls'" +msgstr "Mer än ett jobb i förgrunden: job 1: '%ls', jobb 2 '%ls'" + +#: proc.c:1049 +msgid "Process argument list" +msgstr "Processargumentlista" + +#: proc.c:1050 +msgid "Process name" +msgstr "Processnamn" + +#: proc.c:1052 +msgid "Process command" +msgstr "Processkommando" + +#: proc.c:1057 +#, c-format +msgid "Job '%ls', process '%ls' has inconsistent state 'stopped'=%d" +msgstr "Jobb '%ls', process '%ls' har ogiltigt tillstånd 'stopped'=%d" + +#: proc.c:1067 +#, c-format +msgid "Job '%ls', process '%ls' has inconsistent state 'completed'=%d" +msgstr "Jobb '%ls', process '%ls' har ogiltigt tillstånd 'completed'=%d" + +#: reader.c:299 +msgid "Could not set terminal mode for new job" +msgstr "Kunde inte återställa terminalen för nytt jobb" + +#: reader.c:320 +msgid "Could not set terminal mode for shell" +msgstr "Kunde inte återställa terminalen till skalet" + +#: reader.c:1597 +msgid "Couldn't put the shell in its own process group" +msgstr "Kunde inte skicka skalet till sin egen processgrupp" + +#: reader.c:1607 +msgid "Couldn't grab control of terminal" +msgstr "Kunde inte ta kontroll över terminalen" + +#: reader.c:1639 +msgid "Could not set exit function" +msgstr "Kunde inte sätta avslutningsfunktionen" + +#: reader.c:2371 +msgid "Pop null reader block" +msgstr "Ta bort element från tomt läsarblock" + +#: reader.c:2513 +msgid "There are stopped jobs\n" +msgstr "Det finns bakgrundsjobb\n" + +#: reader.c:3029 +#, c-format +msgid "Unknown keybinding %d" +msgstr "Okänd tangentbordsbindning %d" + +#: reader.c:3099 +msgid "Error while reading commands" +msgstr "Ett fel inträffade medan kommandon lästes in" + +#: reader.c:3118 +msgid "Error while closing input" +msgstr "Ett fel inträffade medan indatafilen stängdes" + +#: reader.c:3146 +#, c-format +msgid "Could not convert input. Read %d bytes." +msgstr "Kunde inte konvertera indata. Läste %d bytes." + +#: reader.c:3152 +msgid "Could not read input stream" +msgstr "Kunde inte läsa från indataström" + +#: reader.c:3161 +msgid "Error while opening input" +msgstr "Ett fel inträffade medan indatafil öppnades" + +#: signal.c:55 +msgid "Terminal hung up" +msgstr "Terminalen bröt uppkopplingen" + +#: signal.c:61 +msgid "Quit request from job control (^C)" +msgstr "Avslutning via jobbkontroll (^C)" + +#: signal.c:67 +msgid "Quit request from job control with core dump (^\\)" +msgstr "Avslutning via jobbkontroll med minnesdump (^\\)" + +#: signal.c:73 +msgid "Illegal instruction" +msgstr "Ogiltig instruktion" + +#: signal.c:79 +msgid "Trace or breakpoint trap" +msgstr "Spårning eller brytpunkt utlöstes" + +#: signal.c:85 +msgid "Abort" +msgstr "Avbrott" + +#: signal.c:91 +msgid "Misaligned address error" +msgstr "Ogiltig minnesadress" + +#: signal.c:97 +msgid "Floating point exception" +msgstr "Flyttalsundantag" + +#: signal.c:103 +msgid "Forced quit" +msgstr "Tvingad avslutning" + +#: signal.c:109 +msgid "User defined signal 1" +msgstr "Användardefinerad signal 1" + +#: signal.c:114 +msgid "User defined signal 2" +msgstr "Användardefinerad signal 2" + +#: signal.c:120 +msgid "Address boundary error" +msgstr "Minnesadress korsar segmentgräns" + +#: signal.c:126 +msgid "Broken pipe" +msgstr "Avbruten pipe" + +#: signal.c:132 +msgid "Timer expired" +msgstr "Timer utlöstes" + +#: signal.c:138 +msgid "Polite quit request" +msgstr "Artig avslutning" + +#: signal.c:144 +msgid "Child process status changed" +msgstr "Barnprocess fick ändrad status" + +#: signal.c:150 +msgid "Continue previously stopped process" +msgstr "Fortsätt tidigare stannad process" + +#: signal.c:156 +msgid "Forced stop" +msgstr "Tvingad stopp" + +#: signal.c:162 +msgid "Stop request from job control (^Z)" +msgstr "Stopp från jobbkontroll (^Z)" + +#: signal.c:168 +msgid "Stop from terminal input" +msgstr "Stopp från terminalläsning" + +#: signal.c:174 +msgid "Stop from terminal output" +msgstr "Stopp från terminalskrivning" + +#: signal.c:180 +msgid "Urgent socket condition" +msgstr "Viktig socket-situation" + +#: signal.c:186 +msgid "CPU time limit exceeded" +msgstr "Slut på processortid" + +#: signal.c:192 +msgid "File size limit exceeded" +msgstr "Maximal filstorlek överskriden" + +#: signal.c:198 +msgid "Virtual timer expired" +msgstr "Virtuell timer utlöst" + +#: signal.c:204 +msgid "Profiling timer expired" +msgstr "Profileringstimer utlöst" + +#: signal.c:210 +msgid "Window size change" +msgstr "Terminalfönstret ändrade storlek" + +#: signal.c:216 +msgid "Asynchronous IO event" +msgstr "Asynkron IO händelse" + +#: signal.c:223 +msgid "Power failure" +msgstr "Strömavbrott" + +#: signal.c:230 +msgid "Bad system call" +msgstr "Ogiltigt systemanrop" + +#: tokenizer.c:28 +msgid "Unexpected end of token" +msgstr "Oväntat slut på symbol" + +#: tokenizer.c:32 +msgid "Parenthesis mismatch" +msgstr "Paranteser matcher inte varandra" + +#: tokenizer.c:36 +msgid "Invalid redirection" +msgstr "Ogiltig IO dirigering" + +#: tokenizer.c:40 +msgid "Invalid input" +msgstr "Ogiltiga indata" + +#: tokenizer.c:45 +msgid "Can not use fd 0 as pipe output" +msgstr "Kan inte skicka pipe-data till fileidentifierare 0" + +#: tokenizer.c:59 +msgid "Tokenizer not yet initialized" +msgstr "Symbolavdelaren inte initierad" + +#: tokenizer.c:60 +msgid "Tokenizer error" +msgstr "Symbolavdelarfel" + +#: tokenizer.c:61 +msgid "Invalid token" +msgstr "Ogiltig symbol" + +#: tokenizer.c:62 +msgid "String" +msgstr "Textsträng" + +#: tokenizer.c:63 +msgid "Pipe" +msgstr "Pipe" + +#: tokenizer.c:64 +msgid "End of command" +msgstr "Slut på kommando" + +#: tokenizer.c:65 +msgid "Redirect output to file" +msgstr "IO dirigering till fil" + +#: tokenizer.c:66 +msgid "Append output to file" +msgstr "IO dirigering till slutet av fil" + +#: tokenizer.c:67 +msgid "Redirect input to file" +msgstr "IO dirigering av indata till fil" + +#: tokenizer.c:68 +msgid "Redirect to file descriptor" +msgstr "IO dirigering till filidentifierare" + +#: tokenizer.c:69 +msgid "Run job in background" +msgstr "Kör jobb i bakgrunden" + +#: tokenizer.c:70 +msgid "Comment" +msgstr "Kommentar" + +#: wildcard.c:280 +msgid "empty" +msgstr "tom" + +#: builtin.h:23 +#, c-format +msgid "%ls: Expected argument\n" +msgstr "%ls: Förväntade argument\n" + +#: builtin.h:33 +#, c-format +msgid "" +"%ls: Invalid combination of options,\n" +"%ls\n" +msgstr "" +"%ls: Ogiltig kombination av argument,\n" +"%ls\n" + +#: builtin.h:38 +#, c-format +msgid "" +"%ls: Variable can only be one of universal, global and local\n" +"%ls\n" +msgstr "" +"%ls: Variabel kan bara vara en av universal, global och lokal\n" +"%ls\n" + +#: builtin.h:43 +#, c-format +msgid "" +"%ls: Variable can't be both exported and unexported\n" +"%ls\n" +msgstr "" +"%ls: Variabel kan inte vara både exporterad och oexporterad\n" +"%ls\n" + +#: builtin.h:48 +#, c-format +msgid "%ls: Unknown option '%ls'\n" +msgstr "%ls: Okänt argument '%ls'\n" + +#: builtin.h:50 +#, c-format +msgid "%ls: Invalid character '%lc' in variable name. Only alphanumerical characters and underscores are valid in a variable name.\n" +msgstr "%ls: Ogiltigt tecken '%lc' i variabelnamn. Bara alfanumeriska tecken och understreck är tillåtna i variabelnamn.\n" + +#: builtin.h:52 +#, c-format +msgid "%ls: Variable name can not be the empty string\n" +msgstr "%ls: Variabelnamn får inte vara tomma\n" + +#: exec.h:19 +msgid "An error occurred while setting up pipe" +msgstr "Ett fel inträffade under skapandet av en pipa" + +#~ msgid "Set or get the commandline" +#~ msgstr "Ändra eller visa kommandoraden" diff --git a/proc.c b/proc.c index dbd81a3b..2aa61e71 100644 --- a/proc.c +++ b/proc.c @@ -48,6 +48,7 @@ Some of the code in this file is based on code from the Glibc manual. #include "parser.h" #include "signal.h" #include "event.h" +#include "translate.h" /** Size of message buffer @@ -139,7 +140,7 @@ static int job_remove( job_t *j ) if( j != curr ) { - debug( 1, L"Job inconsistency" ); + debug( 1, _( L"Job inconsistency" ) ); sanity_lose(); return 0; } @@ -477,7 +478,7 @@ void job_handle_signal ( int signal, siginfo_t *info, void *con ) */ static void format_job_info( const job_t *j, const wchar_t *status ) { - fwprintf (stdout, L"\rJob %d, \'%ls\' has %ls", j->job_id, j->command, status); + fwprintf (stdout, _( L"\rJob %d, \'%ls\' has %ls" ), j->job_id, j->command, status); fflush( stdout ); tputs(clr_eol,1,&writeb); fwprintf (stdout, L"\n" ); @@ -553,14 +554,16 @@ int job_reap( int interactive ) { if( proc_is_job ) fwprintf( stdout, - L"fish: Job %d, \'%ls\' terminated by signal %ls (%ls)", + _( L"%ls: Job %d, \'%ls\' terminated by signal %ls (%ls)" ), + program_name, j->job_id, j->command, sig2wcs(WTERMSIG(p->status)), sig_description( WTERMSIG(p->status) ) ); else fwprintf( stdout, - L"fish: Process %d, \'%ls\' from job %d, \'%ls\' terminated by signal %ls (%ls)", + _( L"%ls: Process %d, \'%ls\' from job %d, \'%ls\' terminated by signal %ls (%ls)" ), + program_name, p->pid, p->argv[0], j->job_id, @@ -590,7 +593,7 @@ int job_reap( int interactive ) { if( !j->skip_notification ) { - format_job_info( j, L"ended" ); + format_job_info( j, _( L"ended" ) ); found=1; } } @@ -606,7 +609,7 @@ int job_reap( int interactive ) */ if( !j->skip_notification ) { - format_job_info( j, L"stopped" ); + format_job_info( j, _( L"stopped" ) ); found=1; } j->notified = 1; @@ -805,7 +808,7 @@ static void read_try( job_t *j ) if( errno != EAGAIN ) { debug( 1, - L"An error occured while reading output from code block" ); + _( L"An error occured while reading output from code block" ) ); wperror( L"read_try" ); } break; @@ -848,7 +851,7 @@ void job_continue (job_t *j, int cont) if( tcsetpgrp (0, j->pgid) ) { debug( 1, - L"Could not send job %d ('%ls') to foreground", + _( L"Could not send job %d ('%ls') to foreground" ), j->job_id, j->command ); wperror( L"tcsetpgrp" ); @@ -860,7 +863,7 @@ void job_continue (job_t *j, int cont) if( tcsetattr (0, TCSADRAIN, &j->tmodes)) { debug( 1, - L"Could not send job %d ('%ls') to foreground", + _( L"Could not send job %d ('%ls') to foreground" ), j->job_id, j->command ); wperror( L"tcsetattr" ); @@ -972,7 +975,7 @@ void job_continue (job_t *j, int cont) signal_block(); if( tcsetpgrp (0, getpid()) ) { - debug( 1, L"Could not return shell to foreground" ); + debug( 1, _( L"Could not return shell to foreground" ) ); wperror( L"tcsetpgrp" ); return; } @@ -982,7 +985,7 @@ void job_continue (job_t *j, int cont) */ if( tcgetattr (0, &j->tmodes) ) { - debug( 1, L"Could not return shell to foreground" ); + debug( 1, _( L"Could not return shell to foreground" ) ); wperror( L"tcgetattr" ); return; } @@ -992,7 +995,7 @@ void job_continue (job_t *j, int cont) */ if( tcsetattr (0, TCSADRAIN, &shell_modes)) { - debug( 1, L"Could not return shell to foreground" ); + debug( 1, _( L"Could not return shell to foreground" ) ); wperror( L"tcsetattr" ); return; } @@ -1015,17 +1018,15 @@ void proc_sanity_check() validate_pointer( j->command, - L"Job command", + _( L"Job command" ), 0 ); validate_pointer( j->first_process, - L"Process list pointer", + _( L"Process list pointer" ), 0 ); validate_pointer( j->next, - L"Job list pointer", + _( L"Job list pointer" ), 1 ); - validate_pointer( j->command, - L"Job command", - 0 ); + /* More than one foreground job? */ @@ -1034,8 +1035,7 @@ void proc_sanity_check() if( fg_job != 0 ) { debug( 0, - L"More than one job in foreground:\n" - L"job 1: %ls\njob 2: %ls", + _( L"More than one job in foreground: job 1: '%ls' job 2: '%ls'"), fg_job->command, j->command ); sanity_lose(); @@ -1046,16 +1046,15 @@ void proc_sanity_check() p = j->first_process; while( p ) { - validate_pointer( p->argv, L"Process argument list", 0 ); - validate_pointer( p->argv[0], L"Process name", 0 ); - validate_pointer( p->next, L"Process list pointer", 1 ); - validate_pointer( p->actual_cmd, L"Process command", 1 ); + validate_pointer( p->argv, _( L"Process argument list" ), 0 ); + validate_pointer( p->argv[0], _( L"Process name" ), 0 ); + validate_pointer( p->next, _( L"Process list pointer" ), 1 ); + validate_pointer( p->actual_cmd, _( L"Process command" ), 1 ); if ( (p->stopped & (~0x00000001)) != 0 ) { debug( 0, - L"Job %ls, process %ls " - L"has inconsistent state \'stopped\'=%d", + _( L"Job '%ls', process '%ls' has inconsistent state \'stopped\'=%d" ), j->command, p->argv[0], p->stopped ); @@ -1065,8 +1064,7 @@ void proc_sanity_check() if ( (p->completed & (~0x00000001)) != 0 ) { debug( 0, - L"Job %ls, process %ls " - L"has inconsistent state \'completed\'=%d", + _( L"Job '%ls', process '%ls' has inconsistent state \'completed\'=%d" ), j->command, p->argv[0], p->completed ); diff --git a/reader.c b/reader.c index 2cd274a1..4b45d920 100644 --- a/reader.c +++ b/reader.c @@ -74,6 +74,7 @@ commence. #include "function.h" #include "output.h" #include "signal.h" +#include "translate.h" /** Maximum length of prefix string when printing completion @@ -295,7 +296,7 @@ static void term_donate() { if( errno != EINTR ) { - debug( 1, L"Could not set terminal mode for new job" ); + debug( 1, _( L"Could not set terminal mode for new job" ) ); wperror( L"tcsetattr" ); break; } @@ -316,7 +317,7 @@ static void term_steal() { if( errno != EINTR ) { - debug( 1, L"Could not set terminal mode for shell" ); + debug( 1, _( L"Could not set terminal mode for shell" ) ); wperror( L"tcsetattr" ); break; } @@ -1593,7 +1594,7 @@ static void reader_interactive_init() if (setpgid (shell_pgid, shell_pgid) < 0) { debug( 1, - L"Couldn't put the shell in its own process group"); + _( L"Couldn't put the shell in its own process group" )); wperror( L"setpgid" ); exit (1); } @@ -1603,7 +1604,7 @@ static void reader_interactive_init() if( tcsetpgrp (STDIN_FILENO, shell_pgid) ) { debug( 1, - L"Couldn't grab control of terminal" ); + _( L"Couldn't grab control of terminal" ) ); wperror( L"tcsetpgrp" ); exit(1); } @@ -1635,7 +1636,7 @@ static void reader_interactive_init() original_pid = getpid(); if( atexit( &exit_func ) ) - debug( 1, L"Could not set exit function" ); + debug( 1, _( L"Could not set exit function" ) ); env_set( L"_", L"fish", ENV_GLOBAL ); } @@ -2367,7 +2368,7 @@ void reader_pop() if( data == 0 ) { - debug( 0, L"Pop null reader block" ); + debug( 0, _( L"Pop null reader block" ) ); sanity_lose(); return; } @@ -2509,7 +2510,7 @@ static int read_i() { if( !prev_end_loop && first_job != 0 ) { - writestr(L"There are stopped jobs\n"); + writestr(_( L"There are stopped jobs\n" )); write_prompt(); data->end_loop = 0; prev_end_loop=1; @@ -3025,7 +3026,7 @@ wchar_t *reader_readline() if( (!wchar_private(c)) && (c>31) && (c != 127) ) insert_char( c ); else - debug( 0, L"Unknown keybinding %d", c ); + debug( 0, _( L"Unknown keybinding %d" ), c ); break; } @@ -3095,7 +3096,7 @@ static int read_ni( int fd ) if( ferror( in_stream ) ) { debug( 1, - L"Error while reading commands" ); + _( L"Error while reading commands" ) ); /* Reset buffer. We won't evaluate incomplete files. @@ -3114,7 +3115,7 @@ static int read_ni( int fd ) if( fclose( in_stream )) { debug( 1, - L"Error while closing input" ); + _( L"Error while closing input" ) ); wperror( L"fclose" ); res = 1; } @@ -3142,13 +3143,13 @@ static int read_ni( int fd ) if( acc_used > 1 ) { debug( 1, - L"Could not convert input. Read %d bytes.", + _( L"Could not convert input. Read %d bytes." ), acc_used-1 ); } else { debug( 1, - L"Could not read input stream" ); + _( L"Could not read input stream" ) ); } res=1; } @@ -3157,7 +3158,7 @@ static int read_ni( int fd ) else { debug( 1, - L"Error while opening input" ); + _( L"Error while opening input" ) ); wperror( L"fdopen" ); free( buff ); res=1; diff --git a/signal.c b/signal.c index 3b544bf2..7532980e 100644 --- a/signal.c +++ b/signal.c @@ -21,6 +21,7 @@ The library for various signal related issues #include "event.h" #include "reader.h" #include "proc.h" +#include "translate.h" /** Struct describing an entry for the lookup table used to convert @@ -51,182 +52,182 @@ static struct lookup_entry lookup[] = { SIGHUP, L"SIGHUP", - L"Terminal hung up" + N_( L"Terminal hung up" ) } , { SIGINT, L"SIGINT", - L"Quit request from job control (^C)" + N_( L"Quit request from job control (^C)" ) } , { SIGQUIT, L"SIGQUIT", - L"Quit request from job control with core dump (^\\)" + N_( L"Quit request from job control with core dump (^\\)" ) } , { SIGILL, L"SIGILL", - L"Illegal instruction" + N_( L"Illegal instruction" ) } , { SIGTRAP, L"SIGTRAP", - L"Trace or breakpoint trap" + N_( L"Trace or breakpoint trap" ) } , { SIGABRT, L"SIGABRT", - L"Abort" + N_( L"Abort" ) } , { SIGBUS, L"SIGBUS", - L"Misaligned address error" + N_( L"Misaligned address error" ) } , { SIGFPE, L"SIGFPE", - L"Floating point exception" + N_( L"Floating point exception" ) } , { SIGKILL, L"SIGKILL", - L"Forced quit" + N_( L"Forced quit" ) } , { SIGUSR1, L"SIGUSR1", - L"User defined signal 1" + N_( L"User defined signal 1" ) } , { SIGUSR2, L"SIGUSR2", - L"User defined signal 2" + N_( L"User defined signal 2" ) } , { SIGSEGV, L"SIGSEGV", - L"Address boundary error" + N_( L"Address boundary error" ) } , { SIGPIPE, L"SIGPIPE", - L"Broken pipe" + N_( L"Broken pipe" ) } , { SIGALRM, L"SIGALRM", - L"Timer expired" + N_( L"Timer expired" ) } , { SIGTERM, L"SIGTERM", - L"Polite quit request" + N_( L"Polite quit request" ) } , { SIGCHLD, L"SIGCHLD", - L"Child process status changed" + N_( L"Child process status changed" ) } , { SIGCONT, L"SIGCONT", - L"Continue previously stopped process" + N_( L"Continue previously stopped process" ) } , { SIGSTOP, L"SIGSTOP", - L"Forced stop" + N_( L"Forced stop" ) } , { SIGTSTP, L"SIGTSTP", - L"Stop request from job control (^Z)" + N_( L"Stop request from job control (^Z)" ) } , { SIGTTIN, L"SIGTTIN", - L"Stop from terminal input" + N_( L"Stop from terminal input" ) } , { SIGTTOU, L"SIGTTOU", - L"Stop from terminal output" + N_( L"Stop from terminal output" ) } , { SIGURG, L"SIGURG", - L"Urgent socket condition" + N_( L"Urgent socket condition" ) } , { SIGXCPU, L"SIGXCPU", - L"CPU time limit exceeded" + N_( L"CPU time limit exceeded" ) } , { SIGXFSZ, L"SIGXFSZ", - L"File size limit exceeded" + N_( L"File size limit exceeded" ) } , { SIGVTALRM, L"SIGVTALRM", - L"Virtual timer expired" + N_( L"Virtual timer expired" ) } , { SIGPROF, L"SIGPROF", - L"Profiling timer expired" + N_( L"Profiling timer expired" ) } , { SIGWINCH, L"SIGWINCH", - L"Window size change" + N_( L"Window size change" ) } , { SIGIO, L"SIGIO", - L"Asynchronous IO event" + N_( L"Asynchronous IO event" ) } , #ifdef SIGPWR { SIGPWR, L"SIGPWR", - L"Power failure" + N_( L"Power failure" ) } , #endif { SIGSYS, L"SIGSYS", - L"Bad system call" + N_( L"Bad system call" ) } , { @@ -292,7 +293,7 @@ const wchar_t *sig_description( int sig ) { if( lookup[i].signal == sig ) { - return lookup[i].desc; + return _(lookup[i].desc); } } return L"Unknown"; diff --git a/tokenizer.c b/tokenizer.c index ef9b0566..fe4f78bf 100644 --- a/tokenizer.c +++ b/tokenizer.c @@ -20,64 +20,62 @@ #include "tokenizer.h" #include "common.h" #include "wildcard.h" +#include "translate.h" /** Error string for unexpected end of string */ -#define EOL_ERROR L"Unexpected end of token" +#define EOL_ERROR _( L"Unexpected end of token" ) /** Error string for mismatched parenthesis */ -#define PARAN_ERROR L"Parenthesis mismatch" +#define PARAN_ERROR _( L"Parenthesis mismatch" ) /** Error string for invalid redirections */ -#define REDIRECT_ERROR L"Invalid redirection" +#define REDIRECT_ERROR _( L"Invalid redirection" ) /** Error string for invalid input */ -#define INPUT_ERROR L"Invalid input" +#define INPUT_ERROR _( L"Invalid input" ) /** Error string for when trying to pipe from fd 0 */ -#define PIPE_ERROR L"Can not use fd 0 as pipe output" +#define PIPE_ERROR _( L"Can not use fd 0 as pipe output" ) /** Characters that separate tokens. They are ordered by frequency of occurrence to increase parsing speed. */ #define SEP L" \n|\t;#\r<>^&" -/** - Tests if the tokenizer buffer is large enough to hold contents of - the specified length, and if not, reallocates the tokenizer buffer. - - \return 0 if the system could not provide the memory needed, and 1 otherwise. -*/ /** Maximum length of a string containing a file descriptor number */ #define FD_STR_MAX_LEN 16 -const static wchar_t *tok_desc[] = +static const wchar_t *tok_desc[] = { - L"Tokenizer not yet initialized", - L"Tokenizer error", - L"Invalid token", - L"String", - L"Pipe", - L"End of command", - L"Redirect output to file", - L"Append output to file", - L"Redirect input to file", - L"Redirect to file descriptor", - L"Run job in background", - L"Comment" + N_(L"Tokenizer not yet initialized"), + N_( L"Tokenizer error" ), + N_( L"Invalid token" ), + N_( L"String" ), + N_( L"Pipe" ), + N_( L"End of command" ), + N_( L"Redirect output to file" ), + N_( L"Append output to file" ), + N_( L"Redirect input to file" ), + N_( L"Redirect to file descriptor" ), + N_( L"Run job in background" ), + N_( L"Comment" ) } -; + ; /** - Make sure the tokenizer buffer have room for a token of the specified size. + Tests if the tokenizer buffer is large enough to hold contents of + the specified length, and if not, reallocates the tokenizer buffer. + + \return 0 if the system could not provide the memory needed, and 1 otherwise. */ static int check_size( tokenizer *tok, size_t len ) { @@ -484,7 +482,8 @@ static int my_iswspace( wchar_t c ) const wchar_t *tok_get_desc( int type ) { - return tok_desc[type]; + + return _(tok_desc[type]); } diff --git a/translate.c b/translate.c new file mode 100644 index 00000000..4bf60a35 --- /dev/null +++ b/translate.c @@ -0,0 +1,78 @@ +/** \file translate.c + +Translation library, internally uses catgets + +*/ + +#include "config.h" + +#include +#include +#include + +#include "common.h" +#include "util.h" + +#if HAVE_GETTEXT + +#define BUFF_COUNT 64 + +static string_buffer_t buff[BUFF_COUNT]; +static int curr_buff=0; + +const wchar_t *wgettext( const wchar_t *in ) +{ + char *mbs_in = wcs2str( in ); + char *out = gettext( mbs_in ); + wchar_t *wres=0; + + sb_clear( &buff[curr_buff] ); + sb_printf( &buff[curr_buff], L"%s", out ); + wres = (wchar_t *)buff[curr_buff].buff; + curr_buff = (curr_buff+1)%BUFF_COUNT; + +/* + write( 2, res, strlen(res) ); +*/ +// debug( 1, L"%ls -> %s (%d) -> %ls (%d)\n", in, out, strlen(out) , wres, wcslen(wres) ); + + return wres; +} + + +void translate_init() +{ + int i; + + for(i=0; i