How to install locale only if that is not exist yet

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












I want to set a locale, but it failed.



$ sudo update-locale LANG=ja_JP.UTF-8
*** update-locale: Error: invalid locale settings: LANG=ja_JP.UTF-8


To use the locale I installed the locale by locale-gen



$ sudo locale-gen ja_JP.UTF-8
Generating locales (this might take a while)...
ja_JP.UTF-8... done
Generation complete.
$ sudo update-locale LANG=ja_JP.UTF-8
$


Now I want to write a shell script to configure it.
How can I know which locale is already installed so that I can avoid regenerate the locale?










share|improve this question

























    up vote
    0
    down vote

    favorite












    I want to set a locale, but it failed.



    $ sudo update-locale LANG=ja_JP.UTF-8
    *** update-locale: Error: invalid locale settings: LANG=ja_JP.UTF-8


    To use the locale I installed the locale by locale-gen



    $ sudo locale-gen ja_JP.UTF-8
    Generating locales (this might take a while)...
    ja_JP.UTF-8... done
    Generation complete.
    $ sudo update-locale LANG=ja_JP.UTF-8
    $


    Now I want to write a shell script to configure it.
    How can I know which locale is already installed so that I can avoid regenerate the locale?










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to set a locale, but it failed.



      $ sudo update-locale LANG=ja_JP.UTF-8
      *** update-locale: Error: invalid locale settings: LANG=ja_JP.UTF-8


      To use the locale I installed the locale by locale-gen



      $ sudo locale-gen ja_JP.UTF-8
      Generating locales (this might take a while)...
      ja_JP.UTF-8... done
      Generation complete.
      $ sudo update-locale LANG=ja_JP.UTF-8
      $


      Now I want to write a shell script to configure it.
      How can I know which locale is already installed so that I can avoid regenerate the locale?










      share|improve this question













      I want to set a locale, but it failed.



      $ sudo update-locale LANG=ja_JP.UTF-8
      *** update-locale: Error: invalid locale settings: LANG=ja_JP.UTF-8


      To use the locale I installed the locale by locale-gen



      $ sudo locale-gen ja_JP.UTF-8
      Generating locales (this might take a while)...
      ja_JP.UTF-8... done
      Generation complete.
      $ sudo update-locale LANG=ja_JP.UTF-8
      $


      Now I want to write a shell script to configure it.
      How can I know which locale is already installed so that I can avoid regenerate the locale?







      locale






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 13 mins ago









      ironsand

      3582418




      3582418




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I found a option -a that returns all locals in system.



          I could check the existence of the locale by this code.



          if [ `locale -a | grep -c ja_JP.utf` -ge 1 ]; then echo exist; else echo not exist; fi




          share




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1078040%2fhow-to-install-locale-only-if-that-is-not-exist-yet%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            I found a option -a that returns all locals in system.



            I could check the existence of the locale by this code.



            if [ `locale -a | grep -c ja_JP.utf` -ge 1 ]; then echo exist; else echo not exist; fi




            share
























              up vote
              0
              down vote













              I found a option -a that returns all locals in system.



              I could check the existence of the locale by this code.



              if [ `locale -a | grep -c ja_JP.utf` -ge 1 ]; then echo exist; else echo not exist; fi




              share






















                up vote
                0
                down vote










                up vote
                0
                down vote









                I found a option -a that returns all locals in system.



                I could check the existence of the locale by this code.



                if [ `locale -a | grep -c ja_JP.utf` -ge 1 ]; then echo exist; else echo not exist; fi




                share












                I found a option -a that returns all locals in system.



                I could check the existence of the locale by this code.



                if [ `locale -a | grep -c ja_JP.utf` -ge 1 ]; then echo exist; else echo not exist; fi





                share











                share


                share










                answered 1 min ago









                ironsand

                3582418




                3582418



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1078040%2fhow-to-install-locale-only-if-that-is-not-exist-yet%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491