cakephp i18n shell not extracting validation msgs










2















I'm trying to generate the pot files from my site with cake's i18n shell useing cake 2.3. As mentioned in the cake docs the shell should automatically extract the validation msgs. However, none of the validation strings turn up in my pot files.



My validation array simply looks like (also note the validationDomain):



public $validationDomain = 'validation_errors';

public $validate = array(
'currency' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Select a currency'
),
),
'title' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Fill out a title'
),
)

... etc
)


What am i not seeing here?!



Thanks allot!










share|improve this question
























  • Providing the full cake i18n extract shell command would be helpful.

    – desolat
    Jul 21 '17 at 8:32















2















I'm trying to generate the pot files from my site with cake's i18n shell useing cake 2.3. As mentioned in the cake docs the shell should automatically extract the validation msgs. However, none of the validation strings turn up in my pot files.



My validation array simply looks like (also note the validationDomain):



public $validationDomain = 'validation_errors';

public $validate = array(
'currency' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Select a currency'
),
),
'title' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Fill out a title'
),
)

... etc
)


What am i not seeing here?!



Thanks allot!










share|improve this question
























  • Providing the full cake i18n extract shell command would be helpful.

    – desolat
    Jul 21 '17 at 8:32













2












2








2








I'm trying to generate the pot files from my site with cake's i18n shell useing cake 2.3. As mentioned in the cake docs the shell should automatically extract the validation msgs. However, none of the validation strings turn up in my pot files.



My validation array simply looks like (also note the validationDomain):



public $validationDomain = 'validation_errors';

public $validate = array(
'currency' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Select a currency'
),
),
'title' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Fill out a title'
),
)

... etc
)


What am i not seeing here?!



Thanks allot!










share|improve this question
















I'm trying to generate the pot files from my site with cake's i18n shell useing cake 2.3. As mentioned in the cake docs the shell should automatically extract the validation msgs. However, none of the validation strings turn up in my pot files.



My validation array simply looks like (also note the validationDomain):



public $validationDomain = 'validation_errors';

public $validate = array(
'currency' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Select a currency'
),
),
'title' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Fill out a title'
),
)

... etc
)


What am i not seeing here?!



Thanks allot!







shell validation cakephp cakephp-2.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 29 '18 at 9:08









Álvaro González

107k30188279




107k30188279










asked Sep 17 '13 at 9:13









john23klippjohn23klipp

30127




30127












  • Providing the full cake i18n extract shell command would be helpful.

    – desolat
    Jul 21 '17 at 8:32

















  • Providing the full cake i18n extract shell command would be helpful.

    – desolat
    Jul 21 '17 at 8:32
















Providing the full cake i18n extract shell command would be helpful.

– desolat
Jul 21 '17 at 8:32





Providing the full cake i18n extract shell command would be helpful.

– desolat
Jul 21 '17 at 8:32












5 Answers
5






active

oldest

votes


















1














use this in app not in /app/Console



cake.bat i18n extract





