Linux (Ubuntu) 上的手冊頁本地化

Linux (Ubuntu) 上的手冊頁本地化

是否可以選擇以不同語言輸出手冊頁?我不想完全改變電腦語言,而只想改變特定的手冊頁。例如

$ man -English man
Man is a manual program
$ man -Russian man
Инструцтия для Unix, BSD и Linux.

答案1

如果您man來自人資料庫軟體包(man 2.x,像大多數 GNU/Linux 發行版一樣),最快的方法是-L使用man.您只需要知道所需區域設定的縮寫。

man -Len man   # -> English man-page of man
man -Lru man   # -> Russian man-page of man

如果您使用其他人實施(man 1.x),唯一的方法是更改​​環境變數$LC_MESSAGES$LANG像其他所述答案

答案2

若要取得本地化的手冊頁,請設定LC_MESSAGES 語言環境環境變數。對於單次調用man

LC_MESSAGES=ru_RU man man

.bashrc如果您總是想要俄語手冊頁,但希望其他命令說英語,您可以在您的或其他 shell 初始化檔案中設定別名:

alias man='LC_MESSAGES=ru_RU man'

答案3

閱讀man man,看來您應該更改環境變量,然後像往常一樣使用 man 。如果它沒有您的語言版本,它仍會顯示英文版本。

   International support is available with this package.   Native  lan‐
   guage  manual pages are accessible (if available on your system) via
   use of locale functions.  To activate such support, it is  necessary
   to  set either $LC_MESSAGES, $LANG or another system dependent envi‐
   ronment variable to your language locale, usually specified  in  the
   POSIX 1003.1 based format:

   <language>[_<territory>[.<character-set>[,<version>]]]

   If  the  desired  page  is available in your locale, it will be dis‐
   played in lieu of the standard (usually American English) page.

相關內容