cakephp i18n shell not extracting validation msgs
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
add a comment |
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
Providing the fullcake i18n extract
shell command would be helpful.
– desolat
Jul 21 '17 at 8:32
add a comment |
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
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
shell validation cakephp cakephp-2.x
edited Oct 29 '18 at 9:08
Álvaro González
107k30188279
107k30188279
asked Sep 17 '13 at 9:13
john23klippjohn23klipp
30127
30127
Providing the fullcake i18n extract
shell command would be helpful.
– desolat
Jul 21 '17 at 8:32
add a comment |
Providing the fullcake 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
add a comment |
5 Answers
5
active
oldest
votes
use this in app not in /app/Console
cake.bat i18n extract
add a comment |
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.
This is still broken as of2.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 likeC:ProjectsFoo
appears to totally break the command.
– Álvaro González
Oct 29 '18 at 9:12
add a comment |
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.
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 myvalidation_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 fromdefault.*
tovalidation_errors.*
. In practice this doesn't seem to enable or disable validation extraction.
– Álvaro González
Oct 29 '18 at 9:14
add a comment |
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.
add a comment |
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%\"
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
use this in app not in /app/Console
cake.bat i18n extract
add a comment |
use this in app not in /app/Console
cake.bat i18n extract
add a comment |
use this in app not in /app/Console
cake.bat i18n extract
use this in app not in /app/Console
cake.bat i18n extract
answered Dec 8 '14 at 1:13
RyodoRyodo
395517
395517
add a comment |
add a comment |
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.
This is still broken as of2.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 likeC:ProjectsFoo
appears to totally break the command.
– Álvaro González
Oct 29 '18 at 9:12
add a comment |
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.
This is still broken as of2.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 likeC:ProjectsFoo
appears to totally break the command.
– Álvaro González
Oct 29 '18 at 9:12
add a comment |
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.
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.
answered Jul 21 '17 at 8:30
desolatdesolat
2,12962843
2,12962843
This is still broken as of2.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 likeC:ProjectsFoo
appears to totally break the command.
– Álvaro González
Oct 29 '18 at 9:12
add a comment |
This is still broken as of2.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 likeC: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
add a comment |
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.
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 myvalidation_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 fromdefault.*
tovalidation_errors.*
. In practice this doesn't seem to enable or disable validation extraction.
– Álvaro González
Oct 29 '18 at 9:14
add a comment |
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.
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 myvalidation_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 fromdefault.*
tovalidation_errors.*
. In practice this doesn't seem to enable or disable validation extraction.
– Álvaro González
Oct 29 '18 at 9:14
add a comment |
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.
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.
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 myvalidation_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 fromdefault.*
tovalidation_errors.*
. In practice this doesn't seem to enable or disable validation extraction.
– Álvaro González
Oct 29 '18 at 9:14
add a comment |
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 myvalidation_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 fromdefault.*
tovalidation_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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Oct 3 '13 at 8:33
john23klippjohn23klipp
30127
30127
add a comment |
add a comment |
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%\"
add a comment |
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%\"
add a comment |
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%\"
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%\"
edited Nov 16 '18 at 7:34
answered Nov 15 '18 at 10:29
Álvaro GonzálezÁlvaro González
107k30188279
107k30188279
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Providing the full
cake i18n extract
shell command would be helpful.– desolat
Jul 21 '17 at 8:32