File: _.rst

package info (click to toggle)
fish 4.2.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 35,980 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (50 lines) | stat: -rw-r--r-- 1,658 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
_ - call fish's translations
============================

Synopsis
--------

.. synopsis::

    _ STRING

Description
-----------

``_`` translates its arguments into the current language, if possible.

This only works with messages which are translated as part of fish's own sources, so using it as part of your own fish scripts which are not upstreamed into the fish repo will not work unless the exact same message also exists upstream.

It requires fish to be built with gettext support. If that support is disabled or there is no translation it will echo the argument back.

The language depends on the current locale, set with :envvar:`LANG`, :envvar:`LC_MESSAGES`, :envvar:`LC_ALL`, and :envvar:`LANGUAGE`.
These variables do not have to be exported for fish to use them, and fish's variable scopes are supported.
If other programs launched via fish should respect these locale variables they have to be exported to make them available outside of fish.

For :envvar:`LANGUAGE` you can use a list, or use colons to separate multiple languages.

Options
-------

``_`` takes no options.

Examples
--------

Use German translations::

    > set LANG de_DE.UTF-8
    > _ file
    Datei

Specify a precedence of languages (only works with :envvar:`LANGUAGE`)::

    > set LANGUAGE pt de
    > _ file  # This message has a Portuguese translation.
    arquivo
    > _ "Invalid arguments"  # This message does not have a Portuguese translation, but a German one.
    Ungültige Argumente
    > _ untranslatable  # No translation in Portuguese, nor in German.
    untranslatable

Note that the specific examples may change if translations are added/modified.