mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 13:33:02 +08:00
4785440f65
* Add an "_" builtin to call into gettext We already have gettext in C++ (if available), so it seems weird to fork off a command to start it from script. This is only for fish's own translations. There's no way to call into other catalogs, it just translates all arguments separately. This is faster by a factor of ~1000, which allows us to call translations much more, especially from scripts. E.g. making fish_greeting global by default would hurt cost-wise, given that my fish starts up in 8ms and just calling the current `_` function takes 2ms, and that would have two calls. Incidentally, this also makes us rely on a weirdly defined function less, so it: Fixes #6804. * docs: Add `_` docs Let's see if that filename works out. * Reword _ docs
39 lines
640 B
ReStructuredText
39 lines
640 B
ReStructuredText
.. _cmd-_:
|
|
|
|
_ - call fish's translations
|
|
============================
|
|
|
|
Synopsis
|
|
--------
|
|
|
|
::
|
|
|
|
_ STRING...
|
|
|
|
Description
|
|
-----------
|
|
|
|
``_`` translates its arguments into the current language, if possible.
|
|
|
|
It is equivalent to ``gettext fish STRING``, meaning it can only be used to look up fish's own translations.
|
|
|
|
It requires fish to be built with gettext support. If that support is disabled, or there is no translation it will simply echo the argument back.
|
|
|
|
The language depends on the current locale, set with ``$LANG`` and ``$LC_MESSAGES``.
|
|
|
|
|
|
Options
|
|
-------
|
|
|
|
``_`` has no options.
|
|
|
|
Examples
|
|
--------
|
|
|
|
|
|
|
|
::
|
|
|
|
> _ File
|
|
Datei
|