share|improve this answer






























    1














    The full explanation is, that the _isExtractingApp() function of the extract task checks for identity between the app path in the --paths command line option and the APP constant in your app. If you are off by a trailing slash the validation error message extraction will be silently disabled.



    This commit introduced the problem when adding plugin handling to the extract task.



    As a workaround check your --paths option against the APP constant.






    share|improve this answer























    • This is still broken as of 2.10.13. It'd be cool if you could elaborate on the workaround. I can't figure out what to feed --paths with: . doesn't work and a full path like C:ProjectsFoo appears to totally break the command.

      – Álvaro González
      Oct 29 '18 at 9:12


















    0














    For generating validation messages in pot files, you can use the command like this



    ./Console/cake i18n extract --validation-domain validation_errors


    you can also refer the documentation here.






    share|improve this answer























    • Thanks for your reply! I've seen that line in the docs however that does not seem to make any difference. Due to server environment settings i am forced to use the i18n shell trough the cake i18n command (instead of ./Console/cake etc.) Would that make a difference?

      – john23klipp
      Sep 17 '13 at 10:12












    • I'm not familiar with the server environment settings etc.., But I've tried the above command for only translation of validation messages, by using ./Console/cake i18n extract this, I18n didn't give me any strings into my validation_messages.pot file.

      – Anil kumar
      Sep 17 '13 at 10:40












    • Thing is im really going with the i18n shell. This offers only 4 options: [E]xtract, [I]nitialize [H]elp and [Q]uit. So this means i cant add extra params to the extract command. That would be strange though (not being able to extract validations msgs through the actuall shell...)

      – john23klipp
      Sep 17 '13 at 12:53











    • According to docs this should only change the name of the resulting files from default.* to validation_errors.*. In practice this doesn't seem to enable or disable validation extraction.

      – Álvaro González
      Oct 29 '18 at 9:14


















    0














    Figured it out.
    Apparently the i18n shell does not work when targeting a particular folder. My validation messages were only extracted when running the shell on the whole app folder.



    Hope this helps.






    share|improve this answer






























      0














      As desolat's answer points out there's a bug in ExtractTask::_isExtractingApp() that's still present in latest version of the 2.x branch (CakePHP/2.10.13). The method compares paths without prior normalisation thus is fragile and breaks in some scenarios.



      In my case it was failing because of relative paths:



      Consolecake i18n extract --quiet --paths .


      For whatever the reason, it only works for me when I use an absolute path with a duplicate trailing slash:



      Consolecake i18n extract --quiet --paths "C:ProjectsProject Namesrc\"


      A hard-coded path wasn't an option because my script is meant to be shared so I used a shell variable. My shell is CMD because I run the script through Composer on Windows:



      Consolecake i18n extract --quiet --paths "%CD%\"





      share|improve this answer
























        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        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',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18845770%2fcakephp-i18n-shell-not-extracting-validation-msgs%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        use this in app not in /app/Console



        cake.bat i18n extract





        share|improve this answer



























          1














          use this in app not in /app/Console



          cake.bat i18n extract





          share|improve this answer

























            1












            1








            1







            use this in app not in /app/Console



            cake.bat i18n extract





            share|improve this answer













            use this in app not in /app/Console



            cake.bat i18n extract






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 8 '14 at 1:13









            RyodoRyodo

            395517




            395517























                1














                The full explanation is, that the _isExtractingApp() function of the extract task checks for identity between the app path in the --paths command line option and the APP constant in your app. If you are off by a trailing slash the validation error message extraction will be silently disabled.



                This commit introduced the problem when adding plugin handling to the extract task.



                As a workaround check your --paths option against the APP constant.






                share|improve this answer























                • This is still broken as of 2.10.13. It'd be cool if you could elaborate on the workaround. I can't figure out what to feed --paths with: . doesn't work and a full path like C:ProjectsFoo appears to totally break the command.

                  – Álvaro González
                  Oct 29 '18 at 9:12















                1














                The full explanation is, that the _isExtractingApp() function of the extract task checks for identity between the app path in the --paths command line option and the APP constant in your app. If you are off by a trailing slash the validation error message extraction will be silently disabled.



                This commit introduced the problem when adding plugin handling to the extract task.



                As a workaround check your --paths option against the APP constant.






                share|improve this answer























                • This is still broken as of 2.10.13. It'd be cool if you could elaborate on the workaround. I can't figure out what to feed --paths with: . doesn't work and a full path like C:ProjectsFoo appears to totally break the command.

                  – Álvaro González
                  Oct 29 '18 at 9:12













                1












                1








                1







                The full explanation is, that the _isExtractingApp() function of the extract task checks for identity between the app path in the --paths command line option and the APP constant in your app. If you are off by a trailing slash the validation error message extraction will be silently disabled.



                This commit introduced the problem when adding plugin handling to the extract task.



                As a workaround check your --paths option against the APP constant.






                share|improve this answer













                The full explanation is, that the _isExtractingApp() function of the extract task checks for identity between the app path in the --paths command line option and the APP constant in your app. If you are off by a trailing slash the validation error message extraction will be silently disabled.



                This commit introduced the problem when adding plugin handling to the extract task.



                As a workaround check your --paths option against the APP constant.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 21 '17 at 8:30









                desolatdesolat

                2,12962843




                2,12962843












                • This is still broken as of 2.10.13. It'd be cool if you could elaborate on the workaround. I can't figure out what to feed --paths with: . doesn't work and a full path like C:ProjectsFoo appears to totally break the command.

                  – Álvaro González
                  Oct 29 '18 at 9:12

















                • This is still broken as of 2.10.13. It'd be cool if you could elaborate on the workaround. I can't figure out what to feed --paths with: . doesn't work and a full path like C:ProjectsFoo appears to totally break the command.

                  – Álvaro González
                  Oct 29 '18 at 9:12
















                This is still broken as of 2.10.13. It'd be cool if you could elaborate on the workaround. I can't figure out what to feed --paths with: . doesn't work and a full path like C:ProjectsFoo appears to totally break the command.

                – Álvaro González
                Oct 29 '18 at 9:12





                This is still broken as of 2.10.13. It'd be cool if you could elaborate on the workaround. I can't figure out what to feed --paths with: . doesn't work and a full path like C:ProjectsFoo appears to totally break the command.

                – Álvaro González
                Oct 29 '18 at 9:12











                0














                For generating validation messages in pot files, you can use the command like this



                ./Console/cake i18n extract --validation-domain validation_errors


                you can also refer the documentation here.






                share|improve this answer























                • Thanks for your reply! I've seen that line in the docs however that does not seem to make any difference. Due to server environment settings i am forced to use the i18n shell trough the cake i18n command (instead of ./Console/cake etc.) Would that make a difference?

                  – john23klipp
                  Sep 17 '13 at 10:12












                • I'm not familiar with the server environment settings etc.., But I've tried the above command for only translation of validation messages, by using ./Console/cake i18n extract this, I18n didn't give me any strings into my validation_messages.pot file.

                  – Anil kumar
                  Sep 17 '13 at 10:40












                • Thing is im really going with the i18n shell. This offers only 4 options: [E]xtract, [I]nitialize [H]elp and [Q]uit. So this means i cant add extra params to the extract command. That would be strange though (not being able to extract validations msgs through the actuall shell...)

                  – john23klipp
                  Sep 17 '13 at 12:53











                • According to docs this should only change the name of the resulting files from default.* to validation_errors.*. In practice this doesn't seem to enable or disable validation extraction.

                  – Álvaro González
                  Oct 29 '18 at 9:14















                0














                For generating validation messages in pot files, you can use the command like this



                ./Console/cake i18n extract --validation-domain validation_errors


                you can also refer the documentation here.






                share|improve this answer























                • Thanks for your reply! I've seen that line in the docs however that does not seem to make any difference. Due to server environment settings i am forced to use the i18n shell trough the cake i18n command (instead of ./Console/cake etc.) Would that make a difference?

                  – john23klipp
                  Sep 17 '13 at 10:12












                • I'm not familiar with the server environment settings etc.., But I've tried the above command for only translation of validation messages, by using ./Console/cake i18n extract this, I18n didn't give me any strings into my validation_messages.pot file.

                  – Anil kumar
                  Sep 17 '13 at 10:40












                • Thing is im really going with the i18n shell. This offers only 4 options: [E]xtract, [I]nitialize [H]elp and [Q]uit. So this means i cant add extra params to the extract command. That would be strange though (not being able to extract validations msgs through the actuall shell...)

                  – john23klipp
                  Sep 17 '13 at 12:53











                • According to docs this should only change the name of the resulting files from default.* to validation_errors.*. In practice this doesn't seem to enable or disable validation extraction.

                  – Álvaro González
                  Oct 29 '18 at 9:14













                0












                0








                0







                For generating validation messages in pot files, you can use the command like this



                ./Console/cake i18n extract --validation-domain validation_errors


                you can also refer the documentation here.






                share|improve this answer













                For generating validation messages in pot files, you can use the command like this



                ./Console/cake i18n extract --validation-domain validation_errors


                you can also refer the documentation here.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 17 '13 at 10:03









                Anil kumarAnil kumar

                3,65011430




                3,65011430












                • Thanks for your reply! I've seen that line in the docs however that does not seem to make any difference. Due to server environment settings i am forced to use the i18n shell trough the cake i18n command (instead of ./Console/cake etc.) Would that make a difference?

                  – john23klipp
                  Sep 17 '13 at 10:12












                • I'm not familiar with the server environment settings etc.., But I've tried the above command for only translation of validation messages, by using ./Console/cake i18n extract this, I18n didn't give me any strings into my validation_messages.pot file.

                  – Anil kumar
                  Sep 17 '13 at 10:40












                • Thing is im really going with the i18n shell. This offers only 4 options: [E]xtract, [I]nitialize [H]elp and [Q]uit. So this means i cant add extra params to the extract command. That would be strange though (not being able to extract validations msgs through the actuall shell...)

                  – john23klipp
                  Sep 17 '13 at 12:53











                • According to docs this should only change the name of the resulting files from default.* to validation_errors.*. In practice this doesn't seem to enable or disable validation extraction.

                  – Álvaro González
                  Oct 29 '18 at 9:14

















                • Thanks for your reply! I've seen that line in the docs however that does not seem to make any difference. Due to server environment settings i am forced to use the i18n shell trough the cake i18n command (instead of ./Console/cake etc.) Would that make a difference?

                  – john23klipp
                  Sep 17 '13 at 10:12












                • I'm not familiar with the server environment settings etc.., But I've tried the above command for only translation of validation messages, by using ./Console/cake i18n extract this, I18n didn't give me any strings into my validation_messages.pot file.

                  – Anil kumar
                  Sep 17 '13 at 10:40












                • Thing is im really going with the i18n shell. This offers only 4 options: [E]xtract, [I]nitialize [H]elp and [Q]uit. So this means i cant add extra params to the extract command. That would be strange though (not being able to extract validations msgs through the actuall shell...)

                  – john23klipp
                  Sep 17 '13 at 12:53











                • According to docs this should only change the name of the resulting files from default.* to validation_errors.*. In practice this doesn't seem to enable or disable validation extraction.

                  – Álvaro González
                  Oct 29 '18 at 9:14
















                Thanks for your reply! I've seen that line in the docs however that does not seem to make any difference. Due to server environment settings i am forced to use the i18n shell trough the cake i18n command (instead of ./Console/cake etc.) Would that make a difference?

                – john23klipp
                Sep 17 '13 at 10:12






                Thanks for your reply! I've seen that line in the docs however that does not seem to make any difference. Due to server environment settings i am forced to use the i18n shell trough the cake i18n command (instead of ./Console/cake etc.) Would that make a difference?

                – john23klipp
                Sep 17 '13 at 10:12














                I'm not familiar with the server environment settings etc.., But I've tried the above command for only translation of validation messages, by using ./Console/cake i18n extract this, I18n didn't give me any strings into my validation_messages.pot file.

                – Anil kumar
                Sep 17 '13 at 10:40






                I'm not familiar with the server environment settings etc.., But I've tried the above command for only translation of validation messages, by using ./Console/cake i18n extract this, I18n didn't give me any strings into my validation_messages.pot file.

                – Anil kumar
                Sep 17 '13 at 10:40














                Thing is im really going with the i18n shell. This offers only 4 options: [E]xtract, [I]nitialize [H]elp and [Q]uit. So this means i cant add extra params to the extract command. That would be strange though (not being able to extract validations msgs through the actuall shell...)

                – john23klipp
                Sep 17 '13 at 12:53





                Thing is im really going with the i18n shell. This offers only 4 options: [E]xtract, [I]nitialize [H]elp and [Q]uit. So this means i cant add extra params to the extract command. That would be strange though (not being able to extract validations msgs through the actuall shell...)

                – john23klipp
                Sep 17 '13 at 12:53













                According to docs this should only change the name of the resulting files from default.* to validation_errors.*. In practice this doesn't seem to enable or disable validation extraction.

                – Álvaro González
                Oct 29 '18 at 9:14





                According to docs this should only change the name of the resulting files from default.* to validation_errors.*. In practice this doesn't seem to enable or disable validation extraction.

                – Álvaro González
                Oct 29 '18 at 9:14











                0














                Figured it out.
                Apparently the i18n shell does not work when targeting a particular folder. My validation messages were only extracted when running the shell on the whole app folder.



                Hope this helps.






                share|improve this answer



























                  0














                  Figured it out.
                  Apparently the i18n shell does not work when targeting a particular folder. My validation messages were only extracted when running the shell on the whole app folder.



                  Hope this helps.






                  share|improve this answer

























                    0












                    0








                    0







                    Figured it out.
                    Apparently the i18n shell does not work when targeting a particular folder. My validation messages were only extracted when running the shell on the whole app folder.



                    Hope this helps.






                    share|improve this answer













                    Figured it out.
                    Apparently the i18n shell does not work when targeting a particular folder. My validation messages were only extracted when running the shell on the whole app folder.



                    Hope this helps.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Oct 3 '13 at 8:33









                    john23klippjohn23klipp

                    30127




                    30127





















                        0














                        As desolat's answer points out there's a bug in ExtractTask::_isExtractingApp() that's still present in latest version of the 2.x branch (CakePHP/2.10.13). The method compares paths without prior normalisation thus is fragile and breaks in some scenarios.



                        In my case it was failing because of relative paths:



                        Consolecake i18n extract --quiet --paths .


                        For whatever the reason, it only works for me when I use an absolute path with a duplicate trailing slash:



                        Consolecake i18n extract --quiet --paths "C:ProjectsProject Namesrc\"


                        A hard-coded path wasn't an option because my script is meant to be shared so I used a shell variable. My shell is CMD because I run the script through Composer on Windows:



                        Consolecake i18n extract --quiet --paths "%CD%\"





                        share|improve this answer





























                          0














                          As desolat's answer points out there's a bug in ExtractTask::_isExtractingApp() that's still present in latest version of the 2.x branch (CakePHP/2.10.13). The method compares paths without prior normalisation thus is fragile and breaks in some scenarios.



                          In my case it was failing because of relative paths:



                          Consolecake i18n extract --quiet --paths .


                          For whatever the reason, it only works for me when I use an absolute path with a duplicate trailing slash:



                          Consolecake i18n extract --quiet --paths "C:ProjectsProject Namesrc\"


                          A hard-coded path wasn't an option because my script is meant to be shared so I used a shell variable. My shell is CMD because I run the script through Composer on Windows:



                          Consolecake i18n extract --quiet --paths "%CD%\"





                          share|improve this answer



























                            0












                            0








                            0







                            As desolat's answer points out there's a bug in ExtractTask::_isExtractingApp() that's still present in latest version of the 2.x branch (CakePHP/2.10.13). The method compares paths without prior normalisation thus is fragile and breaks in some scenarios.



                            In my case it was failing because of relative paths:



                            Consolecake i18n extract --quiet --paths .


                            For whatever the reason, it only works for me when I use an absolute path with a duplicate trailing slash:



                            Consolecake i18n extract --quiet --paths "C:ProjectsProject Namesrc\"


                            A hard-coded path wasn't an option because my script is meant to be shared so I used a shell variable. My shell is CMD because I run the script through Composer on Windows:



                            Consolecake i18n extract --quiet --paths "%CD%\"





                            share|improve this answer















                            As desolat's answer points out there's a bug in ExtractTask::_isExtractingApp() that's still present in latest version of the 2.x branch (CakePHP/2.10.13). The method compares paths without prior normalisation thus is fragile and breaks in some scenarios.



                            In my case it was failing because of relative paths:



                            Consolecake i18n extract --quiet --paths .


                            For whatever the reason, it only works for me when I use an absolute path with a duplicate trailing slash:



                            Consolecake i18n extract --quiet --paths "C:ProjectsProject Namesrc\"


                            A hard-coded path wasn't an option because my script is meant to be shared so I used a shell variable. My shell is CMD because I run the script through Composer on Windows:



                            Consolecake i18n extract --quiet --paths "%CD%\"






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 16 '18 at 7:34

























                            answered Nov 15 '18 at 10:29









                            Álvaro GonzálezÁlvaro González

                            107k30188279




                            107k30188279



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18845770%2fcakephp-i18n-shell-not-extracting-validation-msgs%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                這個網誌中的熱門文章

                                How to read a connectionString WITH PROVIDER in .NET Core?

                                In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                                Museum of Modern and Contemporary Art of Trento and Rovereto