<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 練習 6:Bash:語言設置,`LANG`,`locale`,`dpkg-reconfigure locales` > 原文:[Exercise 6. Bash: language settings, LANG, locale, dpkg-reconfigure locales](https://archive.fo/QgMfr) > 譯者:[飛龍](https://github.com/wizardforcel) > 協議:[CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/) > 自豪地采用[谷歌翻譯](https://translate.google.cn/) 在 Linux 中,語言選擇像導出變量一樣簡單。這是正確的,通過查看這個變量,程序決定如何和你交流。當然,為了使其工作,程序必須支持區域設置,并將其翻譯成可用和安裝的語言。讓我們通過安裝法語區域設置,看看它的工作原理。 現在,你將學習如何安裝和選擇一個區域設置。 ## 這樣做 ``` 1: echo $LANG 2: locale 3: man man # press q to exit man 4: sudo dpkg-reconfigure locales ``` 現在,選擇`fr_FR.UTF-8 locale`,通過使用方向鍵來瀏覽列表,并使用看空格來選擇區域設置。選擇`en_US.UTF-8`作為默認的系統區域。 ``` 5: export LANG=fr_FR.UTF-8 6: echo $LANG 7: locale # press q to exit man 8: man man 9: export LANG=en_US.UTF-8 ``` ## 你會看到什么 ``` user1@vm1:~$ echo $LANG en_US.UTF-8 user1@vm1:~$ locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= user1@vm1:~$ man man MAN(1) Manual pager utils MAN(1) NAME man - an interface to the on-line reference manuals user1@vm1:~$ sudo dpkg-reconfigure locales ---------------| Configuring locales |----------------------- | | | Locales are a framework to switch between multiple | | languages and allow users to use their language, | | country, characters, collation order, etc. | | | | Please choose which locales to generate. UTF-8 locales | | should be chosen by default, particularly for new | | installations. Other character sets may be useful for | | backwards compatibility with older systems and software. | | | | <Ok> | | | ------------------------------------------------------------- -----------| Configuring locales |-------- | Locales to be generated: | | | | [ ] fr_BE@euro ISO-8859-15 | | [ ] fr_CA ISO-8859-1 | | [ ] fr_CA.UTF-8 UTF-8 | | [ ] fr_CH ISO-8859-1 | | [ ] fr_CH.UTF-8 UTF-8 | | [*] fr_FR ISO-8859-1 | | [ ] fr_FR.UTF-8 UTF-8 | | [ ] fr_FR@euro ISO-8859-15 | | | | | | <Ok> <Cancel> | | | ------------------------------------------ ------------------ Configuring locales ---------------------- | | | Many packages in Debian use locales to display text in | | the correct language for the user. You can choose a | | default locale for the system from the generated | | locales. | | | | This will select the default language for the entire | | system. If this system is a multi-user system where not | | all users are able to speak the default language, they | | will experience difficulties. | | | | <Ok> | | | ------------------------------------------------------------- ------------ Configuring locales -------------- | Default locale for the system environment: | | | | None | | en_US.UTF-8 | | fr_FR.UTF-8 | | | | | | <Ok> <Cancel> | | | ----------------------------------------------- Generating locales (this might take a while)... en_US.UTF-8... done fr_FR.UTF-8... done Generation complete. user1@vm1:~$ export LANG=fr_FR.UTF-8 user1@vm1:~$ echo $LANG fr_FR.UTF-8 user1@vm1:~$ locale LANG=fr_FR.UTF-8 LANGUAGE=en_US:en LC_CTYPE="fr_FR.UTF-8" LC_NUMERIC="fr_FR.UTF-8" LC_TIME="fr_FR.UTF-8" LC_COLLATE="fr_FR.UTF-8" LC_MONETARY="fr_FR.UTF-8" LC_MESSAGES="fr_FR.UTF-8" LC_PAPER="fr_FR.UTF-8" LC_NAME="fr_FR.UTF-8" LC_ADDRESS="fr_FR.UTF-8" LC_TELEPHONE="fr_FR.UTF-8" LC_MEASUREMENT="fr_FR.UTF-8" LC_IDENTIFICATION="fr_FR.UTF-8" LC_ALL= user1@vm1:~$ man man MAN(1) Utilitaires de l'afficheur des pages de manuel MAN(1) NOM man - interface de consultation des manuels de référence en ligne user1@vm1:~$ export LANG=en_US.UTF-8 user1@vm1:~$ ``` ## 解釋 1. 打印你當前使用的`LANG`變量,程序用它來確定與你進行交互時要使用的語言。 2. 按照指定的國家/地區的格式,打印所有區域變量,程序員使用它們來設置數字,地址,電話格式,以及其它。 3. 顯示 unix 手冊系統的手冊頁。注意我如何使用`#`來注釋一個動作,`#`之后的所有內容都不執行。 4. 執行程序來重新配置你的區域設置。因為這個變化是系統層次的,你需要以 root 身份運行這個命令,這就是在`dpkg-reconfigure locales`前面有`sudo`的原因。現在不要糾結`sudo`,我會讓你熟悉它。 5. 導出`LANG`變量,用于設置所有其他區域變量。 6. 打印出`LANG`變量,你可以看到它已經改變了,按照你的預期。 7. 打印其它已更改的區域變量。 8. 以法語顯示`man`手冊頁。 9. 將`LANG變量恢復為英文。 ## 附加題 + 閱讀區域設置的手冊頁。為此,請輸入`man locale`。 + 現在,閱讀`man 7 locale`頁面。注意我 在這里使用`7`,來調用關于約定的手冊頁。如果你愿意, 現在閱讀`man man`,了解其他可能的代碼是什么,或者只是等待涵蓋它的練習。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看