diff --git a/Makefile.in b/Makefile.in index fb4316e44..3fc2b4ba8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -229,9 +229,10 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr fi # Create a template translation object -messages.pot: *.c *.h +messages.pot: *.c *.h init/*.in init/*.fish if test $(HAVE_GETTEXT) = 1;then \ - xgettext -k_ -kN_ --no-wrap *.c *.h -o messages.pot; \ + xgettext -k_ -kN_ -kcomplete_desc --no-wrap *.c *.h -o messages.pot; \ + xgettext -j -k_ -LShell --no-wrap init/*.in init/*.fish -o messages.pot; \ fi # Generate the internal help functions by making doxygen create diff --git a/complete.c b/complete.c index af2a5f542..a959b353b 100644 --- a/complete.c +++ b/complete.c @@ -49,63 +49,63 @@ /** Description for ~USER completion */ -#define COMPLETE_USER_DESC COMPLETE_SEP_STR L"User home" +#define COMPLETE_USER_DESC _( L"User home" ) /** Description for short variables. The value is concatenated to this description */ -#define COMPLETE_VAR_DESC_VAL COMPLETE_SEP_STR L"Variable: " +#define COMPLETE_VAR_DESC_VAL _( L"Variable: " ) /** Description for generic executable */ -#define COMPLETE_EXEC_DESC COMPLETE_SEP_STR L"Executable" +#define COMPLETE_EXEC_DESC _( L"Executable" ) /** Description for link to executable */ -#define COMPLETE_EXEC_LINK_DESC COMPLETE_SEP_STR L"Executable link" +#define COMPLETE_EXEC_LINK_DESC _( L"Executable link" ) /** Description for regular file */ -#define COMPLETE_FILE_DESC COMPLETE_SEP_STR L"File" +#define COMPLETE_FILE_DESC _( L"File" ) /** Description for character device */ -#define COMPLETE_CHAR_DESC COMPLETE_SEP_STR L"Character device" +#define COMPLETE_CHAR_DESC _( L"Character device" ) /** Description for block device */ -#define COMPLETE_BLOCK_DESC COMPLETE_SEP_STR L"Block device" +#define COMPLETE_BLOCK_DESC _( L"Block device" ) /** Description for fifo buffer */ -#define COMPLETE_FIFO_DESC COMPLETE_SEP_STR L"Fifo" +#define COMPLETE_FIFO_DESC _( L"Fifo" ) /** Description for symlink */ -#define COMPLETE_SYMLINK_DESC COMPLETE_SEP_STR L"Symbolic link" +#define COMPLETE_SYMLINK_DESC _( L"Symbolic link" ) /** Description for Rotten symlink */ -#define COMPLETE_ROTTEN_SYMLINK_DESC COMPLETE_SEP_STR L"Rotten symbolic link" +#define COMPLETE_ROTTEN_SYMLINK_DESC _( L"Rotten symbolic link" ) /** Description for socket */ -#define COMPLETE_SOCKET_DESC COMPLETE_SEP_STR L"Socket" +#define COMPLETE_SOCKET_DESC _( L"Socket" ) /** Description for directory */ -#define COMPLETE_DIRECTORY_DESC COMPLETE_SEP_STR L"Directory" +#define COMPLETE_DIRECTORY_DESC _( L"Directory" ) /** Description for function */ -#define COMPLETE_FUNCTION_DESC COMPLETE_SEP_STR L"Function" +#define COMPLETE_FUNCTION_DESC _( L"Function" ) /** Description for builtin command */ -#define COMPLETE_BUILTIN_DESC COMPLETE_SEP_STR L"Builtin" +#define COMPLETE_BUILTIN_DESC _( L"Builtin" ) /** The command to run to get a description from a file suffix @@ -205,6 +205,9 @@ static hash_table_t *condition_cache=0; */ static hash_table_t *loaded_completions=0; +static string_buffer_t *get_desc_buff=0; + + void complete_init() { } @@ -425,9 +428,7 @@ void complete_add( const wchar_t *cmd, if( desc && wcslen( desc ) ) { - tmp = wcsdupcat( COMPLETE_SEP_STR, desc ); - opt->desc = intern( tmp ); - free( tmp ); + opt->desc = intern( desc ); } else opt->desc = L""; @@ -846,15 +847,15 @@ 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); + desc = wcsdup( ln); /* I have decided I prefer to have the description begin in uppercase and the whole universe will just have to accept it. Hah! */ - desc[1]=towupper(desc[1]); + desc[0]=towupper(desc[0]); } } @@ -881,43 +882,48 @@ static const wchar_t *complete_get_desc_suffix( const wchar_t *suff_orig ) const wchar_t *complete_get_desc( const wchar_t *filename ) { struct stat buf; - const wchar_t *desc = COMPLETE_FILE_DESC; - +// const wchar_t *desc = COMPLETE_FILE_DESC; + if( !get_desc_buff ) + { + get_desc_buff = malloc(sizeof(string_buffer_t) ); + sb_init( get_desc_buff ); + } + else + { + sb_clear( get_desc_buff ); + } if( lwstat( filename, &buf )==0) - { - if( waccess( filename, X_OK ) == 0 ) - { - desc = COMPLETE_EXEC_DESC; - } - + { if( S_ISCHR(buf.st_mode) ) - desc= COMPLETE_CHAR_DESC; + { + sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_CHAR_DESC ); + } else if( S_ISBLK(buf.st_mode) ) - desc = COMPLETE_BLOCK_DESC; + sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_BLOCK_DESC ); else if( S_ISFIFO(buf.st_mode) ) - desc = COMPLETE_FIFO_DESC; + sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_FIFO_DESC ); else if( S_ISLNK(buf.st_mode)) { struct stat buf2; - desc = COMPLETE_SYMLINK_DESC; - - if( waccess( filename, X_OK ) == 0 ) - desc = COMPLETE_EXEC_LINK_DESC; if( wstat( filename, &buf2 ) == 0 ) { if( S_ISDIR(buf2.st_mode) ) { - desc = L"/" COMPLETE_SYMLINK_DESC; + sb_printf( get_desc_buff, L"/%lc%ls", COMPLETE_SEP, COMPLETE_SYMLINK_DESC ); } + else if( waccess( filename, X_OK ) == 0 ) + sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_EXEC_LINK_DESC ); + else + sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_SYMLINK_DESC ); } else { switch( errno ) { case ENOENT: - desc = COMPLETE_ROTTEN_SYMLINK_DESC; + sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_ROTTEN_SYMLINK_DESC ); break; case EACCES: @@ -928,11 +934,17 @@ const wchar_t *complete_get_desc( const wchar_t *filename ) break; } } + } else if( S_ISSOCK(buf.st_mode)) - desc= COMPLETE_SOCKET_DESC; + sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_SOCKET_DESC ); else if( S_ISDIR(buf.st_mode) ) - desc= L"/" COMPLETE_DIRECTORY_DESC; + sb_printf( get_desc_buff, L"/%lc%ls", COMPLETE_SEP, COMPLETE_DIRECTORY_DESC ); + else if( waccess( filename, X_OK ) == 0 ) + { + sb_printf( get_desc_buff, L"%lc%ls", COMPLETE_SEP, COMPLETE_EXEC_DESC ); + } + } /* else { @@ -949,19 +961,27 @@ const wchar_t *complete_get_desc( const wchar_t *filename ) } } */ - if( desc == COMPLETE_FILE_DESC ) + if( wcslen((wchar_t *)get_desc_buff->buff) == 0 ) { wchar_t *suffix = wcsrchr( filename, L'.' ); if( suffix != 0 ) { if( !wcsrchr( suffix, L'/' ) ) { - desc = complete_get_desc_suffix( suffix ); + sb_printf( get_desc_buff, + L"%lc%ls", + COMPLETE_SEP, + complete_get_desc_suffix( suffix ) ); } } + else + sb_printf( get_desc_buff, + L"%lc%ls", + COMPLETE_SEP, + COMPLETE_FILE_DESC ); } - - return desc; + + return (wchar_t *)get_desc_buff->buff; } /** @@ -1007,6 +1027,7 @@ static void copy_strings_with_prefix( array_list_t *comp_out, wildcard_complete( next_str, wc, desc, desc_func, comp_out ); } + free( wc ); } @@ -1303,7 +1324,7 @@ static void complete_cmd( const wchar_t *cmd, { wchar_t *nxt = (wchar_t *)al_get( &tmp, i ); - wchar_t *desc = wcsrchr( nxt, COMPLETE_SEP ); + wchar_t *desc = wcsrchr( nxt, COMPLETE_SEP )+1; int is_valid = (desc && (wcscmp(desc, COMPLETE_DIRECTORY_DESC)==0)); if( is_valid ) @@ -1810,7 +1831,7 @@ static int complete_variable( const wchar_t *var, /* Variable description is 'Variable: VALUE */ - blarg = wcsdupcat2( &name[varlen], COMPLETE_VAR_DESC_VAL, value, 0 ); + blarg = wcsdupcat2( &name[varlen], COMPLETE_SEP_STR, COMPLETE_VAR_DESC_VAL, value, 0 ); if( blarg ) { @@ -1937,6 +1958,7 @@ static int try_complete_user( const wchar_t *cmd, { wchar_t *blarg = wcsdupcat2( &pw_name[name_len], L"/", + COMPLETE_SEP_STR, COMPLETE_USER_DESC, 0 ); if( blarg != 0 ) diff --git a/fish_pager.c b/fish_pager.c index e46744383..9131e7913 100644 --- a/fish_pager.c +++ b/fish_pager.c @@ -422,9 +422,10 @@ static void printed_length( wchar_t *str, case L'^': case L'<': case L'>': - case L'@': case L'(': case L')': + case L'[': + case L']': case L'{': case L'}': case L'?': @@ -432,6 +433,11 @@ static void printed_length( wchar_t *str, case L'|': case L';': case L':': + case L'\'': + case L'"': + case L'%': + case L'~': + if( has_description ) desc_len++; else diff --git a/init/fish_complete.fish.in b/init/fish_complete.fish.in index 989a126e7..c54794a05 100644 --- a/init/fish_complete.fish.in +++ b/init/fish_complete.fish.in @@ -65,7 +65,7 @@ end function __fish_complete_directory -d "Complete using directories" set -- comp $argv[1] - set -- desc Directory + set -- desc (_ Directory) if test (count $argv) -gt 1 set desc $argv[2] @@ -176,11 +176,14 @@ end # Completions for the shell and it's builtin commands and functions # +set -l __fish_help_desc (_ "Display help and exit") for i in (builtin -n|grep -vE '(while|for|if|function|switch)' ) - complete -c $i -s h -l help -d "Display help and exit" + + complete -c $i -s h -l help -d $__fish_help_desc end + function __fish_print_packages # apt-cache is much, much faster than rpm, and can do this in real @@ -191,13 +194,16 @@ function __fish_print_packages return end + #Get the word 'Package' in the current language + set -l package (_ Package) + if which apt-cache >/dev/null ^/dev/null # Apply the following filters to output of apt-cache: # 1) Remove package names with parentesis in them, since these seem to not correspond to actual packages as reported by rpm # 2) Remove package names that are .so files, since these seem to not correspond to actual packages as reported by rpm # 3) Remove path information such as /usr/bin/, as rpm packages do not have paths - apt-cache --no-generate pkgnames (commandline -tc)|grep -v \( |grep -v '\.so\(\.[0-9]\)*$'|sed -e 's/\/.*\///'|sed -e 's/$/\tPackage/' + apt-cache --no-generate pkgnames (commandline -tc)|grep -v \( |grep -v '\.so\(\.[0-9]\)*$'|sed -e 's/\/.*\///'|sed -e 's/$/\t'$package'/' return end @@ -219,7 +225,7 @@ function __fish_print_packages end # Remove package version information from output and pipe into cache file - rpm -qa >$cache_file |sed -e 's/-[^-]*-[^-]*$//' | sed -e 's/$/\tPackage/' & + rpm -qa >$cache_file |sed -e 's/-[^-]*-[^-]*$//' | sed -e 's/$/\t'$package'/' & end end @@ -235,12 +241,9 @@ end # Completions for SysV startup scripts # -set -g __fish_service_commands ' - start\t"Start service" - stop\t"Stop service" - status\t"Print service status" - restart\t"Stop and then start service" - reload\t"Reload service configuration" -' +complete -x -p "/etc/init.d/*" -a start\t(_ 'Start service') +complete -x -p "/etc/init.d/*" -a stop\t(_ 'Stop service') +complete -x -p "/etc/init.d/*" -a status\t(_ 'Print service status') +complete -x -p "/etc/init.d/*" -a restart\t(_ 'Stop and then start service') +complete -x -p "/etc/init.d/*" -a reload\t(_ 'Reload service configuration') -complete -x -p "/etc/init.d/*" -a '$__fish_service_commands' diff --git a/init/fish_function.fish b/init/fish_function.fish index 7b7232e24..5c1c51ff4 100644 --- a/init/fish_function.fish +++ b/init/fish_function.fish @@ -55,7 +55,7 @@ function contains -d "Test if a key is contained in a set of values" end if not set -q argv - echo "contains: Key not specified" + printf (_ "%s: Key not specified\n") contains return 1 end @@ -127,8 +127,8 @@ function help -d "Show help for the fish shell" end if test -z $fish_browser - printf "help: Could not find a web browser.\n" - printf "Please set the variable $BROWSER to a suitable browser and try again\n\n" + printf (_ '%s: Could not find a web browser.\n') help + printf (_ 'Please set the variable $BROWSER to a suitable browser and try again\n\n') return 1 end @@ -270,20 +270,11 @@ function vared -d "Edit variable value" else - printf "vared: %s is an array variable. Use " $argv - set_color $fish_color_command - printf vared - set_color $fish_color_normal - printf " %s[n] to edit the n:th element of %s\n" $argv $argv - + printf (_ 'vared: %s is an array variable. Use %svared%s %s[n] to edit the n:th element of %s\n') $argv (set_color $fish_color_command) (set_color $fish_color_normal) $argv $argv end end else - printf "vared: Expected exactly one argument, got %s.\n\nSynopsis:\n\t" (count $argv) - set_color $fish_color_command - printf vared - set_color $fish_color_normal - printf " VARIABLE\n" + printf (_ 'vared: Expected exactly one argument, got %s.\n\nSynopsis:\n\t%svared%s VARIABLE\n') (count $argv) (set_color $fish_color_command) (set_color $fish_color_normal) end end @@ -392,7 +383,7 @@ function __fish_move_last -d "Move the last element of a directory history from if test $size_src = 0 # Cannot make this step - echo "Hit end of history..." + printf (_ "Hit end of history...\n") return 1 end @@ -428,7 +419,7 @@ function prevd -d "Move back in the directory history" if test $argv[$i] -ge 0 ^/dev/null set times $argv[$i] else - echo "The number of positions to skip must be a non-negative integer" + printf (_ "The number of positions to skip must be a non-negative integer\n") return 1 end continue @@ -781,11 +772,11 @@ function type -d "Print the type of a command" set found 1 switch $mode case normal - echo $i is a function with definition + printf (_ '%s is a function with definition\n') $i functions $i case type - echo function + printf (_ function) case path echo @@ -801,10 +792,10 @@ function type -d "Print the type of a command" set found 1 switch $mode case normal - echo $i is a builtin + printf (_ '%s is a builtin\n') $i case type - echo builtin + printf (_ 'builtin\n') case path echo @@ -821,10 +812,10 @@ function type -d "Print the type of a command" set found 1 switch $mode case normal - echo $i is (which $i) + printf (_ '%s is %s\n') $i (which $i) case type - echo file + printf (_ file) case path which $i @@ -835,7 +826,7 @@ function type -d "Print the type of a command" end if test $found = 0 - echo type: $i: not found + printf (_ "%s: Could not find '%s'") type $i end end @@ -851,7 +842,7 @@ function __fish_umask_parse -d "Parses a file permission specification as into a else # Test if argument really is a valid symbolic mask if not echo $argv | grep -E '^(((u|g|o|a|)(=|\+|-)|)(r|w|x)*)(,(((u|g|o|a|)(=|\+|-)|)(r|w|x)*))*$' >/dev/null - echo umask: Invalid mask $argv >&2 + printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2 return 1 end @@ -1038,7 +1029,7 @@ function umask -d "Set default file permission mask" end case '*' - echo umask: Too may arguments >&2 + printf (_ '%s: Too many arguments\n') umask >&2 end @@ -1058,7 +1049,7 @@ function psub -d "Read from stdin into a file and output the filename. Remove th return 0 case '*' - echo psub: Unknown argument $argv[1] + printf (_ "%s: Unknown argument '%s'\n") psub $argv[1] return 1 end end diff --git a/init/fish_interactive.fish.in b/init/fish_interactive.fish.in index d41b66c46..42dbc39bf 100644 --- a/init/fish_interactive.fish.in +++ b/init/fish_interactive.fish.in @@ -6,26 +6,30 @@ if not status --is-interactive exit end +function _ -d "Alias for the gettext command" + gettext fish $argv +end + # # Print a greeting # -printf 'Welcome to fish, the friendly interactive shell\n' -printf 'Type %shelp%s for instructions on how to use fish\n' (set_color green) (set_color normal) +printf (_ 'Welcome to fish, the friendly interactive shell\n') +printf (_ 'Type %shelp%s for instructions on how to use fish\n') (set_color green) (set_color normal) # # Set exit message # -function fish_on_exit -d "Commands to execute when fish exits" --on-process %self - echo Good bye +function fish_on_exit -d (_ "Commands to execute when fish exits") --on-process %self + printf (_ "Good bye\n") end # Set the default prompt command. Make sure that every terminal escape # string has a newline before and after, so that fish will know how # long it is. -function fish_prompt -d "Write out the prompt" +function fish_prompt -d (_ "Write out the prompt") printf '%s@%s %s%s%s> \n' (whoami) (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) end diff --git a/po/sv.po b/po/sv.po index 862394f9c..6dcaf2d70 100644 --- a/po/sv.po +++ b/po/sv.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: fish 1.20.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-01-04 15:14+0100\n" +"POT-Creation-Date: 2006-01-05 14:39+0100\n" "Last-Translator: Axel Liljencrantz \n" "Language-Team: Swedish \n" "MIME-Version: 1.0\n" @@ -414,12 +414,12 @@ msgid "Set or get the shells resurce usage limits" msgstr "Visa eller redigera skalets resursanvändningsgränser" #: builtin_set.c:96 -#, fuzzy, c-format +#, c-format msgid "%ls: Invalid index starting at '%ls'\n" -msgstr "%ls: Ogiltigt index vid '%ls'" +msgstr "%ls: Ogiltigt index vid '%ls'\n" #: builtin_set.c:488 -#, fuzzy, c-format +#, c-format msgid "" "%ls: Erase needs a variable name\n" "%ls\n" @@ -428,7 +428,7 @@ msgstr "" "%ls\n" #: builtin_set.c:525 -#, fuzzy, c-format +#, c-format msgid "" "%ls: Values cannot be specfied with erase\n" "%ls\n" @@ -436,18 +436,70 @@ msgstr "" "%ls: Värden kan inte specificeras vid radering\n" "%ls\n" -#: complete.c:750 complete.c:769 +#: complete.c:52 +msgid "User home" +msgstr "Hemkatalog" + +#: complete.c:57 +msgid "Variable: " +msgstr "Variabel: " + +#: complete.c:62 +msgid "Executable" +msgstr "Program" + +#: complete.c:66 +msgid "Executable link" +msgstr "Länk till program" + +#: complete.c:71 +msgid "File" +msgstr "Fil" + +#: complete.c:75 +msgid "Character device" +msgstr "Teckenenhet" + +#: complete.c:79 +msgid "Block device" +msgstr "Blockenhet" + +#: complete.c:83 +msgid "Fifo" +msgstr "Fifo" + +#: complete.c:87 +msgid "Symbolic link" +msgstr "Symbolisk länk" + +#: complete.c:91 +msgid "Rotten symbolic link" +msgstr "Rutten symbolisk länk" + +#: complete.c:95 +msgid "Socket" +msgstr "Uttag (socket)" + +#: complete.c:99 init/fish_complete.fish.in:68 init/fish_complete.fish:68 +msgid "Directory" +msgstr "Katalog" + +#: complete.c:104 +msgid "Function" +msgstr "Funktion" + +#: complete.c:108 +msgid "Builtin" +msgstr "Inbyggt kommando" + +#: complete.c:751 complete.c:770 msgid "Unknown option: " msgstr "Okänt argument: " -#: complete.c:774 +#: complete.c:775 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" @@ -574,7 +626,7 @@ msgid "Unable to parse binding" msgstr "Kunde inte tolka tangentbordsgenväg" #: input.c:1041 -#, fuzzy, c-format +#, c-format msgid "I don't know what %ls means" msgstr "Vet inte vad '%ls' betyder" @@ -1087,6 +1139,10 @@ msgstr "Kör jobb i bakgrunden" msgid "Comment" msgstr "Kommentar" +#: wildcard.c:276 +msgid "unknown" +msgstr "okänd" + #: wildcard.c:280 msgid "empty" msgstr "tom" @@ -1141,3 +1197,128 @@ 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" + +#: init/fish_complete.fish.in:179 init/fish_complete.fish:179 +msgid "Display help and exit" +msgstr "Visa hjälp och avsluta" + +#: init/fish_complete.fish.in:198 init/fish_complete.fish:198 +msgid "Package" +msgstr "Paket" + +#: init/fish_complete.fish.in:244 init/fish_complete.fish:244 +msgid "Start service" +msgstr "Starta tjänst" + +#: init/fish_complete.fish.in:245 init/fish_complete.fish:245 +msgid "Stop service" +msgstr "Stanna tjänst" + +#: init/fish_complete.fish.in:246 init/fish_complete.fish:246 +msgid "Print service status" +msgstr "Visa status för tjänst" + +#: init/fish_complete.fish.in:247 init/fish_complete.fish:247 +msgid "Stop and then start service" +msgstr "Stanna och starta tjänst" + +#: init/fish_complete.fish.in:248 init/fish_complete.fish:248 +msgid "Reload service configuration" +msgstr "Ladda om konfiguration för tjänst" + +#: init/fish_interactive.fish.in:9 init/fish_interactive.fish:9 +msgid "-d" +msgstr "" + +#: init/fish_interactive.fish.in:10 init/fish_interactive.fish:10 +msgid "fish" +msgstr "" + +#: init/fish_interactive.fish.in:17 init/fish_interactive.fish:17 +msgid "Welcome to fish, the friendly interactive shell\\n" +msgstr "Välkommen till fish, det vänliga interaktiva skalet\\n" + +#: init/fish_interactive.fish.in:18 init/fish_interactive.fish:18 +msgid "Type %shelp%s for instructions on how to use fish\\n" +msgstr "Skriv %shelp%s för instruktioner om hur man använder fish\\n" + +#: init/fish_interactive.fish.in:24 init/fish_interactive.fish:24 +msgid "Commands to execute when fish exits" +msgstr "Kommandon som utförs när fish avslutas" + +#: init/fish_interactive.fish.in:25 init/fish_interactive.fish:25 +msgid "Good bye\\n" +msgstr "Hej då\\n" + +#: init/fish_interactive.fish.in:32 init/fish_interactive.fish:32 +msgid "Write out the prompt" +msgstr "Skriver ut prompten" + +#: init/fish_function.fish:58 +msgid "%s: Key not specified\\n" +msgstr "%s: Ingen nyckel specificerad" + +#: init/fish_function.fish:130 +msgid "%s: Could not find a web browser.\\n" +msgstr "%s: Kunde inte hitta en webbrowser\\n" + +#: init/fish_function.fish:131 +#, sh-format +msgid "Please set the variable $BROWSER to a suitable browser and try again\\n\\n" +msgstr "Var vänlig sätt variablen $BROWSER till en lämplig browser och försök igen\\n\\n" + +#: init/fish_function.fish:273 +msgid "vared: %s is an array variable. Use %svared%s %s[n] to edit the n:th element of %s\\n" +msgstr "vared: %s är en arrayvariabel. Använd %svared%s %s[n] för att redigera det n:te elementet av %s\\n" + +#: init/fish_function.fish:277 +msgid "vared: Expected exactly one argument, got %s.\\n\\nSynopsis:\\n\\t%svared%s VARIABLE\\n" +msgstr "vared: Förväntade exakt ett argument, fick %s\\n\\nSynopsis:\\n\\t%svared%s VARIABEL\\n" + +#: init/fish_function.fish:386 +msgid "Hit end of history...\\n" +msgstr "Inga fler kataloger..." + +#: init/fish_function.fish:422 +msgid "The number of positions to skip must be a non-negative integer\\n" +msgstr "Antalet positioner att hoppa över måste vara ett positivt heltal" + +#: init/fish_function.fish:775 +msgid "%s is a function with definition\\n" +msgstr "%s är en funktion med definitionen\\n" + +#: init/fish_function.fish:779 +msgid "function" +msgstr "funktion" + +#: init/fish_function.fish:795 +msgid "%s is a builtin\\n" +msgstr "%s är ett inbygggt kommando\\n" + +#: init/fish_function.fish:798 +msgid "builtin\\n" +msgstr "inbyggt kommando\\n" + +#: init/fish_function.fish:815 +msgid "%s is %s\\n" +msgstr "%s är %s\\n" + +#: init/fish_function.fish:818 +msgid "file" +msgstr "fil" + +#: init/fish_function.fish:829 +msgid "%s: Could not find '%s'" +msgstr "%s: Kunde inte hitta '%s'" + +#: init/fish_function.fish:845 +msgid "%s: Invalid mask '%s'\\n" +msgstr "%s: Ogiltigt mask '%s'\\n" + +#: init/fish_function.fish:1032 +msgid "%s: Too many arguments\\n" +msgstr "%s: För många argument\\n" + +#: init/fish_function.fish:1052 +msgid "%s: Unknown argument '%s'\\n" +msgstr "%s: Okänt argument '%s'\\n" diff --git a/translate.c b/translate.c index 4bf60a35a..b2b778ca7 100644 --- a/translate.c +++ b/translate.c @@ -20,13 +20,36 @@ Translation library, internally uses catgets static string_buffer_t buff[BUFF_COUNT]; static int curr_buff=0; +static char *wcs2str_buff=0; +static size_t wcs2str_buff_count=0; + +char *translate_wcs2str( const wchar_t *in ) +{ + size_t len = MAX_UTF8_BYTES*wcslen(in)+1; + if( len > wcs2str_buff_count ) + { + wcs2str_buff = realloc( wcs2str_buff, len ); + if( wcs2str_buff == 0 ) + { + die_mem(); + } + } + + wcstombs( wcs2str_buff, + in, + MAX_UTF8_BYTES*wcslen(in)+1 ); + + return wcs2str_buff; +} + const wchar_t *wgettext( const wchar_t *in ) { - char *mbs_in = wcs2str( in ); + char *mbs_in = translate_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; @@ -58,6 +81,8 @@ void translate_destroy() for(i=0; i1 ) - new = wcsdupcat( str, desc ); + if( desc && wcslen(desc) ) + new = wcsdupcat2( str, COMPLETE_SEP_STR, desc, (void *)0 ); else new = wcsdup( str ); }