mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-27 06:31:19 -03:00
The overwhelming majority of localizable messages comes from
completions:
$ ls share/completions/ | wc -l
$ 1048
OTOH functions also contribute a small amount, mostly via their
descriptions (so usually just one per file).
$ ls share/functions/ | wc -l
$ 237
Most of these are private and almost never shown to the user, so it's
not worth bothering translators with them. So:
- Skip private (see the parent commit) and deprecated functions.
- Skip wrapper functions like grep (where the translation seems to
be provided by apropos), and even the English description is not
helpful.
- Assume that most real systems have "seq", "realpath" etc.,
so it's no use providing our own translations for our fallbacks.
- Mark fish's own functions as tier1, and some barely-used functiosn
and completions as tier3, so we can order them that way in
po/*.po. Most translators should only look at tier1 and tier2.
In future we could disable localization for tier3.
See the explanation at the bottom of
tests/checks/message-localization-tier-is-declared.fish
Part of #11833
62 lines
2.0 KiB
Fish
62 lines
2.0 KiB
Fish
# localization: skip(uses-apropos)
|
|
|
|
# Provide a minimalist realpath implementation to help deal with platforms that may not provide it
|
|
# as a command. If an external realpath or grealpath command is available simply pass all arguments
|
|
# thru to it. If not fallback to our builtin.
|
|
|
|
# The following is slightly subtle. We have to define a realpath function even if there is an
|
|
# external command by that name. That's because if we don't the parser will select our builtin.
|
|
# However, we only want our builtin if there is no external realpath command.
|
|
|
|
if command -sq realpath
|
|
function realpath
|
|
command realpath $argv
|
|
end
|
|
exit 0
|
|
end
|
|
|
|
# If there is a HomeBrew installed version of GNU realpath named grealpath use that.
|
|
if command -sq grealpath
|
|
function realpath
|
|
command grealpath $argv
|
|
end
|
|
exit 0
|
|
end
|
|
|
|
function realpath -d "return an absolute path without symlinks"
|
|
set -l options h/help q/quiet V-version s/no-symlinks N-strip z/zero
|
|
set -a options e/canonicalize-existing m/canonicalize-missing L/logical P/physical
|
|
set -a options 'R-relative-to=' 'B-relative-base='
|
|
argparse -n realpath $options -- $argv
|
|
or return
|
|
|
|
if set -q _flag_help
|
|
__fish_print_help realpath
|
|
return 0
|
|
end
|
|
|
|
set -l supported_flags
|
|
if set -el _flag_no_symlinks
|
|
set -el _flag_s
|
|
set -a supported_flags --no-symlinks
|
|
end
|
|
|
|
# We don't implement any of the other flags so if any are set it's an error.
|
|
if string match -q '_flag_*' -- (set -l)
|
|
set -l flags (set -l | string replace --filter --regex '_flag_\w+\s*' '' | sort -u)
|
|
printf "realpath: These flags are not allowed by fish realpath: '%s'" "$flags" >&2
|
|
echo >&2
|
|
__fish_print_help realpath
|
|
return 1
|
|
end
|
|
|
|
if not set -q argv[1]
|
|
printf "realpath: Expected at least %d args, got only %d\n" 1 0 >&2
|
|
return 1
|
|
end
|
|
|
|
for path in $argv
|
|
builtin realpath $supported_flags $path
|
|
end
|
|
end
|