Change Cake Console files to new use of shortcut for translations.

This commit is contained in:
predominant 2010-04-16 01:43:39 +10:00
parent c87d97b4c2
commit 1e425907b2
26 changed files with 409 additions and 410 deletions

View file

@ -322,7 +322,7 @@ class ShellDispatcher {
$Shell = $this->_getShell($plugin); $Shell = $this->_getShell($plugin);
if (!$Shell) { if (!$Shell) {
$title = sprintf(__('Error: Class %s could not be loaded.', true), $this->shellClass); $title = sprintf(__('Error: Class %s could not be loaded.'), $this->shellClass);
$this->stderr($title . "\n"); $this->stderr($title . "\n");
return false; return false;
} }
@ -374,8 +374,8 @@ class ShellDispatcher {
} }
} }
$title = sprintf(__('Error: Unknown %1$s command %2$s.', true), $this->shellName, $arg); $title = sprintf(__('Error: Unknown %1$s command %2$s.'), $this->shellName, $arg);
$message = sprintf(__('For usage try `cake %s help`', true), $this->shell); $message = sprintf(__('For usage try `cake %s help`'), $this->shell);
$this->stderr($title . "\n" . $message . "\n"); $this->stderr($title . "\n" . $message . "\n");
return false; return false;
} }

View file

@ -75,7 +75,7 @@ class ErrorHandler extends Object {
$this->error(array( $this->error(array(
'code' => '404', 'code' => '404',
'name' => 'Not found', 'name' => 'Not found',
'message' => sprintf(__("The requested address %s was not found on this server.", true), $url, $message) 'message' => sprintf(__('The requested address %s was not found on this server.'), $url, $message)
)); ));
$this->_stop(); $this->_stop();
} }
@ -88,7 +88,7 @@ class ErrorHandler extends Object {
public function missingController($params) { public function missingController($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$controllerName = str_replace('Controller', '', $className); $controllerName = str_replace('Controller', '', $className);
$this->stderr(sprintf(__("Missing Controller '%s'", true), $controllerName)); $this->stderr(sprintf(__("Missing Controller '%s'"), $controllerName));
$this->_stop(); $this->_stop();
} }
@ -99,7 +99,7 @@ class ErrorHandler extends Object {
*/ */
public function missingAction($params) { public function missingAction($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Method '%s' in '%s'", true), $action, $className)); $this->stderr(sprintf(__("Missing Method '%s' in '%s'"), $action, $className));
$this->_stop(); $this->_stop();
} }
@ -110,7 +110,7 @@ class ErrorHandler extends Object {
*/ */
public function privateAction($params) { public function privateAction($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Trying to access private method '%s' in '%s'", true), $action, $className)); $this->stderr(sprintf(__("Trying to access private method '%s' in '%s'"), $action, $className));
$this->_stop(); $this->_stop();
} }
@ -121,7 +121,7 @@ class ErrorHandler extends Object {
*/ */
public function missingTable($params) { public function missingTable($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing database table '%s' for model '%s'", true), $table, $className)); $this->stderr(sprintf(__("Missing database table '%s' for model '%s'"), $table, $className));
$this->_stop(); $this->_stop();
} }
@ -131,7 +131,7 @@ class ErrorHandler extends Object {
* @param array $params Parameters * @param array $params Parameters
*/ */
public function missingDatabase($params = array()) { public function missingDatabase($params = array()) {
$this->stderr(__("Missing Database", true)); $this->stderr(__('Missing Database'));
$this->_stop(); $this->_stop();
} }
@ -142,7 +142,7 @@ class ErrorHandler extends Object {
*/ */
public function missingView($params) { public function missingView($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing View '%s' for '%s' in '%s'", true), $file, $action, $className)); $this->stderr(sprintf(__("Missing View '%s' for '%s' in '%s'"), $file, $action, $className));
$this->_stop(); $this->_stop();
} }
@ -153,7 +153,7 @@ class ErrorHandler extends Object {
*/ */
public function missingLayout($params) { public function missingLayout($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Layout '%s'", true), $file)); $this->stderr(sprintf(__("Missing Layout '%s'"), $file));
$this->_stop(); $this->_stop();
} }
@ -164,7 +164,7 @@ class ErrorHandler extends Object {
*/ */
public function missingConnection($params) { public function missingConnection($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(__("Missing Database Connection. Try 'cake bake'", true)); $this->stderr(__("Missing Database Connection. Try 'cake bake'"));
$this->_stop(); $this->_stop();
} }
@ -175,7 +175,7 @@ class ErrorHandler extends Object {
*/ */
public function missingHelperFile($params) { public function missingHelperFile($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Helper file '%s' for '%s'", true), $file, Inflector::camelize($helper))); $this->stderr(sprintf(__("Missing Helper file '%s' for '%s'"), $file, Inflector::camelize($helper)));
$this->_stop(); $this->_stop();
} }
@ -186,7 +186,7 @@ class ErrorHandler extends Object {
*/ */
public function missingHelperClass($params) { public function missingHelperClass($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Helper class '%s' in '%s'", true), Inflector::camelize($helper), $file)); $this->stderr(sprintf(__("Missing Helper class '%s' in '%s'"), Inflector::camelize($helper), $file));
$this->_stop(); $this->_stop();
} }
@ -197,7 +197,7 @@ class ErrorHandler extends Object {
*/ */
public function missingComponentFile($params) { public function missingComponentFile($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Component file '%s' for '%s'", true), $file, Inflector::camelize($component))); $this->stderr(sprintf(__("Missing Component file '%s' for '%s'"), $file, Inflector::camelize($component)));
$this->_stop(); $this->_stop();
} }
@ -208,7 +208,7 @@ class ErrorHandler extends Object {
*/ */
public function missingComponentClass($params) { public function missingComponentClass($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Component class '%s' in '%s'", true), Inflector::camelize($component), $file)); $this->stderr(sprintf(__("Missing Component class '%s' in '%s'"), Inflector::camelize($component), $file));
$this->_stop(); $this->_stop();
} }
@ -219,7 +219,7 @@ class ErrorHandler extends Object {
*/ */
public function missingModel($params) { public function missingModel($params) {
extract($params, EXTR_OVERWRITE); extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing model '%s'", true), $className)); $this->stderr(sprintf(__("Missing model '%s'"), $className));
$this->_stop(); $this->_stop();
} }

View file

@ -71,12 +71,12 @@ class AclShell extends Shell {
if (!in_array(Configure::read('Acl.classname'), array('DbAcl', 'DB_ACL'))) { if (!in_array(Configure::read('Acl.classname'), array('DbAcl', 'DB_ACL'))) {
$out = "--------------------------------------------------\n"; $out = "--------------------------------------------------\n";
$out .= __("Error: Your current Cake configuration is set to", true) . "\n"; $out .= __('Error: Your current Cake configuration is set to') . "\n";
$out .= __("an ACL implementation other than DB. Please change", true) . "\n"; $out .= __('an ACL implementation other than DB. Please change') . "\n";
$out .= __("your core config to reflect your decision to use", true) . "\n"; $out .= __('your core config to reflect your decision to use') . "\n";
$out .= __("DbAcl before attempting to use this script", true) . ".\n"; $out .= __('DbAcl before attempting to use this script') . ".\n";
$out .= "--------------------------------------------------\n"; $out .= "--------------------------------------------------\n";
$out .= sprintf(__("Current ACL Classname: %s", true), Configure::read('Acl.classname')) . "\n"; $out .= sprintf(__('Current ACL Classname: %s'), Configure::read('Acl.classname')) . "\n";
$out .= "--------------------------------------------------\n"; $out .= "--------------------------------------------------\n";
$this->err($out); $this->err($out);
$this->_stop(); $this->_stop();
@ -84,7 +84,7 @@ class AclShell extends Shell {
if ($this->command && !in_array($this->command, array('help'))) { if ($this->command && !in_array($this->command, array('help'))) {
if (!config('database')) { if (!config('database')) {
$this->out(__("Your database configuration was not found. Take a moment to create one.", true), true); $this->out(__('Your database configuration was not found. Take a moment to create one.'), true);
$this->args = null; $this->args = null;
return $this->DbConfig->execute(); return $this->DbConfig->execute();
} }
@ -103,7 +103,7 @@ class AclShell extends Shell {
* *
*/ */
public function main() { public function main() {
$out = __("Available ACL commands:", true) . "\n"; $out = __('Available ACL commands:') . "\n";
$out .= "\t - create\n"; $out .= "\t - create\n";
$out .= "\t - delete\n"; $out .= "\t - delete\n";
$out .= "\t - setParent\n"; $out .= "\t - setParent\n";
@ -115,7 +115,7 @@ class AclShell extends Shell {
$out .= "\t - view\n"; $out .= "\t - view\n";
$out .= "\t - initdb\n"; $out .= "\t - initdb\n";
$out .= "\t - help\n\n"; $out .= "\t - help\n\n";
$out .= __("For help, run the 'help' command. For help on a specific command, run 'help <command>'", true); $out .= __("For help, run the 'help' command. For help on a specific command, run 'help <command>'");
$this->out($out); $this->out($out);
} }
@ -141,15 +141,15 @@ class AclShell extends Shell {
if (is_string($data) && $data != '/') { if (is_string($data) && $data != '/') {
$data = array('alias' => $data); $data = array('alias' => $data);
} elseif (is_string($data)) { } elseif (is_string($data)) {
$this->error(__('/ can not be used as an alias!', true), __("\t/ is the root, please supply a sub alias", true)); $this->error(__('/ can not be used as an alias!'), __("\t/ is the root, please supply a sub alias"));
} }
$data['parent_id'] = $parent; $data['parent_id'] = $parent;
$this->Acl->{$class}->create(); $this->Acl->{$class}->create();
if ($this->Acl->{$class}->save($data)) { if ($this->Acl->{$class}->save($data)) {
$this->out(sprintf(__("New %s '%s' created.\n", true), $class, $this->args[2]), true); $this->out(sprintf(__("New %s '%s' created.\n"), $class, $this->args[2]), true);
} else { } else {
$this->err(sprintf(__("There was a problem creating a new %s '%s'.", true), $class, $this->args[2])); $this->err(sprintf(__("There was a problem creating a new %s '%s'."), $class, $this->args[2]));
} }
} }
@ -166,9 +166,9 @@ class AclShell extends Shell {
$nodeId = $this->_getNodeId($class, $identifier); $nodeId = $this->_getNodeId($class, $identifier);
if (!$this->Acl->{$class}->delete($nodeId)) { if (!$this->Acl->{$class}->delete($nodeId)) {
$this->error(__("Node Not Deleted", true), sprintf(__("There was an error deleting the %s. Check that the node exists", true), $class) . ".\n"); $this->error(__('Node Not Deleted'), sprintf(__('There was an error deleting the %s. Check that the node exists'), $class) . ".\n");
} }
$this->out(sprintf(__("%s deleted", true), $class) . ".\n", true); $this->out(sprintf(__('%s deleted'), $class) . ".\n", true);
} }
/** /**
@ -190,9 +190,9 @@ class AclShell extends Shell {
); );
$this->Acl->{$class}->create(); $this->Acl->{$class}->create();
if (!$this->Acl->{$class}->save($data)) { if (!$this->Acl->{$class}->save($data)) {
$this->out(__("Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.", true), true); $this->out(__('Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.'), true);
} else { } else {
$this->out(sprintf(__("Node parent set to %s", true), $this->args[2]) . "\n", true); $this->out(sprintf(__('Node parent set to %s'), $this->args[2]) . "\n", true);
} }
} }
@ -211,11 +211,11 @@ class AclShell extends Shell {
if (empty($nodes)) { if (empty($nodes)) {
$this->error( $this->error(
sprintf(__("Supplied Node '%s' not found", true), $this->args[1]), sprintf(__("Supplied Node '%s' not found"), $this->args[1]),
__("No tree returned.", true) __('No tree returned.')
); );
} }
$this->out(__('Path:', true)); $this->out(__('Path:'));
$this->hr(); $this->hr();
for ($i = 0; $i < count($nodes); $i++) { for ($i = 0; $i < count($nodes); $i++) {
$this->_outputNode($class, $nodes[$i], $i); $this->_outputNode($class, $nodes[$i], $i);
@ -249,9 +249,9 @@ class AclShell extends Shell {
extract($this->__getParams()); extract($this->__getParams());
if ($this->Acl->check($aro, $aco, $action)) { if ($this->Acl->check($aro, $aco, $action)) {
$this->out(sprintf(__("%s is allowed.", true), $aroName), true); $this->out(sprintf(__('%s is allowed.'), $aroName), true);
} else { } else {
$this->out(sprintf(__("%s is not allowed.", true), $aroName), true); $this->out(sprintf(__('%s is not allowed.'), $aroName), true);
} }
} }
@ -264,9 +264,9 @@ class AclShell extends Shell {
extract($this->__getParams()); extract($this->__getParams());
if ($this->Acl->allow($aro, $aco, $action)) { if ($this->Acl->allow($aro, $aco, $action)) {
$this->out(__("Permission granted.", true), true); $this->out(__('Permission granted.'), true);
} else { } else {
$this->out(__("Permission was not granted.", true), true); $this->out(__('Permission was not granted.'), true);
} }
} }
@ -279,9 +279,9 @@ class AclShell extends Shell {
extract($this->__getParams()); extract($this->__getParams());
if ($this->Acl->deny($aro, $aco, $action)) { if ($this->Acl->deny($aro, $aco, $action)) {
$this->out(__("Permission denied.", true), true); $this->out(__('Permission denied.'), true);
} else { } else {
$this->out(__("Permission was not denied.", true), true); $this->out(__('Permission was not denied.'), true);
} }
} }
@ -294,9 +294,9 @@ class AclShell extends Shell {
extract($this->__getParams()); extract($this->__getParams());
if ($this->Acl->inherit($aro, $aco, $action)) { if ($this->Acl->inherit($aro, $aco, $action)) {
$this->out(__("Permission inherited.", true), true); $this->out(__('Permission inherited.'), true);
} else { } else {
$this->out(__("Permission was not inherited.", true), true); $this->out(__('Permission was not inherited.'), true);
} }
} }
@ -329,9 +329,9 @@ class AclShell extends Shell {
if (empty($nodes)) { if (empty($nodes)) {
if (isset($this->args[1])) { if (isset($this->args[1])) {
$this->error(sprintf(__("%s not found", true), $this->args[1]), __("No tree returned.", true)); $this->error(sprintf(__('%s not found'), $this->args[1]), __('No tree returned.'));
} elseif (isset($this->args[0])) { } elseif (isset($this->args[0])) {
$this->error(sprintf(__("%s not found", true), $this->args[0]), __("No tree returned.", true)); $this->error(sprintf(__('%s not found'), $this->args[0]), __('No tree returned.'));
} }
} }
$this->out($class . " tree:"); $this->out($class . " tree:");
@ -376,81 +376,81 @@ class AclShell extends Shell {
*/ */
public function help() { public function help() {
$head = "-----------------------------------------------\n"; $head = "-----------------------------------------------\n";
$head .= __("Usage: cake acl <command> <arg1> <arg2>...", true) . "\n"; $head .= __('Usage: cake acl <command> <arg1> <arg2>...') . "\n";
$head .= "-----------------------------------------------\n"; $head .= "-----------------------------------------------\n";
$head .= __("Commands:", true) . "\n"; $head .= __('Commands:') . "\n";
$commands = array( $commands = array(
'create' => "create aro|aco <parent> <node>\n" . 'create' => "create aro|aco <parent> <node>\n" .
"\t" . __("Creates a new ACL object <node> under the parent", true) . "\n" . "\t" . __("Creates a new ACL object <node> under the parent") . "\n" .
"\t" . __("specified by <parent>, an id/alias.", true) . "\n" . "\t" . __("specified by <parent>, an id/alias.") . "\n" .
"\t" . __("The <parent> and <node> references can be", true) . "\n" . "\t" . __("The <parent> and <node> references can be") . "\n" .
"\t" . __("in one of the following formats:", true) . "\n\n" . "\t" . __("in one of the following formats:") . "\n\n" .
"\t\t- " . __("<model>.<id> - The node will be bound to a", true) . "\n" . "\t\t- " . __("<model>.<id> - The node will be bound to a") . "\n" .
"\t\t" . __("specific record of the given model.", true) . "\n\n" . "\t\t" . __("specific record of the given model.") . "\n\n" .
"\t\t- " . __("<alias> - The node will be given a string alias,", true) . "\n" . "\t\t- " . __("<alias> - The node will be given a string alias,") . "\n" .
"\t\t" . __(" (or path, in the case of <parent>)", true) . "\n" . "\t\t" . __(" (or path, in the case of <parent>)") . "\n" .
"\t\t " . __("i.e. 'John'. When used with <parent>,", true) . "\n" . "\t\t " . __("i.e. 'John'. When used with <parent>,") . "\n" .
"\t\t" . __("this takes the form of an alias path,", true) . "\n" . "\t\t" . __("this takes the form of an alias path,") . "\n" .
"\t\t " . __("i.e. <group>/<subgroup>/<parent>.", true) . "\n\n" . "\t\t " . __("i.e. <group>/<subgroup>/<parent>.") . "\n\n" .
"\t" . __("To add a node at the root level,", true) . "\n" . "\t" . __("To add a node at the root level,") . "\n" .
"\t" . __("enter 'root' or '/' as the <parent> parameter.", true) . "\n", "\t" . __("enter 'root' or '/' as the <parent> parameter.") . "\n",
'delete' => "delete aro|aco <node>\n" . 'delete' => "delete aro|aco <node>\n" .
"\t" . __("Deletes the ACL object with the given <node> reference", true) . "\n" . "\t" . __("Deletes the ACL object with the given <node> reference") . "\n" .
"\t" . __("For more detailed parameter usage info,", true) . "\n" . "\t" . __("For more detailed parameter usage info,") . "\n" .
"\t" . __("see help for the 'create' command.", true), "\t" . __("see help for the 'create' command."),
'setparent' => "setParent aro|aco <node> <parent node>\n" . 'setparent' => "setParent aro|aco <node> <parent node>\n" .
"\t" . __("Moves the ACL object specified by <node> beneath", true) . "\n" . "\t" . __("Moves the ACL object specified by <node> beneath") . "\n" .
"\t" . __("the parent ACL object specified by <parent>.", true) . "\n" . "\t" . __("the parent ACL object specified by <parent>.") . "\n" .
"\t" . __("For more detailed parameter usage info,", true) . "\n" . "\t" . __("For more detailed parameter usage info,") . "\n" .
"\t" . __("see help for the 'create' command.", true), "\t" . __("see help for the 'create' command."),
'getpath' => "getPath aro|aco <node>\n" . 'getpath' => "getPath aro|aco <node>\n" .
"\t" . __("Returns the path to the ACL object specified by <node>. This command", true) . "\n" . "\t" . __("Returns the path to the ACL object specified by <node>. This command") . "\n" .
"\t" . __("is useful in determining the inhertiance of permissions for a certain", true) . "\n" . "\t" . __("is useful in determining the inhertiance of permissions for a certain") . "\n" .
"\t" . __("object in the tree.", true) . "\n" . "\t" . __("object in the tree.") . "\n" .
"\t" . __("For more detailed parameter usage info,", true) . "\n" . "\t" . __("For more detailed parameter usage info,") . "\n" .
"\t" . __("see help for the 'create' command.", true), "\t" . __("see help for the 'create' command."),
'check' => "check <node> <node> [<aco_action>] " . __("or", true) . " all\n" . 'check' => "check <node> <node> [<aco_action>] " . __("or") . " all\n" .
"\t" . __("Use this command to check ACL permissions.", true) . "\n" . "\t" . __("Use this command to check ACL permissions.") . "\n" .
"\t" . __("For more detailed parameter usage info,", true) . "\n" . "\t" . __("For more detailed parameter usage info,") . "\n" .
"\t" . __("see help for the 'create' command.", true), "\t" . __("see help for the 'create' command."),
'grant' => "grant <node> <node> [<aco_action>] " . __("or", true) . " all\n" . 'grant' => "grant <node> <node> [<aco_action>] " . __("or") . " all\n" .
"\t" . __("Use this command to grant ACL permissions. Once executed, the ARO", true) . "\n" . "\t" . __("Use this command to grant ACL permissions. Once executed, the ARO") . "\n" .
"\t" . __("specified (and its children, if any) will have ALLOW access to the", true) . "\n" . "\t" . __("specified (and its children, if any) will have ALLOW access to the") . "\n" .
"\t" . __("specified ACO action (and the ACO's children, if any).", true) . "\n" . "\t" . __("specified ACO action (and the ACO's children, if any).") . "\n" .
"\t" . __("For more detailed parameter usage info,", true) . "\n" . "\t" . __("For more detailed parameter usage info,") . "\n" .
"\t" . __("see help for the 'create' command.", true), "\t" . __("see help for the 'create' command."),
'deny' => "deny <node> <node> [<aco_action>]" . __("or", true) . " all\n" . 'deny' => "deny <node> <node> [<aco_action>]" . __("or") . " all\n" .
"\t" . __("Use this command to deny ACL permissions. Once executed, the ARO", true) . "\n" . "\t" . __("Use this command to deny ACL permissions. Once executed, the ARO") . "\n" .
"\t" . __("specified (and its children, if any) will have DENY access to the", true) . "\n" . "\t" . __("specified (and its children, if any) will have DENY access to the") . "\n" .
"\t" . __("specified ACO action (and the ACO's children, if any).", true) . "\n" . "\t" . __("specified ACO action (and the ACO's children, if any).") . "\n" .
"\t" . __("For more detailed parameter usage info,", true) . "\n" . "\t" . __("For more detailed parameter usage info,") . "\n" .
"\t" . __("see help for the 'create' command.", true), "\t" . __("see help for the 'create' command."),
'inherit' => "inherit <node> <node> [<aco_action>]" . __("or", true) . " all\n" . 'inherit' => "inherit <node> <node> [<aco_action>]" . __("or") . " all\n" .
"\t" . __("Use this command to force a child ARO object to inherit its", true) . "\n" . "\t" . __("Use this command to force a child ARO object to inherit its") . "\n" .
"\t" . __("permissions settings from its parent.", true) . "\n" . "\t" . __("permissions settings from its parent.") . "\n" .
"\t" . __("For more detailed parameter usage info,", true) . "\n" . "\t" . __("For more detailed parameter usage info,") . "\n" .
"\t" . __("see help for the 'create' command.", true), "\t" . __("see help for the 'create' command."),
'view' => "view aro|aco [<node>]\n" . 'view' => "view aro|aco [<node>]\n" .
"\t" . __("The view command will return the ARO or ACO tree.", true) . "\n" . "\t" . __("The view command will return the ARO or ACO tree.") . "\n" .
"\t" . __("The optional node parameter allows you to return", true) . "\n" . "\t" . __("The optional node parameter allows you to return") . "\n" .
"\t" . __("only a portion of the requested tree.", true) . "\n" . "\t" . __("only a portion of the requested tree.") . "\n" .
"\t" . __("For more detailed parameter usage info,", true) . "\n" . "\t" . __("For more detailed parameter usage info,") . "\n" .
"\t" . __("see help for the 'create' command.", true), "\t" . __("see help for the 'create' command."),
'initdb' => "initdb\n". 'initdb' => "initdb\n".
"\t" . __("Uses this command : cake schema run create DbAcl", true), "\t" . __("Uses this command : cake schema run create DbAcl"),
'help' => "help [<command>]\n" . 'help' => "help [<command>]\n" .
"\t" . __("Displays this help message, or a message on a specific command.", true) "\t" . __("Displays this help message, or a message on a specific command.")
); );
$this->out($head); $this->out($head);
@ -461,7 +461,7 @@ class AclShell extends Shell {
} elseif (isset($commands[strtolower($this->args[0])])) { } elseif (isset($commands[strtolower($this->args[0])])) {
$this->out($commands[strtolower($this->args[0])] . "\n\n"); $this->out($commands[strtolower($this->args[0])] . "\n\n");
} else { } else {
$this->out(sprintf(__("Command '%s' not found", true), $this->args[0])); $this->out(sprintf(__("Command '%s' not found"), $this->args[0]));
} }
} }
@ -474,7 +474,7 @@ class AclShell extends Shell {
return false; return false;
} }
if ($this->args[0] != 'aco' && $this->args[0] != 'aro') { if ($this->args[0] != 'aco' && $this->args[0] != 'aro') {
$this->error(sprintf(__("Missing/Unknown node type: '%s'", true), $this->args[0]), __('Please specify which ACL object type you wish to create. Either "aro" or "aco"', true)); $this->error(sprintf(__("Missing/Unknown node type: '%s'"), $this->args[0]), __('Please specify which ACL object type you wish to create. Either "aro" or "aco"'));
} }
} }
@ -494,7 +494,7 @@ class AclShell extends Shell {
$conditions = array($class . '.' . $key => $this->args[1]); $conditions = array($class . '.' . $key => $this->args[1]);
$possibility = $this->Acl->{$class}->find('all', compact('conditions')); $possibility = $this->Acl->{$class}->find('all', compact('conditions'));
if (empty($possibility)) { if (empty($possibility)) {
$this->error(sprintf(__("%s not found", true), $this->args[1]), __("No tree returned.", true)); $this->error(sprintf(__('%s not found'), $this->args[1]), __('No tree returned.'));
} }
return $possibility; return $possibility;
} }
@ -530,7 +530,7 @@ class AclShell extends Shell {
if (is_array($identifier)) { if (is_array($identifier)) {
$identifier = var_export($identifier, true); $identifier = var_export($identifier, true);
} }
$this->error(sprintf(__('Could not find node using reference "%s"', true), $identifier)); $this->error(sprintf(__('Could not find node using reference "%s"'), $identifier));
} }
return Set::extract($node, "0.{$class}.id"); return Set::extract($node, "0.{$class}.id");
} }

View file

@ -87,7 +87,7 @@ class ApiShell extends Shell {
} }
} else { } else {
$this->err(sprintf(__("%s not found", true), $class)); $this->err(sprintf(__('%s not found'), $class));
$this->_stop(); $this->_stop();
} }
@ -96,7 +96,7 @@ class ApiShell extends Shell {
if (!empty($parsed)) { if (!empty($parsed)) {
if (isset($this->params['m'])) { if (isset($this->params['m'])) {
if (!isset($parsed[$this->params['m']])) { if (!isset($parsed[$this->params['m']])) {
$this->err(sprintf(__("%s::%s() could not be found", true), $class, $this->params['m'])); $this->err(sprintf(__('%s::%s() could not be found'), $class, $this->params['m']));
$this->_stop(); $this->_stop();
} }
$method = $parsed[$this->params['m']]; $method = $parsed[$this->params['m']];
@ -113,9 +113,9 @@ class ApiShell extends Shell {
$this->out($list); $this->out($list);
$methods = array_keys($parsed); $methods = array_keys($parsed);
while ($number = strtolower($this->in(__('Select a number to see the more information about a specific method. q to quit. l to list.', true), null, 'q'))) { while ($number = strtolower($this->in(__('Select a number to see the more information about a specific method. q to quit. l to list.'), null, 'q'))) {
if ($number === 'q') { if ($number === 'q') {
$this->out(__('Done', true)); $this->out(__('Done'));
$this->_stop(); $this->_stop();
} }
@ -185,7 +185,7 @@ class ApiShell extends Shell {
$File = new File($path); $File = new File($path);
if (!$File->exists()) { if (!$File->exists()) {
$this->err(sprintf(__("%s could not be found", true), $File->name)); $this->err(sprintf(__('%s could not be found'), $File->name));
$this->_stop(); $this->_stop();
} }

View file

@ -76,7 +76,7 @@ class BakeShell extends Shell {
} }
if (!config('database')) { if (!config('database')) {
$this->out(__("Your database configuration was not found. Take a moment to create one.", true)); $this->out(__('Your database configuration was not found. Take a moment to create one.'));
$this->args = null; $this->args = null;
return $this->DbConfig->execute(); return $this->DbConfig->execute();
} }
@ -91,7 +91,7 @@ class BakeShell extends Shell {
$this->out('[T]est case'); $this->out('[T]est case');
$this->out('[Q]uit'); $this->out('[Q]uit');
$classToBake = strtoupper($this->in(__('What would you like to Bake?', true), array('D', 'M', 'V', 'C', 'P', 'F', 'T', 'Q'))); $classToBake = strtoupper($this->in(__('What would you like to Bake?'), array('D', 'M', 'V', 'C', 'P', 'F', 'T', 'Q')));
switch ($classToBake) { switch ($classToBake) {
case 'D': case 'D':
$this->DbConfig->execute(); $this->DbConfig->execute();
@ -118,7 +118,7 @@ class BakeShell extends Shell {
exit(0); exit(0);
break; break;
default: default:
$this->out(__('You have made an invalid selection. Please choose a type of class to Bake by entering D, M, V, F, T, or C.', true)); $this->out(__('You have made an invalid selection. Please choose a type of class to Bake by entering D, M, V, F, T, or C.'));
} }
$this->hr(); $this->hr();
$this->main(); $this->main();
@ -164,7 +164,7 @@ class BakeShell extends Shell {
$modelBaked = $this->Model->bake($object, false); $modelBaked = $this->Model->bake($object, false);
if ($modelBaked && $modelExists === false) { if ($modelBaked && $modelExists === false) {
$this->out(sprintf(__('%s Model was baked.', true), $model)); $this->out(sprintf(__('%s Model was baked.'), $model));
if ($this->_checkUnitTest()) { if ($this->_checkUnitTest()) {
$this->Model->bakeFixture($model); $this->Model->bakeFixture($model);
$this->Model->bakeTest($model); $this->Model->bakeTest($model);
@ -175,7 +175,7 @@ class BakeShell extends Shell {
if ($modelExists === true) { if ($modelExists === true) {
$controller = $this->_controllerName($name); $controller = $this->_controllerName($name);
if ($this->Controller->bake($controller, $this->Controller->bakeActions($controller))) { if ($this->Controller->bake($controller, $this->Controller->bakeActions($controller))) {
$this->out(sprintf(__('%s Controller was baked.', true), $name)); $this->out(sprintf(__('%s Controller was baked.'), $name));
if ($this->_checkUnitTest()) { if ($this->_checkUnitTest()) {
$this->Controller->bakeTest($controller); $this->Controller->bakeTest($controller);
} }
@ -183,12 +183,12 @@ class BakeShell extends Shell {
if (App::import('Controller', $controller)) { if (App::import('Controller', $controller)) {
$this->View->args = array($controller); $this->View->args = array($controller);
$this->View->execute(); $this->View->execute();
$this->out(sprintf(__('%s Views were baked.', true), $name)); $this->out(sprintf(__('%s Views were baked.'), $name));
} }
$this->out(__('Bake All complete', true)); $this->out(__('Bake All complete'));
array_shift($this->args); array_shift($this->args);
} else { } else {
$this->err(__('Bake All could not continue without a valid model', true)); $this->err(__('Bake All could not continue without a valid model'));
} }
$this->_stop(); $this->_stop();
} }
@ -221,7 +221,6 @@ class BakeShell extends Shell {
$this->out("\n\tbake fixture\n\t\tbakes fixtures. run 'bake fixture help' for more info."); $this->out("\n\tbake fixture\n\t\tbakes fixtures. run 'bake fixture help' for more info.");
$this->out("\n\tbake test\n\t\tbakes unit tests. run 'bake test help' for more info."); $this->out("\n\tbake test\n\t\tbakes unit tests. run 'bake test help' for more info.");
$this->out(); $this->out();
} }
} }
?> ?>

View file

@ -54,7 +54,7 @@ class I18nShell extends Shell {
if ($this->command && !in_array($this->command, array('help'))) { if ($this->command && !in_array($this->command, array('help'))) {
if (!config('database')) { if (!config('database')) {
$this->out(__('Your database configuration was not found. Take a moment to create one.', true), true); $this->out(__('Your database configuration was not found. Take a moment to create one.'), true);
return $this->DbConfig->execute(); return $this->DbConfig->execute();
} }
} }
@ -65,14 +65,14 @@ class I18nShell extends Shell {
* *
*/ */
public function main() { public function main() {
$this->out(__('I18n Shell', true)); $this->out(__('I18n Shell'));
$this->hr(); $this->hr();
$this->out(__('[E]xtract POT file from sources', true)); $this->out(__('[E]xtract POT file from sources'));
$this->out(__('[I]nitialize i18n database table', true)); $this->out(__('[I]nitialize i18n database table'));
$this->out(__('[H]elp', true)); $this->out(__('[H]elp'));
$this->out(__('[Q]uit', true)); $this->out(__('[Q]uit'));
$choice = strtolower($this->in(__('What would you like to do?', true), array('E', 'I', 'H', 'Q'))); $choice = strtolower($this->in(__('What would you like to do?'), array('E', 'I', 'H', 'Q')));
switch ($choice) { switch ($choice) {
case 'e': case 'e':
$this->Extract->execute(); $this->Extract->execute();
@ -87,7 +87,7 @@ class I18nShell extends Shell {
exit(0); exit(0);
break; break;
default: default:
$this->out(__('You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.', true)); $this->out(__('You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.'));
} }
$this->hr(); $this->hr();
$this->main(); $this->main();
@ -108,12 +108,12 @@ class I18nShell extends Shell {
*/ */
public function help() { public function help() {
$this->hr(); $this->hr();
$this->out(__('I18n Shell:', true)); $this->out(__('I18n Shell:'));
$this->hr(); $this->hr();
$this->out(__('I18n Shell initializes i18n database table for your application', true)); $this->out(__('I18n Shell initializes i18n database table for your application'));
$this->out(__('and generates .pot file(s) with translations.', true)); $this->out(__('and generates .pot file(s) with translations.'));
$this->hr(); $this->hr();
$this->out(__('usage:', true)); $this->out(__('usage:'));
$this->out(' cake i18n help'); $this->out(' cake i18n help');
$this->out(' cake i18n initdb [-datasource custom]'); $this->out(' cake i18n initdb [-datasource custom]');
$this->out(); $this->out();

View file

@ -112,7 +112,7 @@ class SchemaShell extends Shell {
$this->_stop(); $this->_stop();
} else { } else {
$file = $this->Schema->path . DS . $this->params['file']; $file = $this->Schema->path . DS . $this->params['file'];
$this->err(sprintf(__('Schema file (%s) could not be found.', true), $file)); $this->err(sprintf(__('Schema file (%s) could not be found.'), $file));
$this->_stop(); $this->_stop();
} }
} }
@ -123,7 +123,7 @@ class SchemaShell extends Shell {
* *
*/ */
public function generate() { public function generate() {
$this->out(__('Generating Schema...', true)); $this->out(__('Generating Schema...'));
$options = array(); $options = array();
if (isset($this->params['f'])) { if (isset($this->params['f'])) {
$options = array('models' => false); $options = array('models' => false);
@ -177,10 +177,10 @@ class SchemaShell extends Shell {
} }
if ($this->Schema->write($content)) { if ($this->Schema->write($content)) {
$this->out(sprintf(__('Schema file: %s generated', true), $content['file'])); $this->out(sprintf(__('Schema file: %s generated'), $content['file']));
$this->_stop(); $this->_stop();
} else { } else {
$this->err(__('Schema file: %s generated', true)); $this->err(__('Schema file: %s generated'));
$this->_stop(); $this->_stop();
} }
} }
@ -197,7 +197,7 @@ class SchemaShell extends Shell {
$write = false; $write = false;
$Schema = $this->Schema->load(); $Schema = $this->Schema->load();
if (!$Schema) { if (!$Schema) {
$this->err(__('Schema could not be loaded', true)); $this->err(__('Schema could not be loaded'));
$this->_stop(); $this->_stop();
} }
if (isset($this->params['write'])) { if (isset($this->params['write'])) {
@ -222,10 +222,10 @@ class SchemaShell extends Shell {
} }
if ($File->write($contents)) { if ($File->write($contents)) {
$this->out(sprintf(__('SQL dump file created in %s', true), $File->pwd())); $this->out(sprintf(__('SQL dump file created in %s'), $File->pwd()));
$this->_stop(); $this->_stop();
} else { } else {
$this->err(__('SQL dump could not be created', true)); $this->err(__('SQL dump could not be created'));
$this->_stop(); $this->_stop();
} }
} }
@ -269,7 +269,7 @@ class SchemaShell extends Shell {
if (isset($this->params['dry'])) { if (isset($this->params['dry'])) {
$this->__dry = true; $this->__dry = true;
$this->out(__('Performing a dry run.', true)); $this->out(__('Performing a dry run.'));
} }
$options = array('name' => $name, 'plugin' => $plugin); $options = array('name' => $name, 'plugin' => $plugin);
@ -281,7 +281,7 @@ class SchemaShell extends Shell {
$Schema =& $this->Schema->load($options); $Schema =& $this->Schema->load($options);
if (!$Schema) { if (!$Schema) {
$this->err(sprintf(__('%s could not be loaded', true), $this->Schema->path . DS . $this->Schema->file)); $this->err(sprintf(__('%s could not be loaded'), $this->Schema->path . DS . $this->Schema->file));
$this->_stop(); $this->_stop();
} }
$table = null; $table = null;
@ -312,26 +312,26 @@ class SchemaShell extends Shell {
$create[$table] = $db->createSchema($Schema, $table); $create[$table] = $db->createSchema($Schema, $table);
} }
if (empty($drop) || empty($create)) { if (empty($drop) || empty($create)) {
$this->out(__('Schema is up to date.', true)); $this->out(__('Schema is up to date.'));
$this->_stop(); $this->_stop();
} }
$this->out("\n" . __('The following table(s) will be dropped.', true)); $this->out("\n" . __('The following table(s) will be dropped.'));
$this->out(array_keys($drop)); $this->out(array_keys($drop));
if ('y' == $this->in(__('Are you sure you want to drop the table(s)?', true), array('y', 'n'), 'n')) { if ('y' == $this->in(__('Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n')) {
$this->out(__('Dropping table(s).', true)); $this->out(__('Dropping table(s).'));
$this->__run($drop, 'drop', $Schema); $this->__run($drop, 'drop', $Schema);
} }
$this->out("\n" . __('The following table(s) will be created.', true)); $this->out("\n" . __('The following table(s) will be created.'));
$this->out(array_keys($create)); $this->out(array_keys($create));
if ('y' == $this->in(__('Are you sure you want to create the table(s)?', true), array('y', 'n'), 'y')) { if ('y' == $this->in(__('Are you sure you want to create the table(s)?'), array('y', 'n'), 'y')) {
$this->out(__('Creating table(s).', true)); $this->out(__('Creating table(s).'));
$this->__run($create, 'create', $Schema); $this->__run($create, 'create', $Schema);
} }
$this->out(__('End create.', true)); $this->out(__('End create.'));
} }
/** /**
@ -343,7 +343,7 @@ class SchemaShell extends Shell {
function __update(&$Schema, $table = null) { function __update(&$Schema, $table = null) {
$db =& ConnectionManager::getDataSource($this->Schema->connection); $db =& ConnectionManager::getDataSource($this->Schema->connection);
$this->out(__('Comparing Database to Schema...', true)); $this->out(__('Comparing Database to Schema...'));
$options = array(); $options = array();
if (isset($this->params['f'])) { if (isset($this->params['f'])) {
$options['models'] = false; $options['models'] = false;
@ -362,19 +362,19 @@ class SchemaShell extends Shell {
} }
if (empty($contents)) { if (empty($contents)) {
$this->out(__('Schema is up to date.', true)); $this->out(__('Schema is up to date.'));
$this->_stop(); $this->_stop();
} }
$this->out("\n" . __('The following statements will run.', true)); $this->out("\n" . __('The following statements will run.'));
$this->out(array_map('trim', $contents)); $this->out(array_map('trim', $contents));
if ('y' == $this->in(__('Are you sure you want to alter the tables?', true), array('y', 'n'), 'n')) { if ('y' == $this->in(__('Are you sure you want to alter the tables?'), array('y', 'n'), 'n')) {
$this->out(); $this->out();
$this->out(__('Updating Database...', true)); $this->out(__('Updating Database...'));
$this->__run($contents, 'update', $Schema); $this->__run($contents, 'update', $Schema);
} }
$this->out(__('End update.', true)); $this->out(__('End update.'));
} }
/** /**
@ -384,7 +384,7 @@ class SchemaShell extends Shell {
*/ */
function __run($contents, $event, &$Schema) { function __run($contents, $event, &$Schema) {
if (empty($contents)) { if (empty($contents)) {
$this->err(__('Sql could not be run', true)); $this->err(__('Sql could not be run'));
return; return;
} }
Configure::write('debug', 2); Configure::write('debug', 2);
@ -392,10 +392,10 @@ class SchemaShell extends Shell {
foreach ($contents as $table => $sql) { foreach ($contents as $table => $sql) {
if (empty($sql)) { if (empty($sql)) {
$this->out(sprintf(__('%s is up to date.', true), $table)); $this->out(sprintf(__('%s is up to date.'), $table));
} else { } else {
if ($this->__dry === true) { if ($this->__dry === true) {
$this->out(sprintf(__('Dry run for %s :', true), $table)); $this->out(sprintf(__('Dry run for %s :'), $table));
$this->out($sql); $this->out($sql);
} else { } else {
if (!$Schema->before(array($event => $table))) { if (!$Schema->before(array($event => $table))) {
@ -411,7 +411,7 @@ class SchemaShell extends Shell {
if (!empty($error)) { if (!empty($error)) {
$this->out($error); $this->out($error);
} else { } else {
$this->out(sprintf(__('%s updated.', true), $table)); $this->out(sprintf(__('%s updated.'), $table));
} }
} }
} }

View file

@ -408,7 +408,7 @@ class Shell extends Object {
* @param string $message An optional error message * @param string $message An optional error message
*/ */
public function error($title, $message = null) { public function error($title, $message = null) {
$this->err(sprintf(__('Error: %s', true), $title)); $this->err(sprintf(__('Error: %s'), $title));
if (!empty($message)) { if (!empty($message)) {
$this->err($message); $this->err($message);
@ -446,17 +446,17 @@ class Shell extends Object {
$path = str_replace(DS . DS, DS, $path); $path = str_replace(DS . DS, DS, $path);
$this->out(); $this->out();
$this->out(sprintf(__("Creating file %s", true), $path)); $this->out(sprintf(__('Creating file %s'), $path));
if (is_file($path) && $this->interactive === true) { if (is_file($path) && $this->interactive === true) {
$prompt = sprintf(__('File `%s` exists, overwrite?', true), $path); $prompt = sprintf(__('File `%s` exists, overwrite?'), $path);
$key = $this->in($prompt, array('y', 'n', 'q'), 'n'); $key = $this->in($prompt, array('y', 'n', 'q'), 'n');
if (strtolower($key) == 'q') { if (strtolower($key) == 'q') {
$this->out(__('Quitting.', true), 2); $this->out(__('Quitting.'), 2);
$this->_stop(); $this->_stop();
} elseif (strtolower($key) != 'y') { } elseif (strtolower($key) != 'y') {
$this->out(sprintf(__('Skip `%s`', true), $path), 2); $this->out(sprintf(__('Skip `%s`'), $path), 2);
return false; return false;
} }
} }
@ -467,10 +467,10 @@ class Shell extends Object {
if ($File = new File($path, true)) { if ($File = new File($path, true)) {
$data = $File->prepare($contents); $data = $File->prepare($contents);
$File->write($data); $File->write($data);
$this->out(sprintf(__('Wrote `%s`', true), $path)); $this->out(sprintf(__('Wrote `%s`'), $path));
return true; return true;
} else { } else {
$this->err(sprintf(__('Could not write to `%s`.', true), $path), 2); $this->err(sprintf(__('Could not write to `%s`.'), $path), 2);
return false; return false;
} }
} }

View file

@ -72,12 +72,12 @@ class ControllerTask extends BakeTask {
$actions = 'scaffold'; $actions = 'scaffold';
if (!empty($this->args[1]) && ($this->args[1] == 'public' || $this->args[1] == 'scaffold')) { if (!empty($this->args[1]) && ($this->args[1] == 'public' || $this->args[1] == 'scaffold')) {
$this->out(__('Baking basic crud methods for ', true) . $controller); $this->out(__('Baking basic crud methods for ') . $controller);
$actions = $this->bakeActions($controller); $actions = $this->bakeActions($controller);
} elseif (!empty($this->args[1]) && $this->args[1] == 'admin') { } elseif (!empty($this->args[1]) && $this->args[1] == 'admin') {
$admin = $this->Project->getPrefix(); $admin = $this->Project->getPrefix();
if ($admin) { if ($admin) {
$this->out(sprintf(__('Adding %s methods', true), $admin)); $this->out(sprintf(__('Adding %s methods'), $admin));
$actions = $this->bakeActions($controller, $admin); $actions = $this->bakeActions($controller, $admin);
} }
} }
@ -85,7 +85,7 @@ class ControllerTask extends BakeTask {
if (!empty($this->args[2]) && $this->args[2] == 'admin') { if (!empty($this->args[2]) && $this->args[2] == 'admin') {
$admin = $this->Project->getPrefix(); $admin = $this->Project->getPrefix();
if ($admin) { if ($admin) {
$this->out(sprintf(__('Adding %s methods', true), $admin)); $this->out(sprintf(__('Adding %s methods'), $admin));
$actions .= "\n" . $this->bakeActions($controller, $admin); $actions .= "\n" . $this->bakeActions($controller, $admin);
} }
} }
@ -129,7 +129,7 @@ class ControllerTask extends BakeTask {
function __interactive() { function __interactive() {
$this->interactive = true; $this->interactive = true;
$this->hr(); $this->hr();
$this->out(sprintf(__("Bake Controller\nPath: %s", true), $this->path)); $this->out(sprintf(__("Bake Controller\nPath: %s"), $this->path));
$this->hr(); $this->hr();
if (empty($this->connection)) { if (empty($this->connection)) {
@ -138,7 +138,7 @@ class ControllerTask extends BakeTask {
$controllerName = $this->getName(); $controllerName = $this->getName();
$this->hr(); $this->hr();
$this->out(sprintf(__('Baking %sController', true), $controllerName)); $this->out(sprintf(__('Baking %sController'), $controllerName));
$this->hr(); $this->hr();
$helpers = $components = array(); $helpers = $components = array();
@ -150,16 +150,16 @@ class ControllerTask extends BakeTask {
$controllerFile = strtolower(Inflector::underscore($controllerName)); $controllerFile = strtolower(Inflector::underscore($controllerName));
$question[] = __("Would you like to build your controller interactively?", true); $question[] = __("Would you like to build your controller interactively?");
if (file_exists($this->path . $controllerFile .'_controller.php')) { if (file_exists($this->path . $controllerFile .'_controller.php')) {
$question[] = sprintf(__("Warning: Choosing no will overwrite the %sController.", true), $controllerName); $question[] = sprintf(__("Warning: Choosing no will overwrite the %sController."), $controllerName);
} }
$doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y'); $doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y');
if (strtolower($doItInteractive) == 'y') { if (strtolower($doItInteractive) == 'y') {
$this->interactive = true; $this->interactive = true;
$useDynamicScaffold = $this->in( $useDynamicScaffold = $this->in(
__("Would you like to use dynamic scaffolding?", true), array('y','n'), 'n' __("Would you like to use dynamic scaffolding?"), array('y','n'), 'n'
); );
if (strtolower($useDynamicScaffold) == 'y') { if (strtolower($useDynamicScaffold) == 'y') {
@ -172,7 +172,7 @@ class ControllerTask extends BakeTask {
$components = $this->doComponents(); $components = $this->doComponents();
$wannaUseSession = $this->in( $wannaUseSession = $this->in(
__("Would you like to use Session flash messages?", true), array('y','n'), 'y' __("Would you like to use Session flash messages?"), array('y','n'), 'y'
); );
} }
} else { } else {
@ -189,7 +189,7 @@ class ControllerTask extends BakeTask {
if ($this->interactive === true) { if ($this->interactive === true) {
$this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components); $this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components);
$looksGood = $this->in(__('Look okay?', true), array('y','n'), 'y'); $looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
if (strtolower($looksGood) == 'y') { if (strtolower($looksGood) == 'y') {
$baked = $this->bake($controllerName, $actions, $helpers, $components); $baked = $this->bake($controllerName, $actions, $helpers, $components);
@ -213,17 +213,17 @@ class ControllerTask extends BakeTask {
function confirmController($controllerName, $useDynamicScaffold, $helpers, $components) { function confirmController($controllerName, $useDynamicScaffold, $helpers, $components) {
$this->out(); $this->out();
$this->hr(); $this->hr();
$this->out(__('The following controller will be created:', true)); $this->out(__('The following controller will be created:'));
$this->hr(); $this->hr();
$this->out(sprintf(__("Controller Name:\n\t%s", true), $controllerName)); $this->out(sprintf(__("Controller Name:\n\t%s"), $controllerName));
if (strtolower($useDynamicScaffold) == 'y') { if (strtolower($useDynamicScaffold) == 'y') {
$this->out("var \$scaffold;"); $this->out("var \$scaffold;");
} }
$properties = array( $properties = array(
'helpers' => __("Helpers:", true), 'helpers' => __('Helpers:'),
'components' => __('Components:', true), 'components' => __('Components:'),
); );
foreach ($properties as $var => $title) { foreach ($properties as $var => $title) {
@ -250,11 +250,11 @@ class ControllerTask extends BakeTask {
*/ */
function _askAboutMethods() { function _askAboutMethods() {
$wannaBakeCrud = $this->in( $wannaBakeCrud = $this->in(
__("Would you like to create some basic class methods \n(index(), add(), view(), edit())?", true), __("Would you like to create some basic class methods \n(index(), add(), view(), edit())?"),
array('y','n'), 'n' array('y','n'), 'n'
); );
$wannaBakeAdminCrud = $this->in( $wannaBakeAdminCrud = $this->in(
__("Would you like to create the basic class methods for admin routing?", true), __("Would you like to create the basic class methods for admin routing?"),
array('y','n'), 'n' array('y','n'), 'n'
); );
return array($wannaBakeCrud, $wannaBakeAdminCrud); return array($wannaBakeCrud, $wannaBakeAdminCrud);
@ -275,7 +275,7 @@ class ControllerTask extends BakeTask {
$modelImport = $this->plugin . '.' . $modelImport; $modelImport = $this->plugin . '.' . $modelImport;
} }
if (!App::import('Model', $modelImport)) { if (!App::import('Model', $modelImport)) {
$this->err(__('You must have a model for this class to build basic methods. Please try again.', true)); $this->err(__('You must have a model for this class to build basic methods. Please try again.'));
$this->_stop(); $this->_stop();
} }
@ -339,8 +339,8 @@ class ControllerTask extends BakeTask {
*/ */
function doHelpers() { function doHelpers() {
return $this->_doPropertyChoices( return $this->_doPropertyChoices(
__("Would you like this controller to use other helpers\nbesides HtmlHelper and FormHelper?", true), __("Would you like this controller to use other helpers\nbesides HtmlHelper and FormHelper?"),
__("Please provide a comma separated list of the other\nhelper names you'd like to use.\nExample: 'Ajax, Javascript, Time'", true) __("Please provide a comma separated list of the other\nhelper names you'd like to use.\nExample: 'Ajax, Javascript, Time'")
); );
} }
@ -351,8 +351,8 @@ class ControllerTask extends BakeTask {
*/ */
function doComponents() { function doComponents() {
return $this->_doPropertyChoices( return $this->_doPropertyChoices(
__("Would you like this controller to use any components?", true), __("Would you like this controller to use any components?"),
__("Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'", true) __("Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'")
); );
} }
@ -388,7 +388,7 @@ class ControllerTask extends BakeTask {
$this->__tables = $this->Model->getAllTables($useDbConfig); $this->__tables = $this->Model->getAllTables($useDbConfig);
if ($this->interactive == true) { if ($this->interactive == true) {
$this->out(__('Possible Controllers based on your current database:', true)); $this->out(__('Possible Controllers based on your current database:'));
$this->_controllerNames = array(); $this->_controllerNames = array();
$count = count($this->__tables); $count = count($this->__tables);
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
@ -411,15 +411,15 @@ class ControllerTask extends BakeTask {
$enteredController = ''; $enteredController = '';
while ($enteredController == '') { while ($enteredController == '') {
$enteredController = $this->in(__("Enter a number from the list above,\ntype in the name of another controller, or 'q' to exit", true), null, 'q'); $enteredController = $this->in(__("Enter a number from the list above,\ntype in the name of another controller, or 'q' to exit"), null, 'q');
if ($enteredController === 'q') { if ($enteredController === 'q') {
$this->out(__("Exit", true)); $this->out(__('Exit'));
$this->_stop(); $this->_stop();
} }
if ($enteredController == '' || intval($enteredController) > count($controllers)) { if ($enteredController == '' || intval($enteredController) > count($controllers)) {
$this->err(__("The Controller name you supplied was empty,\nor the number you selected was not an option. Please try again.", true)); $this->err(__("The Controller name you supplied was empty,\nor the number you selected was not an option. Please try again."));
$enteredController = ''; $enteredController = '';
} }
} }

View file

@ -358,7 +358,7 @@ class DbConfigTask extends Shell {
$connections = array_keys($configs); $connections = array_keys($configs);
if (count($connections) > 1) { if (count($connections) > 1) {
$useDbConfig = $this->in(__('Use Database Config', true) .':', $connections, 'default'); $useDbConfig = $this->in(__('Use Database Config') .':', $connections, 'default');
} }
return $useDbConfig; return $useDbConfig;
} }

View file

@ -104,11 +104,11 @@ class ExtractTask extends Shell {
$this->__paths = explode(',', $this->params['paths']); $this->__paths = explode(',', $this->params['paths']);
} else { } else {
$defaultPath = $this->params['working']; $defaultPath = $this->params['working'];
$message = sprintf(__("What is the full path you would like to extract?\nExample: %s\n[Q]uit [D]one", true), $this->params['root'] . DS . 'myapp'); $message = sprintf(__("What is the full path you would like to extract?\nExample: %s\n[Q]uit [D]one"), $this->params['root'] . DS . 'myapp');
while (true) { while (true) {
$response = $this->in($message, null, $defaultPath); $response = $this->in($message, null, $defaultPath);
if (strtoupper($response) === 'Q') { if (strtoupper($response) === 'Q') {
$this->out(__('Extract Aborted', true)); $this->out(__('Extract Aborted'));
$this->_stop(); $this->_stop();
} elseif (strtoupper($response) === 'D') { } elseif (strtoupper($response) === 'D') {
$this->out(); $this->out();
@ -117,7 +117,7 @@ class ExtractTask extends Shell {
$this->__paths[] = $response; $this->__paths[] = $response;
$defaultPath = 'D'; $defaultPath = 'D';
} else { } else {
$this->err(__('The directory path you supplied was not found. Please try again.', true)); $this->err(__('The directory path you supplied was not found. Please try again.'));
} }
$this->out(); $this->out();
} }
@ -126,17 +126,17 @@ class ExtractTask extends Shell {
if (isset($this->params['output'])) { if (isset($this->params['output'])) {
$this->__output = $this->params['output']; $this->__output = $this->params['output'];
} else { } else {
$message = sprintf(__("What is the full path you would like to output?\nExample: %s\n[Q]uit", true), $this->__paths[0] . DS . 'locale'); $message = sprintf(__("What is the full path you would like to output?\nExample: %s\n[Q]uit"), $this->__paths[0] . DS . 'locale');
while (true) { while (true) {
$response = $this->in($message, null, $this->__paths[0] . DS . 'locale'); $response = $this->in($message, null, $this->__paths[0] . DS . 'locale');
if (strtoupper($response) === 'Q') { if (strtoupper($response) === 'Q') {
$this->out(__('Extract Aborted', true)); $this->out(__('Extract Aborted'));
$this->_stop(); $this->_stop();
} elseif (is_dir($response)) { } elseif (is_dir($response)) {
$this->__output = $response . DS; $this->__output = $response . DS;
break; break;
} else { } else {
$this->err(__('The directory path you supplied was not found. Please try again.', true)); $this->err(__('The directory path you supplied was not found. Please try again.'));
} }
$this->out(); $this->out();
} }
@ -146,7 +146,7 @@ class ExtractTask extends Shell {
$this->__merge = !(strtolower($this->params['merge']) === 'no'); $this->__merge = !(strtolower($this->params['merge']) === 'no');
} else { } else {
$this->out(); $this->out();
$response = $this->in(sprintf(__('Would you like to merge all domains strings into the default.pot file?', true)), array('y', 'n'), 'n'); $response = $this->in(sprintf(__('Would you like to merge all domains strings into the default.pot file?')), array('y', 'n'), 'n');
$this->__merge = strtolower($response) === 'y'; $this->__merge = strtolower($response) === 'y';
} }
@ -165,13 +165,13 @@ class ExtractTask extends Shell {
function __extract() { function __extract() {
$this->out(); $this->out();
$this->out(); $this->out();
$this->out(__('Extracting...', true)); $this->out(__('Extracting...'));
$this->hr(); $this->hr();
$this->out(__('Paths:', true)); $this->out(__('Paths:'));
foreach ($this->__paths as $path) { foreach ($this->__paths as $path) {
$this->out(' ' . $path); $this->out(' ' . $path);
} }
$this->out(__('Output Directory: ', true) . $this->__output); $this->out(__('Output Directory: ') . $this->__output);
$this->hr(); $this->hr();
$this->__extractTokens(); $this->__extractTokens();
$this->__buildFiles(); $this->__buildFiles();
@ -179,7 +179,7 @@ class ExtractTask extends Shell {
$this->__paths = $this->__files = $this->__storage = array(); $this->__paths = $this->__files = $this->__storage = array();
$this->__strings = $this->__tokens = array(); $this->__strings = $this->__tokens = array();
$this->out(); $this->out();
$this->out(__('Done.', true)); $this->out(__('Done.'));
} }
/** /**
@ -188,25 +188,25 @@ class ExtractTask extends Shell {
* @return void * @return void
*/ */
public function help() { public function help() {
$this->out(__('CakePHP Language String Extraction:', true)); $this->out(__('CakePHP Language String Extraction:'));
$this->hr(); $this->hr();
$this->out(__('The Extract script generates .pot file(s) with translations', true)); $this->out(__('The Extract script generates .pot file(s) with translations'));
$this->out(__('By default the .pot file(s) will be place in the locale directory of -app', true)); $this->out(__('By default the .pot file(s) will be place in the locale directory of -app'));
$this->out(__('By default -app is ROOT/app', true)); $this->out(__('By default -app is ROOT/app'));
$this->hr(); $this->hr();
$this->out(__('Usage: cake i18n extract <command> <param1> <param2>...', true)); $this->out(__('Usage: cake i18n extract <command> <param1> <param2>...'));
$this->out(); $this->out();
$this->out(__('Params:', true)); $this->out(__('Params:'));
$this->out(__(' -app [path...]: directory where your application is located', true)); $this->out(__(' -app [path...]: directory where your application is located'));
$this->out(__(' -root [path...]: path to install', true)); $this->out(__(' -root [path...]: path to install'));
$this->out(__(' -core [path...]: path to cake directory', true)); $this->out(__(' -core [path...]: path to cake directory'));
$this->out(__(' -paths [comma separated list of paths, full path is needed]', true)); $this->out(__(' -paths [comma separated list of paths, full path is needed]'));
$this->out(__(' -merge [yes|no]: Merge all domains strings into the default.pot file', true)); $this->out(__(' -merge [yes|no]: Merge all domains strings into the default.pot file'));
$this->out(__(' -output [path...]: Full path to output directory', true)); $this->out(__(' -output [path...]: Full path to output directory'));
$this->out(__(' -files: [comma separated list of files, full path to file is needed]', true)); $this->out(__(' -files: [comma separated list of files, full path to file is needed]'));
$this->out(); $this->out();
$this->out(__('Commands:', true)); $this->out(__('Commands:'));
$this->out(__(' cake i18n extract help: Shows this help message.', true)); $this->out(__(' cake i18n extract help: Shows this help message.'));
$this->out(); $this->out();
} }
@ -219,7 +219,7 @@ class ExtractTask extends Shell {
function __extractTokens() { function __extractTokens() {
foreach ($this->__files as $file) { foreach ($this->__files as $file) {
$this->__file = $file; $this->__file = $file;
$this->out(sprintf(__('Processing %s...', true), $file)); $this->out(sprintf(__('Processing %s...'), $file));
$code = file_get_contents($file); $code = file_get_contents($file);
$allTokens = token_get_all($code); $allTokens = token_get_all($code);
@ -382,11 +382,11 @@ class ExtractTask extends Shell {
$response = ''; $response = '';
while ($overwriteAll === false && $File->exists() && strtoupper($response) !== 'Y') { while ($overwriteAll === false && $File->exists() && strtoupper($response) !== 'Y') {
$this->out(); $this->out();
$response = $this->in(sprintf(__('Error: %s already exists in this location. Overwrite? [Y]es, [N]o, [A]ll', true), $filename), array('y', 'n', 'a'), 'y'); $response = $this->in(sprintf(__('Error: %s already exists in this location. Overwrite? [Y]es, [N]o, [A]ll'), $filename), array('y', 'n', 'a'), 'y');
if (strtoupper($response) === 'N') { if (strtoupper($response) === 'N') {
$response = ''; $response = '';
while ($response == '') { while ($response == '') {
$response = $this->in(sprintf(__("What would you like to name this file?\nExample: %s", true), 'new_' . $filename), null, 'new_' . $filename); $response = $this->in(sprintf(__("What would you like to name this file?\nExample: %s"), 'new_' . $filename), null, 'new_' . $filename);
$File = new File($this->__output . $response); $File = new File($this->__output . $response);
$filename = $response; $filename = $response;
} }
@ -454,7 +454,7 @@ class ExtractTask extends Shell {
* @access private * @access private
*/ */
function __markerError($file, $line, $marker, $count) { function __markerError($file, $line, $marker, $count) {
$this->out(sprintf(__("Invalid marker content in %s:%s\n* %s(", true), $file, $line, $marker), true); $this->out(sprintf(__("Invalid marker content in %s:%s\n* %s("), $file, $line, $marker), true);
$count += 2; $count += 2;
$tokenCount = count($this->__tokens); $tokenCount = count($this->__tokens);
$parenthesis = 1; $parenthesis = 1;

View file

@ -127,16 +127,16 @@ class FixtureTask extends BakeTask {
*/ */
public function importOptions($modelName) { public function importOptions($modelName) {
$options = array(); $options = array();
$doSchema = $this->in(__('Would you like to import schema for this fixture?', true), array('y', 'n'), 'n'); $doSchema = $this->in(__('Would you like to import schema for this fixture?'), array('y', 'n'), 'n');
if ($doSchema == 'y') { if ($doSchema == 'y') {
$options['schema'] = $modelName; $options['schema'] = $modelName;
} }
$doRecords = $this->in(__('Would you like to use record importing for this fixture?', true), array('y', 'n'), 'n'); $doRecords = $this->in(__('Would you like to use record importing for this fixture?'), array('y', 'n'), 'n');
if ($doRecords == 'y') { if ($doRecords == 'y') {
$options['records'] = true; $options['records'] = true;
} }
if ($doRecords == 'n') { if ($doRecords == 'n') {
$prompt = sprintf(__("Would you like to build this fixture with data from %s's table?", true), $modelName); $prompt = sprintf(__("Would you like to build this fixture with data from %s's table?"), $modelName);
$fromTable = $this->in($prompt, array('y', 'n'), 'n'); $fromTable = $this->in($prompt, array('y', 'n'), 'n');
if (strtolower($fromTable) == 'y') { if (strtolower($fromTable) == 'y') {
$options['fromTable'] = true; $options['fromTable'] = true;
@ -356,7 +356,7 @@ class FixtureTask extends BakeTask {
protected function _getRecordsFromTable($modelName, $useTable = null) { protected function _getRecordsFromTable($modelName, $useTable = null) {
if ($this->interactive) { if ($this->interactive) {
$condition = null; $condition = null;
$prompt = __("Please provide a SQL fragment to use as conditions\nExample: WHERE 1=1 LIMIT 10", true); $prompt = __("Please provide a SQL fragment to use as conditions\nExample: WHERE 1=1 LIMIT 10");
while (!$condition) { while (!$condition) {
$condition = $this->in($prompt, null, 'WHERE 1=1 LIMIT 10'); $condition = $this->in($prompt, null, 'WHERE 1=1 LIMIT 10');
} }

View file

@ -111,7 +111,7 @@ class ModelTask extends BakeTask {
continue; continue;
} }
$modelClass = Inflector::classify($table); $modelClass = Inflector::classify($table);
$this->out(sprintf(__('Baking %s', true), $modelClass)); $this->out(sprintf(__('Baking %s'), $modelClass));
$object = $this->_getModelObject($modelClass); $object = $this->_getModelObject($modelClass);
if ($this->bake($object, false) && $unitTestExists) { if ($this->bake($object, false) && $unitTestExists) {
$this->bakeFixture($modelClass); $this->bakeFixture($modelClass);
@ -150,7 +150,7 @@ class ModelTask extends BakeTask {
$this->out($i + 1 .'. ' . $option); $this->out($i + 1 .'. ' . $option);
} }
if (empty($prompt)) { if (empty($prompt)) {
$prompt = __('Make a selection from the choices above', true); $prompt = __('Make a selection from the choices above');
} }
$choice = $this->in($prompt, null, $default); $choice = $this->in($prompt, null, $default);
if (intval($choice) > 0 && intval($choice) <= $max) { if (intval($choice) > 0 && intval($choice) <= $max) {
@ -189,7 +189,7 @@ class ModelTask extends BakeTask {
$primaryKey = $this->findPrimaryKey($fields); $primaryKey = $this->findPrimaryKey($fields);
} }
} else { } else {
$this->err(sprintf(__('Table %s does not exist, cannot bake a model without a table.', true), $useTable)); $this->err(sprintf(__('Table %s does not exist, cannot bake a model without a table.'), $useTable));
$this->_stop(); $this->_stop();
return false; return false;
} }
@ -198,13 +198,13 @@ class ModelTask extends BakeTask {
$displayField = $this->findDisplayField($tempModel->schema()); $displayField = $this->findDisplayField($tempModel->schema());
} }
$prompt = __("Would you like to supply validation criteria \nfor the fields in your model?", true); $prompt = __("Would you like to supply validation criteria \nfor the fields in your model?");
$wannaDoValidation = $this->in($prompt, array('y','n'), 'y'); $wannaDoValidation = $this->in($prompt, array('y','n'), 'y');
if (array_search($useTable, $this->_tables) !== false && strtolower($wannaDoValidation) == 'y') { if (array_search($useTable, $this->_tables) !== false && strtolower($wannaDoValidation) == 'y') {
$validate = $this->doValidation($tempModel); $validate = $this->doValidation($tempModel);
} }
$prompt = __("Would you like to define model associations\n(hasMany, hasOne, belongsTo, etc.)?", true); $prompt = __("Would you like to define model associations\n(hasMany, hasOne, belongsTo, etc.)?");
$wannaDoAssoc = $this->in($prompt, array('y','n'), 'y'); $wannaDoAssoc = $this->in($prompt, array('y','n'), 'y');
if (strtolower($wannaDoAssoc) == 'y') { if (strtolower($wannaDoAssoc) == 'y') {
$associations = $this->doAssociations($tempModel); $associations = $this->doAssociations($tempModel);
@ -212,24 +212,24 @@ class ModelTask extends BakeTask {
$this->out(); $this->out();
$this->hr(); $this->hr();
$this->out(__('The following Model will be created:', true)); $this->out(__('The following Model will be created:'));
$this->hr(); $this->hr();
$this->out("Name: " . $currentModelName); $this->out("Name: " . $currentModelName);
if ($this->connection !== 'default') { if ($this->connection !== 'default') {
$this->out(sprintf(__("DB Config: %s", true), $this->connection)); $this->out(sprintf(__("DB Config: %s"), $this->connection));
} }
if ($fullTableName !== Inflector::tableize($currentModelName)) { if ($fullTableName !== Inflector::tableize($currentModelName)) {
$this->out(sprintf(__("DB Table: %s", true), $fullTableName)); $this->out(sprintf(__('DB Table: %s'), $fullTableName));
} }
if ($primaryKey != 'id') { if ($primaryKey != 'id') {
$this->out(sprintf(__("Primary Key: %s", true), $primaryKey)); $this->out(sprintf(__('Primary Key: %s'), $primaryKey));
} }
if (!empty($validate)) { if (!empty($validate)) {
$this->out(sprintf(__("Validation: %s", true), print_r($validate, true))); $this->out(sprintf(__('Validation: %s'), print_r($validate, true)));
} }
if (!empty($associations)) { if (!empty($associations)) {
$this->out(__("Associations:", true)); $this->out(__('Associations:'));
$assocKeys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'); $assocKeys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
foreach ($assocKeys as $assocKey) { foreach ($assocKeys as $assocKey) {
$this->_printAssociation($currentModelName, $assocKey, $associations); $this->_printAssociation($currentModelName, $assocKey, $associations);
@ -237,7 +237,7 @@ class ModelTask extends BakeTask {
} }
$this->hr(); $this->hr();
$looksGood = $this->in(__('Look okay?', true), array('y','n'), 'y'); $looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
if (strtolower($looksGood) == 'y') { if (strtolower($looksGood) == 'y') {
$vars = compact('associations', 'validate', 'primaryKey', 'useTable', 'displayField'); $vars = compact('associations', 'validate', 'primaryKey', 'useTable', 'displayField');
@ -283,7 +283,7 @@ class ModelTask extends BakeTask {
break; break;
} }
} }
return $this->in(__('What is the primaryKey?', true), null, $name); return $this->in(__('What is the primaryKey?'), null, $name);
} }
/** /**
@ -294,12 +294,12 @@ class ModelTask extends BakeTask {
*/ */
function findDisplayField($fields) { function findDisplayField($fields) {
$fieldNames = array_keys($fields); $fieldNames = array_keys($fields);
$prompt = __("A displayField could not be automatically detected\nwould you like to choose one?", true); $prompt = __("A displayField could not be automatically detected\nwould you like to choose one?");
$continue = $this->in($prompt, array('y', 'n')); $continue = $this->in($prompt, array('y', 'n'));
if (strtolower($continue) == 'n') { if (strtolower($continue) == 'n') {
return false; return false;
} }
$prompt = __('Choose a field from the options above:', true); $prompt = __('Choose a field from the options above:');
$choice = $this->inOptions($fieldNames, $prompt); $choice = $this->inOptions($fieldNames, $prompt);
return $fieldNames[$choice]; return $fieldNames[$choice];
} }
@ -369,10 +369,10 @@ class ModelTask extends BakeTask {
while ($anotherValidator == 'y') { while ($anotherValidator == 'y') {
if ($this->interactive) { if ($this->interactive) {
$this->out(); $this->out();
$this->out(sprintf(__('Field: %s', true), $fieldName)); $this->out(sprintf(__('Field: %s'), $fieldName));
$this->out(sprintf(__('Type: %s', true), $metaData['type'])); $this->out(sprintf(__('Type: %s'), $metaData['type']));
$this->hr(); $this->hr();
$this->out(__('Please select one of the following validation options:', true)); $this->out(__('Please select one of the following validation options:'));
$this->hr(); $this->hr();
} }
@ -380,8 +380,8 @@ class ModelTask extends BakeTask {
for ($i = 1; $i < $defaultChoice; $i++) { for ($i = 1; $i < $defaultChoice; $i++) {
$prompt .= $i . ' - ' . $this->_validations[$i] . "\n"; $prompt .= $i . ' - ' . $this->_validations[$i] . "\n";
} }
$prompt .= sprintf(__("%s - Do not do any validation on this field.\n", true), $defaultChoice); $prompt .= sprintf(__("%s - Do not do any validation on this field.\n"), $defaultChoice);
$prompt .= __("... or enter in a valid regex validation string.\n", true); $prompt .= __("... or enter in a valid regex validation string.\n");
$methods = array_flip($this->_validations); $methods = array_flip($this->_validations);
$guess = $defaultChoice; $guess = $defaultChoice;
@ -404,11 +404,11 @@ class ModelTask extends BakeTask {
if ($this->interactive === true) { if ($this->interactive === true) {
$choice = $this->in($prompt, null, $guess); $choice = $this->in($prompt, null, $guess);
if (in_array($choice, $alreadyChosen)) { if (in_array($choice, $alreadyChosen)) {
$this->out(__("You have already chosen that validation rule,\nplease choose again", true)); $this->out(__("You have already chosen that validation rule,\nplease choose again"));
continue; continue;
} }
if (!isset($this->_validations[$choice]) && is_numeric($choice)) { if (!isset($this->_validations[$choice]) && is_numeric($choice)) {
$this->out(__('Please make a valid selection.', true)); $this->out(__('Please make a valid selection.'));
continue; continue;
} }
$alreadyChosen[] = $choice; $alreadyChosen[] = $choice;
@ -430,7 +430,7 @@ class ModelTask extends BakeTask {
} }
} }
if ($this->interactive == true && $choice != $defaultChoice) { if ($this->interactive == true && $choice != $defaultChoice) {
$anotherValidator = $this->in(__('Would you like to add another validation rule?', true), array('y', 'n'), 'n'); $anotherValidator = $this->in(__('Would you like to add another validation rule?'), array('y', 'n'), 'n');
} else { } else {
$anotherValidator = 'n'; $anotherValidator = 'n';
} }
@ -449,7 +449,7 @@ class ModelTask extends BakeTask {
return false; return false;
} }
if ($this->interactive === true) { if ($this->interactive === true) {
$this->out(__('One moment while the associations are detected.', true)); $this->out(__('One moment while the associations are detected.'));
} }
$fields = $model->schema(true); $fields = $model->schema(true);
@ -477,9 +477,9 @@ class ModelTask extends BakeTask {
if ($this->interactive === true) { if ($this->interactive === true) {
$this->hr(); $this->hr();
if (empty($associations)) { if (empty($associations)) {
$this->out(__('None found.', true)); $this->out(__('None found.'));
} else { } else {
$this->out(__('Please confirm the following associations:', true)); $this->out(__('Please confirm the following associations:'));
$this->hr(); $this->hr();
$associations = $this->confirmAssociations($model, $associations); $associations = $this->confirmAssociations($model, $associations);
} }
@ -636,19 +636,19 @@ class ModelTask extends BakeTask {
* @return array Array of associations. * @return array Array of associations.
*/ */
function doMoreAssociations($model, $associations) { function doMoreAssociations($model, $associations) {
$prompt = __('Would you like to define some additional model associations?', true); $prompt = __('Would you like to define some additional model associations?');
$wannaDoMoreAssoc = $this->in($prompt, array('y','n'), 'n'); $wannaDoMoreAssoc = $this->in($prompt, array('y','n'), 'n');
$possibleKeys = $this->_generatePossibleKeys(); $possibleKeys = $this->_generatePossibleKeys();
while (strtolower($wannaDoMoreAssoc) == 'y') { while (strtolower($wannaDoMoreAssoc) == 'y') {
$assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'); $assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
$this->out(__('What is the association type?', true)); $this->out(__('What is the association type?'));
$assocType = intval($this->inOptions($assocs, __('Enter a number',true))); $assocType = intval($this->inOptions($assocs, __('Enter a number')));
$this->out(__("For the following options be very careful to match your setup exactly.\nAny spelling mistakes will cause errors.", true)); $this->out(__("For the following options be very careful to match your setup exactly.\nAny spelling mistakes will cause errors."));
$this->hr(); $this->hr();
$alias = $this->in(__('What is the alias for this association?', true)); $alias = $this->in(__('What is the alias for this association?'));
$className = $this->in(sprintf(__('What className will %s use?', true), $alias), null, $alias ); $className = $this->in(sprintf(__('What className will %s use?'), $alias), null, $alias );
$suggestedForeignKey = null; $suggestedForeignKey = null;
if ($assocType == 0) { if ($assocType == 0) {
@ -663,22 +663,22 @@ class ModelTask extends BakeTask {
$showKeys = null; $showKeys = null;
} }
} else { } else {
$otherTable = $this->in(__('What is the table for this model?', true)); $otherTable = $this->in(__('What is the table for this model?'));
$showKeys = $possibleKeys[$otherTable]; $showKeys = $possibleKeys[$otherTable];
} }
$suggestedForeignKey = $this->_modelKey($model->name); $suggestedForeignKey = $this->_modelKey($model->name);
} }
if (!empty($showKeys)) { if (!empty($showKeys)) {
$this->out(__('A helpful List of possible keys', true)); $this->out(__('A helpful List of possible keys'));
$foreignKey = $this->inOptions($showKeys, __('What is the foreignKey?', true)); $foreignKey = $this->inOptions($showKeys, __('What is the foreignKey?'));
$foreignKey = $showKeys[intval($foreignKey)]; $foreignKey = $showKeys[intval($foreignKey)];
} }
if (!isset($foreignKey)) { if (!isset($foreignKey)) {
$foreignKey = $this->in(__('What is the foreignKey? Specify your own.', true), null, $suggestedForeignKey); $foreignKey = $this->in(__('What is the foreignKey? Specify your own.'), null, $suggestedForeignKey);
} }
if ($assocType == 3) { if ($assocType == 3) {
$associationForeignKey = $this->in(__('What is the associationForeignKey?', true), null, $this->_modelKey($model->name)); $associationForeignKey = $this->in(__('What is the associationForeignKey?'), null, $this->_modelKey($model->name));
$joinTable = $this->in(__('What is the joinTable?', true)); $joinTable = $this->in(__('What is the joinTable?'));
} }
$associations[$assocs[$assocType]] = array_values((array)$associations[$assocs[$assocType]]); $associations[$assocs[$assocType]] = array_values((array)$associations[$assocs[$assocType]]);
$count = count($associations[$assocs[$assocType]]); $count = count($associations[$assocs[$assocType]]);
@ -690,7 +690,7 @@ class ModelTask extends BakeTask {
$associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey; $associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey;
$associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable; $associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable;
} }
$wannaDoMoreAssoc = $this->in(__('Define another association?', true), array('y','n'), 'y'); $wannaDoMoreAssoc = $this->in(__('Define another association?'), array('y','n'), 'y');
} }
return $associations; return $associations;
} }
@ -773,7 +773,7 @@ class ModelTask extends BakeTask {
$this->_tables = $this->getAllTables($useDbConfig); $this->_tables = $this->getAllTables($useDbConfig);
if ($this->interactive === true) { if ($this->interactive === true) {
$this->out(__('Possible Models based on your current database:', true)); $this->out(__('Possible Models based on your current database:'));
$this->_modelNames = array(); $this->_modelNames = array();
$count = count($this->_tables); $count = count($this->_tables);
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
@ -804,11 +804,11 @@ class ModelTask extends BakeTask {
if (array_search($useTable, $this->_tables) === false) { if (array_search($useTable, $this->_tables) === false) {
$this->out(); $this->out();
$this->out(sprintf(__("Given your model named '%s',\nCake would expect a database table named '%s'", true), $modelName, $fullTableName)); $this->out(sprintf(__("Given your model named '%s',\nCake would expect a database table named '%s'"), $modelName, $fullTableName));
$tableIsGood = $this->in(__('Do you want to use this table?', true), array('y','n'), 'y'); $tableIsGood = $this->in(__('Do you want to use this table?'), array('y','n'), 'y');
} }
if (strtolower($tableIsGood) == 'n') { if (strtolower($tableIsGood) == 'n') {
$useTable = $this->in(__('What is the name of the table?', true)); $useTable = $this->in(__('What is the name of the table?'));
} }
return $useTable; return $useTable;
} }
@ -840,7 +840,7 @@ class ModelTask extends BakeTask {
$tables = $db->listSources(); $tables = $db->listSources();
} }
if (empty($tables)) { if (empty($tables)) {
$this->err(__('Your database does not have any tables.', true)); $this->err(__('Your database does not have any tables.'));
$this->_stop(); $this->_stop();
} }
return $tables; return $tables;
@ -857,15 +857,15 @@ class ModelTask extends BakeTask {
$enteredModel = ''; $enteredModel = '';
while ($enteredModel == '') { while ($enteredModel == '') {
$enteredModel = $this->in(__("Enter a number from the list above,\ntype in the name of another model, or 'q' to exit", true), null, 'q'); $enteredModel = $this->in(__("Enter a number from the list above,\ntype in the name of another model, or 'q' to exit"), null, 'q');
if ($enteredModel === 'q') { if ($enteredModel === 'q') {
$this->out(__("Exit", true)); $this->out(__('Exit'));
$this->_stop(); $this->_stop();
} }
if ($enteredModel == '' || intval($enteredModel) > count($this->_modelNames)) { if ($enteredModel == '' || intval($enteredModel) > count($this->_modelNames)) {
$this->err(__("The model name you supplied was empty,\nor the number you selected was not an option. Please try again.", true)); $this->err(__("The model name you supplied was empty,\nor the number you selected was not an option. Please try again."));
$enteredModel = ''; $enteredModel = '';
} }
} }

View file

@ -68,10 +68,10 @@ class PluginTask extends Shell {
$pluginPath = $this->_pluginPath($plugin); $pluginPath = $this->_pluginPath($plugin);
$this->Dispatch->shiftArgs(); $this->Dispatch->shiftArgs();
if (is_dir($pluginPath)) { if (is_dir($pluginPath)) {
$this->out(sprintf(__('Plugin: %s', true), $plugin)); $this->out(sprintf(__('Plugin: %s'), $plugin));
$this->out(sprintf(__('Path: %s', true), $pluginPath)); $this->out(sprintf(__('Path: %s'), $pluginPath));
} elseif (isset($this->args[0])) { } elseif (isset($this->args[0])) {
$this->err(sprintf(__('%s in path %s not found.', true), $plugin, $pluginPath)); $this->err(sprintf(__('%s in path %s not found.'), $plugin, $pluginPath));
$this->_stop(); $this->_stop();
} else { } else {
$this->__interactive($plugin); $this->__interactive($plugin);
@ -88,7 +88,7 @@ class PluginTask extends Shell {
$this->{$task}->path = $pluginPath . Inflector::underscore(Inflector::pluralize($task)) . DS; $this->{$task}->path = $pluginPath . Inflector::underscore(Inflector::pluralize($task)) . DS;
if (!is_dir($this->{$task}->path)) { if (!is_dir($this->{$task}->path)) {
$this->err(sprintf(__("%s directory could not be found.\nBe sure you have created %s", true), $task, $this->{$task}->path)); $this->err(sprintf(__("%s directory could not be found.\nBe sure you have created %s"), $task, $this->{$task}->path));
} }
$this->{$task}->loadTasks(); $this->{$task}->loadTasks();
return $this->{$task}->execute(); return $this->{$task}->execute();
@ -104,11 +104,11 @@ class PluginTask extends Shell {
*/ */
function __interactive($plugin = null) { function __interactive($plugin = null) {
while ($plugin === null) { while ($plugin === null) {
$plugin = $this->in(__('Enter the name of the plugin in CamelCase format', true)); $plugin = $this->in(__('Enter the name of the plugin in CamelCase format'));
} }
if (!$this->bake($plugin)) { if (!$this->bake($plugin)) {
$this->err(sprintf(__("An error occured trying to bake: %s in %s", true), $plugin, $this->path . Inflector::underscore($pluginPath))); $this->err(sprintf(__("An error occured trying to bake: %s in %s"), $plugin, $this->path . Inflector::underscore($pluginPath)));
} }
} }
@ -127,14 +127,14 @@ class PluginTask extends Shell {
$this->findPath($pathOptions); $this->findPath($pathOptions);
} }
$this->hr(); $this->hr();
$this->out(sprintf(__("Plugin Name: %s", true), $plugin)); $this->out(sprintf(__("Plugin Name: %s"), $plugin));
$this->out(sprintf(__("Plugin Directory: %s", true), $this->path . $pluginPath)); $this->out(sprintf(__("Plugin Directory: %s"), $this->path . $pluginPath));
$this->hr(); $this->hr();
$looksGood = $this->in(__('Look okay?', true), array('y', 'n', 'q'), 'y'); $looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
if (strtolower($looksGood) == 'y') { if (strtolower($looksGood) == 'y') {
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n'); $verbose = $this->in(__('Do you want verbose output?'), array('y', 'n'), 'n');
$Folder =& new Folder($this->path . $pluginPath); $Folder =& new Folder($this->path . $pluginPath);
$directories = array( $directories = array(
@ -190,7 +190,7 @@ class PluginTask extends Shell {
$this->createFile($this->path . $pluginPath . DS . $modelFileName, $out); $this->createFile($this->path . $pluginPath . DS . $modelFileName, $out);
$this->hr(); $this->hr();
$this->out(sprintf(__("Created: %s in %s", true), $plugin, $this->path . $pluginPath)); $this->out(sprintf(__('Created: %s in %s'), $plugin, $this->path . $pluginPath));
$this->hr(); $this->hr();
} }
@ -209,7 +209,7 @@ class PluginTask extends Shell {
foreach ($pathOptions as $i => $option) { foreach ($pathOptions as $i => $option) {
$this->out($i + 1 .'. ' . $option); $this->out($i + 1 .'. ' . $option);
} }
$prompt = __('Choose a plugin path from the paths above.', true); $prompt = __('Choose a plugin path from the paths above.');
$choice = $this->in($prompt); $choice = $this->in($prompt);
if (intval($choice) > 0 && intval($choice) <= $max) { if (intval($choice) > 0 && intval($choice) <= $max) {
$valid = true; $valid = true;

View file

@ -59,7 +59,7 @@ class ProjectTask extends Shell {
} }
while (!$project) { while (!$project) {
$prompt = __("What is the full path for this app including the app directory name?\n Example:", true); $prompt = __("What is the full path for this app including the app directory name?\n Example:");
$default = $this->params['working'] . DS . 'myapp'; $default = $this->params['working'] . DS . 'myapp';
$project = $this->in($prompt . $default, null, $default); $project = $this->in($prompt . $default, null, $default);
} }
@ -67,7 +67,7 @@ class ProjectTask extends Shell {
if ($project) { if ($project) {
$response = false; $response = false;
while ($response == false && is_dir($project) === true && file_exists($project . 'config' . 'core.php')) { while ($response == false && is_dir($project) === true && file_exists($project . 'config' . 'core.php')) {
$prompt = sprintf(__('A project already exists in this location: %s Overwrite?', true), $project); $prompt = sprintf(__('A project already exists in this location: %s Overwrite?'), $project);
$response = $this->in($prompt, array('y','n'), 'n'); $response = $this->in($prompt, array('y','n'), 'n');
if (strtolower($response) === 'n') { if (strtolower($response) === 'n') {
$response = $project = false; $response = $project = false;
@ -78,35 +78,35 @@ class ProjectTask extends Shell {
if ($this->bake($project)) { if ($this->bake($project)) {
$path = Folder::slashTerm($project); $path = Folder::slashTerm($project);
if ($this->createHome($path)) { if ($this->createHome($path)) {
$this->out(__('Welcome page created', true)); $this->out(__('Welcome page created'));
} else { } else {
$this->out(__('The Welcome page was NOT created', true)); $this->out(__('The Welcome page was NOT created'));
} }
if ($this->securitySalt($path) === true ) { if ($this->securitySalt($path) === true ) {
$this->out(__('Random hash key created for \'Security.salt\'', true)); $this->out(__('Random hash key created for \'Security.salt\''));
} else { } else {
$this->err(sprintf(__('Unable to generate random hash for \'Security.salt\', you should change it in %s', true), CONFIGS . 'core.php')); $this->err(sprintf(__('Unable to generate random hash for \'Security.salt\', you should change it in %s'), CONFIGS . 'core.php'));
} }
if ($this->securityCipherSeed($path) === true ) { if ($this->securityCipherSeed($path) === true ) {
$this->out(__('Random seed created for \'Security.cipherSeed\'', true)); $this->out(__('Random seed created for \'Security.cipherSeed\''));
} else { } else {
$this->err(sprintf(__('Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', true), CONFIGS . 'core.php')); $this->err(sprintf(__('Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s'), CONFIGS . 'core.php'));
} }
$corePath = $this->corePath($path); $corePath = $this->corePath($path);
if ($corePath === true ) { if ($corePath === true ) {
$this->out(sprintf(__('CAKE_CORE_INCLUDE_PATH set to %s in webroot/index.php', true), CAKE_CORE_INCLUDE_PATH)); $this->out(sprintf(__('CAKE_CORE_INCLUDE_PATH set to %s in webroot/index.php'), CAKE_CORE_INCLUDE_PATH));
$this->out(sprintf(__('CAKE_CORE_INCLUDE_PATH set to %s in webroot/test.php', true), CAKE_CORE_INCLUDE_PATH)); $this->out(sprintf(__('CAKE_CORE_INCLUDE_PATH set to %s in webroot/test.php'), CAKE_CORE_INCLUDE_PATH));
$this->out(__('Remember to check these value after moving to production server', true)); $this->out(__('Remember to check these value after moving to production server'));
} elseif ($corePath === false) { } elseif ($corePath === false) {
$this->err(sprintf(__('Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', true), $path . 'webroot' .DS .'index.php')); $this->err(sprintf(__('Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s'), $path . 'webroot' .DS .'index.php'));
} }
$Folder = new Folder($path); $Folder = new Folder($path);
if (!$Folder->chmod($path . 'tmp', 0777)) { if (!$Folder->chmod($path . 'tmp', 0777)) {
$this->err(sprintf(__('Could not set permissions on %s', true), $path . DS .'tmp')); $this->err(sprintf(__('Could not set permissions on %s'), $path . DS .'tmp'));
$this->out(sprintf(__('chmod -R 0777 %s', true), $path . DS .'tmp')); $this->out(sprintf(__('chmod -R 0777 %s'), $path . DS .'tmp'));
} }
$this->params['working'] = $path; $this->params['working'] = $path;
@ -133,25 +133,25 @@ class ProjectTask extends Shell {
while (!$skel) { while (!$skel) {
$skel = $this->in(sprintf(__("What is the path to the directory layout you wish to copy?\nExample: %s"), APP, null, ROOT . DS . 'myapp' . DS)); $skel = $this->in(sprintf(__("What is the path to the directory layout you wish to copy?\nExample: %s"), APP, null, ROOT . DS . 'myapp' . DS));
if ($skel == '') { if ($skel == '') {
$this->out(__('The directory path you supplied was empty. Please try again.', true)); $this->out(__('The directory path you supplied was empty. Please try again.'));
} else { } else {
while (is_dir($skel) === false) { while (is_dir($skel) === false) {
$skel = $this->in(__('Directory path does not exist please choose another:', true)); $skel = $this->in(__('Directory path does not exist please choose another:'));
} }
} }
} }
$app = basename($path); $app = basename($path);
$this->out(__('Bake Project', true)); $this->out(__('Bake Project'));
$this->out(__("Skel Directory: ", true) . $skel); $this->out(__('Skel Directory: ') . $skel);
$this->out(__("Will be copied to: ", true) . $path); $this->out(__('Will be copied to: ') . $path);
$this->hr(); $this->hr();
$looksGood = $this->in(__('Look okay?', true), array('y', 'n', 'q'), 'y'); $looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
if (strtolower($looksGood) == 'y') { if (strtolower($looksGood) == 'y') {
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n'); $verbose = $this->in(__('Do you want verbose output?'), array('y', 'n'), 'n');
$Folder = new Folder($skel); $Folder = new Folder($skel);
if (!empty($this->params['empty'])) { if (!empty($this->params['empty'])) {
@ -159,10 +159,10 @@ class ProjectTask extends Shell {
} }
if ($Folder->copy(array('to' => $path, 'skip' => $skip))) { if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
$this->hr(); $this->hr();
$this->out(sprintf(__("Created: %s in %s", true), $app, $path)); $this->out(sprintf(__('Created: %s in %s'), $app, $path));
$this->hr(); $this->hr();
} else { } else {
$this->err(sprintf(__(" '%s' could not be created properly", true), $app)); $this->err(sprintf(__(" '%s' could not be created properly"), $app));
return false; return false;
} }
@ -174,7 +174,7 @@ class ProjectTask extends Shell {
return true; return true;
} elseif (strtolower($looksGood) == 'q') { } elseif (strtolower($looksGood) == 'q') {
$this->out(__('Bake Aborted.', true)); $this->out(__('Bake Aborted.'));
} else { } else {
$this->execute(false); $this->execute(false);
return false; return false;
@ -312,7 +312,7 @@ class ProjectTask extends Shell {
} }
if ($this->interactive) { if ($this->interactive) {
$this->out(); $this->out();
$this->out(__('You have more than one routing prefix configured', true)); $this->out(__('You have more than one routing prefix configured'));
} }
$options = array(); $options = array();
foreach ($prefixes as $i => $prefix) { foreach ($prefixes as $i => $prefix) {
@ -321,19 +321,19 @@ class ProjectTask extends Shell {
$this->out($i + 1 . '. ' . $prefix); $this->out($i + 1 . '. ' . $prefix);
} }
} }
$selection = $this->in(__('Please choose a prefix to bake with.', true), $options, 1); $selection = $this->in(__('Please choose a prefix to bake with.'), $options, 1);
return $prefixes[$selection - 1] . '_'; return $prefixes[$selection - 1] . '_';
} }
if ($this->interactive) { if ($this->interactive) {
$this->hr(); $this->hr();
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.'); $this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
$this->out(__('What would you like the prefix route to be?', true)); $this->out(__('What would you like the prefix route to be?'));
$this->out(__('Example: www.example.com/admin/controller', true)); $this->out(__('Example: www.example.com/admin/controller'));
while ($admin == '') { while ($admin == '') {
$admin = $this->in(__("Enter a routing prefix:", true), null, 'admin'); $admin = $this->in(__('Enter a routing prefix:'), null, 'admin');
} }
if ($this->cakeAdmin($admin) !== true) { if ($this->cakeAdmin($admin) !== true) {
$this->out(__('Unable to write to /app/config/core.php.', true)); $this->out(__('Unable to write to /app/config/core.php.'));
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.'); $this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
$this->_stop(); $this->_stop();
} }

View file

@ -167,8 +167,8 @@ class TemplateTask extends Shell {
} }
$this->hr(); $this->hr();
$this->out(__('You have more than one set of templates installed.', true)); $this->out(__('You have more than one set of templates installed.'));
$this->out(__('Please choose the template set you wish to use:', true)); $this->out(__('Please choose the template set you wish to use:'));
$this->hr(); $this->hr();
$i = 1; $i = 1;
@ -178,7 +178,7 @@ class TemplateTask extends Shell {
$indexedPaths[$i] = $path; $indexedPaths[$i] = $path;
$i++; $i++;
} }
$index = $this->in(__('Which bake theme would you like to use?', true), range(1, $i - 1), 1); $index = $this->in(__('Which bake theme would you like to use?'), range(1, $i - 1), 1);
$themeNames = array_keys($this->templatePaths); $themeNames = array_keys($this->templatePaths);
$this->Dispatch->params['theme'] = $themeNames[$index - 1]; $this->Dispatch->params['theme'] = $themeNames[$index - 1];
return $indexedPaths[$index]; return $indexedPaths[$index];
@ -205,7 +205,7 @@ class TemplateTask extends Shell {
return $templatePath; return $templatePath;
} }
} }
$this->err(sprintf(__('Could not find template for %s', true), $filename)); $this->err(sprintf(__('Could not find template for %s'), $filename));
return false; return false;
} }
} }

View file

@ -90,8 +90,8 @@ class TestTask extends BakeTask {
function __interactive($type = null) { function __interactive($type = null) {
$this->interactive = true; $this->interactive = true;
$this->hr(); $this->hr();
$this->out(__('Bake Tests', true)); $this->out(__('Bake Tests'));
$this->out(sprintf(__("Path: %s", true), $this->path)); $this->out(sprintf(__('Path: %s'), $this->path));
$this->hr(); $this->hr();
$selection = null; $selection = null;
@ -116,7 +116,7 @@ class TestTask extends BakeTask {
*/ */
public function bake($type, $className) { public function bake($type, $className) {
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) { if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
$this->out(__('Bake is detecting possible fixtures..', true)); $this->out(__('Bake is detecting possible fixtures..'));
$testSubject =& $this->buildTestSubject($type, $className); $testSubject =& $this->buildTestSubject($type, $className);
$this->generateFixtureList($testSubject); $this->generateFixtureList($testSubject);
} elseif ($this->interactive) { } elseif ($this->interactive) {
@ -156,7 +156,7 @@ class TestTask extends BakeTask {
*/ */
public function getObjectType() { public function getObjectType() {
$this->hr(); $this->hr();
$this->out(__("Select an object type:", true)); $this->out(__('Select an object type:'));
$this->hr(); $this->hr();
$keys = array(); $keys = array();
@ -165,7 +165,7 @@ class TestTask extends BakeTask {
$keys[] = $key; $keys[] = $key;
} }
$keys[] = 'q'; $keys[] = 'q';
$selection = $this->in(__("Enter the type of object to bake a test for or (q)uit", true), $keys, 'q'); $selection = $this->in(__('Enter the type of object to bake a test for or (q)uit'), $keys, 'q');
if ($selection == 'q') { if ($selection == 'q') {
return $this->_stop(); return $this->_stop();
} }
@ -180,13 +180,13 @@ class TestTask extends BakeTask {
*/ */
public function getClassName($objectType) { public function getClassName($objectType) {
$options = App::objects(strtolower($objectType)); $options = App::objects(strtolower($objectType));
$this->out(sprintf(__('Choose a %s class', true), $objectType)); $this->out(sprintf(__('Choose a %s class'), $objectType));
$keys = array(); $keys = array();
foreach ($options as $key => $option) { foreach ($options as $key => $option) {
$this->out(++$key . '. ' . $option); $this->out(++$key . '. ' . $option);
$keys[] = $key; $keys[] = $key;
} }
$selection = $this->in(__('Choose an existing class, or enter the name of a class that does not exist', true)); $selection = $this->in(__('Choose an existing class, or enter the name of a class that does not exist'));
if (isset($options[$selection - 1])) { if (isset($options[$selection - 1])) {
return $options[$selection - 1]; return $options[$selection - 1];
} }
@ -354,10 +354,10 @@ class TestTask extends BakeTask {
* @return array Array of fixtures the user wants to add. * @return array Array of fixtures the user wants to add.
*/ */
public function getUserFixtures() { public function getUserFixtures() {
$proceed = $this->in(__('Bake could not detect fixtures, would you like to add some?', true), array('y','n'), 'n'); $proceed = $this->in(__('Bake could not detect fixtures, would you like to add some?'), array('y','n'), 'n');
$fixtures = array(); $fixtures = array();
if (strtolower($proceed) == 'y') { if (strtolower($proceed) == 'y') {
$fixtureList = $this->in(__("Please provide a comma separated list of the fixtures names you'd like to use.\nExample: 'app.comment, app.post, plugin.forums.post'", true)); $fixtureList = $this->in(__("Please provide a comma separated list of the fixtures names you'd like to use.\nExample: 'app.comment, app.post, plugin.forums.post'"));
$fixtureListTrimmed = str_replace(' ', '', $fixtureList); $fixtureListTrimmed = str_replace(' ', '', $fixtureList);
$fixtures = explode(',', $fixtureListTrimmed); $fixtures = explode(',', $fixtureListTrimmed);
} }

View file

@ -220,17 +220,17 @@ class ViewTask extends BakeTask {
$this->controllerPath = strtolower(Inflector::underscore($this->controllerName)); $this->controllerPath = strtolower(Inflector::underscore($this->controllerName));
$prompt = sprintf(__("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite %s views if it exist.", true), $this->controllerName); $prompt = sprintf(__("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite %s views if it exist."), $this->controllerName);
$interactive = $this->in($prompt, array('y', 'n'), 'n'); $interactive = $this->in($prompt, array('y', 'n'), 'n');
if (strtolower($interactive) == 'n') { if (strtolower($interactive) == 'n') {
$this->interactive = false; $this->interactive = false;
} }
$prompt = __("Would you like to create some CRUD views\n(index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller\nand model classes (including associated models).", true); $prompt = __("Would you like to create some CRUD views\n(index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller\nand model classes (including associated models).");
$wannaDoScaffold = $this->in($prompt, array('y','n'), 'y'); $wannaDoScaffold = $this->in($prompt, array('y','n'), 'y');
$wannaDoAdmin = $this->in(__("Would you like to create the views for admin routing?", true), array('y','n'), 'n'); $wannaDoAdmin = $this->in(__("Would you like to create the views for admin routing?"), array('y','n'), 'n');
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoAdmin) == 'y') { if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoAdmin) == 'y') {
$vars = $this->__loadController(); $vars = $this->__loadController();
@ -249,7 +249,7 @@ class ViewTask extends BakeTask {
} }
$this->hr(); $this->hr();
$this->out(); $this->out();
$this->out(__("View Scaffolding Complete.\n", true)); $this->out(__("View Scaffolding Complete.\n"));
} else { } else {
$this->customAction(); $this->customAction();
} }
@ -267,7 +267,7 @@ class ViewTask extends BakeTask {
*/ */
function __loadController() { function __loadController() {
if (!$this->controllerName) { if (!$this->controllerName) {
$this->err(__('Controller not found', true)); $this->err(__('Controller not found'));
} }
$import = $this->controllerName; $import = $this->controllerName;
@ -277,7 +277,7 @@ class ViewTask extends BakeTask {
if (!App::import('Controller', $import)) { if (!App::import('Controller', $import)) {
$file = $this->controllerPath . '_controller.php'; $file = $this->controllerPath . '_controller.php';
$this->err(sprintf(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", true), $file)); $this->err(sprintf(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller."), $file));
$this->_stop(); $this->_stop();
} }
$controllerClassName = $this->controllerName . 'Controller'; $controllerClassName = $this->controllerName . 'Controller';
@ -329,25 +329,25 @@ class ViewTask extends BakeTask {
function customAction() { function customAction() {
$action = ''; $action = '';
while ($action == '') { while ($action == '') {
$action = $this->in(__('Action Name? (use lowercase_underscored function name)', true)); $action = $this->in(__('Action Name? (use lowercase_underscored function name)'));
if ($action == '') { if ($action == '') {
$this->out(__('The action name you supplied was empty. Please try again.', true)); $this->out(__('The action name you supplied was empty. Please try again.'));
} }
} }
$this->out(); $this->out();
$this->hr(); $this->hr();
$this->out(__('The following view will be created:', true)); $this->out(__('The following view will be created:'));
$this->hr(); $this->hr();
$this->out(sprintf(__('Controller Name: %s', true), $this->controllerName)); $this->out(sprintf(__('Controller Name: %s'), $this->controllerName));
$this->out(sprintf(__('Action Name: %s', true), $action)); $this->out(sprintf(__('Action Name: %s'), $action));
$this->out(sprintf(__('Path: %s', true), $this->params['app'] . DS . $this->controllerPath . DS . Inflector::underscore($action) . ".ctp")); $this->out(sprintf(__('Path: %s'), $this->params['app'] . DS . $this->controllerPath . DS . Inflector::underscore($action) . ".ctp"));
$this->hr(); $this->hr();
$looksGood = $this->in(__('Look okay?', true), array('y','n'), 'y'); $looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
if (strtolower($looksGood) == 'y') { if (strtolower($looksGood) == 'y') {
$this->bake($action); $this->bake($action);
$this->_stop(); $this->_stop();
} else { } else {
$this->out(__('Bake Aborted.', true)); $this->out(__('Bake Aborted.'));
} }
} }

View file

@ -146,15 +146,15 @@ class TestSuiteShell extends Shell {
* @return void * @return void
*/ */
public function main() { public function main() {
$this->out(__('CakePHP Test Shell', true)); $this->out(__('CakePHP Test Shell'));
$this->hr(); $this->hr();
if (count($this->args) == 0) { if (count($this->args) == 0) {
$this->error(__('Sorry, you did not pass any arguments!', true)); $this->error(__('Sorry, you did not pass any arguments!'));
} }
if ($this->__canRun()) { if ($this->__canRun()) {
$message = sprintf(__('Running %s %s %s', true), $this->category, $this->type, $this->file); $message = sprintf(__('Running %s %s %s'), $this->category, $this->type, $this->file);
$this->out($message); $this->out($message);
$exitCode = 0; $exitCode = 0;
@ -163,7 +163,7 @@ class TestSuiteShell extends Shell {
} }
$this->_stop($exitCode); $this->_stop($exitCode);
} else { } else {
$this->error(__('Sorry, the tests could not be found.', true)); $this->error(__('Sorry, the tests could not be found.'));
} }
} }
@ -216,7 +216,7 @@ class TestSuiteShell extends Shell {
if ($isNeitherAppNorCore && !$isPlugin) { if ($isNeitherAppNorCore && !$isPlugin) {
$message = sprintf( $message = sprintf(
__('%s is an invalid test category (either "app", "core" or name of a plugin)', true), __('%s is an invalid test category (either "app", "core" or name of a plugin)'),
$this->category $this->category
); );
$this->error($message); $this->error($message);
@ -225,12 +225,12 @@ class TestSuiteShell extends Shell {
$folder = $this->__findFolderByCategory($this->category); $folder = $this->__findFolderByCategory($this->category);
if (!file_exists($folder)) { if (!file_exists($folder)) {
$this->err(sprintf(__('%s not found', true), $folder)); $this->err(sprintf(__('%s not found'), $folder));
return false; return false;
} }
if (!in_array($this->type, array('all', 'group', 'case'))) { if (!in_array($this->type, array('all', 'group', 'case'))) {
$this->err(sprintf(__('%s is invalid. Should be case, group or all', true), $this->type)); $this->err(sprintf(__('%s is invalid. Should be case, group or all'), $this->type));
return false; return false;
} }
@ -240,7 +240,7 @@ class TestSuiteShell extends Shell {
} }
$message = sprintf( $message = sprintf(
__('%s %s %s is an invalid test identifier', true), __('%s %s %s is an invalid test identifier'),
$this->category, $this->type, $this->file $this->category, $this->type, $this->file
); );
$this->err($message); $this->err($message);
@ -266,7 +266,7 @@ class TestSuiteShell extends Shell {
if ($this->doCoverage) { if ($this->doCoverage) {
if (!extension_loaded('xdebug')) { if (!extension_loaded('xdebug')) {
$this->out(__('You must install Xdebug to use the CakePHP(tm) Code Coverage Analyzation. Download it from http://www.xdebug.org/docs/install', true)); $this->out(__('You must install Xdebug to use the CakePHP(tm) Code Coverage Analyzation. Download it from http://www.xdebug.org/docs/install'));
$this->_stop(0); $this->_stop(0);
} }
} }
@ -359,7 +359,7 @@ class TestSuiteShell extends Shell {
*/ */
function __installSimpleTest() { function __installSimpleTest() {
if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) { if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) {
$this->err(__('Sorry, Simpletest could not be found. Download it from http://simpletest.org and install it to your vendors directory.', true)); $this->err(__('Sorry, Simpletest could not be found. Download it from http://simpletest.org and install it to your vendors directory.'));
exit; exit;
} }
} }

View file

@ -27,10 +27,10 @@
public function <?php echo $admin ?>view($id = null) { public function <?php echo $admin ?>view($id = null) {
if (!$id) { if (!$id) {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName) ?>')); $this->Session->setFlash(sprintf(__('Invalid %s'), '<?php echo strtolower($singularHumanName) ?>'));
$this->redirect(array('action' => 'index')); $this->redirect(array('action' => 'index'));
<?php else: ?> <?php else: ?>
$this->flash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index')); $this->flash(sprintf(__('Invalid %s'), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index'));
<?php endif; ?> <?php endif; ?>
} }
$this->set('<?php echo $singularName; ?>', $this-><?php echo $currentModelName; ?>->read(null, $id)); $this->set('<?php echo $singularName; ?>', $this-><?php echo $currentModelName; ?>->read(null, $id));
@ -42,14 +42,14 @@
$this-><?php echo $currentModelName; ?>->create(); $this-><?php echo $currentModelName; ?>->create();
if ($this-><?php echo $currentModelName; ?>->save($this->data)) { if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('The %s has been saved', true), '<?php echo strtolower($singularHumanName); ?>')); $this->Session->setFlash(sprintf(__('The %s has been saved'), '<?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action' => 'index')); $this->redirect(array('action' => 'index'));
<?php else: ?> <?php else: ?>
$this->flash(sprintf(__('%s saved.', true), '<?php echo ucfirst(strtolower($currentModelName)); ?>'), array('action' => 'index')); $this->flash(sprintf(__('%s saved.'), '<?php echo ucfirst(strtolower($currentModelName)); ?>'), array('action' => 'index'));
<?php endif; ?> <?php endif; ?>
} else { } else {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), '<?php echo strtolower($singularHumanName); ?>')); $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.'), '<?php echo strtolower($singularHumanName); ?>'));
<?php endif; ?> <?php endif; ?>
} }
} }
@ -74,23 +74,23 @@
public function <?php echo $admin; ?>edit($id = null) { public function <?php echo $admin; ?>edit($id = null) {
if (!$id && empty($this->data)) { if (!$id && empty($this->data)) {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName); ?>')); $this->Session->setFlash(sprintf(__('Invalid %s'), '<?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action' => 'index')); $this->redirect(array('action' => 'index'));
<?php else: ?> <?php else: ?>
$this->flash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index')); $this->flash(sprintf(__('Invalid %s'), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index'));
<?php endif; ?> <?php endif; ?>
} }
if (!empty($this->data)) { if (!empty($this->data)) {
if ($this-><?php echo $currentModelName; ?>->save($this->data)) { if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('The %s has been saved', true), '<?php echo strtolower($singularHumanName); ?>')); $this->Session->setFlash(sprintf(__('The %s has been saved'), '<?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action' => 'index')); $this->redirect(array('action' => 'index'));
<?php else: ?> <?php else: ?>
$this->flash(sprintf(__('The %s has been saved.', true), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index')); $this->flash(sprintf(__('The %s has been saved.'), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index'));
<?php endif; ?> <?php endif; ?>
} else { } else {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), '<?php echo strtolower($singularHumanName); ?>')); $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.'), '<?php echo strtolower($singularHumanName); ?>'));
<?php endif; ?> <?php endif; ?>
} }
} }
@ -117,24 +117,24 @@
public function <?php echo $admin; ?>delete($id = null) { public function <?php echo $admin; ?>delete($id = null) {
if (!$id) { if (!$id) {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('Invalid id for %s', true), '<?php echo strtolower($singularHumanName); ?>')); $this->Session->setFlash(sprintf(__('Invalid id for %s'), '<?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action'=>'index')); $this->redirect(array('action'=>'index'));
<?php else: ?> <?php else: ?>
$this->flash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index')); $this->flash(sprintf(__('Invalid %s'), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index'));
<?php endif; ?> <?php endif; ?>
} }
if ($this-><?php echo $currentModelName; ?>->delete($id)) { if ($this-><?php echo $currentModelName; ?>->delete($id)) {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('%s deleted', true), '<?php echo ucfirst(strtolower($singularHumanName)); ?>')); $this->Session->setFlash(sprintf(__('%s deleted'), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'));
$this->redirect(array('action'=>'index')); $this->redirect(array('action'=>'index'));
<?php else: ?> <?php else: ?>
$this->flash(sprintf(__('%s deleted', true), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'), array('action' => 'index')); $this->flash(sprintf(__('%s deleted'), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'), array('action' => 'index'));
<?php endif; ?> <?php endif; ?>
} }
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Session->setFlash(sprintf(__('%s was not deleted', true), '<?php echo ucfirst(strtolower($singularHumanName)); ?>')); $this->Session->setFlash(sprintf(__('%s was not deleted'), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'));
<?php else: ?> <?php else: ?>
$this->flash(sprintf(__('%s was not deleted', true), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'), array('action' => 'index')); $this->flash(sprintf(__('%s was not deleted'), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'), array('action' => 'index'));
<?php endif; ?> <?php endif; ?>
$this->redirect(array('action' => 'index')); $this->redirect(array('action' => 'index'));
} }

View file

@ -20,7 +20,7 @@
<div class="<?php echo $pluralVar;?> form"> <div class="<?php echo $pluralVar;?> form">
<?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?> <?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?>
<fieldset> <fieldset>
<legend><?php echo "<?php printf(__('" . Inflector::humanize($action) . " %s', true), __('{$singularHumanName}', true)); ?>";?></legend> <legend><?php echo "<?php printf(__('" . Inflector::humanize($action) . " %s'), __('{$singularHumanName}')); ?>";?></legend>
<?php <?php
echo "\t<?php\n"; echo "\t<?php\n";
foreach ($fields as $field) { foreach ($fields as $field) {
@ -39,24 +39,24 @@
?> ?>
</fieldset> </fieldset>
<?php <?php
echo "<?php echo \$this->Form->end(__('Submit', true));?>\n"; echo "<?php echo \$this->Form->end(__('Submit'));?>\n";
?> ?>
</div> </div>
<div class="actions"> <div class="actions">
<h3><?php echo "<?php __('Actions'); ?>"; ?></h3> <h3><?php echo "<?php echo __('Actions'); ?>"; ?></h3>
<ul> <ul>
<?php if (strpos($action, 'add') === false): ?> <?php if (strpos($action, 'add') === false): ?>
<li><?php echo "<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \$this->Form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$this->Form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li> <li><?php echo "<?php echo \$this->Html->link(__('Delete'), array('action' => 'delete', \$this->Form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?'), \$this->Form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
<?php endif;?> <?php endif;?>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index'));?>";?></li> <li><?php echo "<?php echo \$this->Html->link(sprintf(__('List %s'), __('{$pluralHumanName}')), array('action' => 'index'));?>";?></li>
<?php <?php
$done = array(); $done = array();
foreach ($associations as $type => $data) { foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) { foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) { if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s'), __('" . Inflector::humanize($details['controller']) . "')), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s'), __('" . Inflector::humanize(Inflector::underscore($alias)) . "')), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller']; $done[] = $details['controller'];
} }
} }

View file

@ -10,11 +10,11 @@ endif;
<?php <?php
if (is_writable(TMP)): if (is_writable(TMP)):
echo '<span class=\"notice success\">'; echo '<span class=\"notice success\">';
__('Your tmp directory is writable.'); echo __('Your tmp directory is writable.');
echo '</span>'; echo '</span>';
else: else:
echo '<span class=\"notice\">'; echo '<span class=\"notice\">';
__('Your tmp directory is NOT writable.'); echo __('Your tmp directory is NOT writable.');
echo '</span>'; echo '</span>';
endif; endif;
?> ?>
@ -24,11 +24,11 @@ endif;
\$settings = Cache::settings(); \$settings = Cache::settings();
if (!empty(\$settings)): if (!empty(\$settings)):
echo '<span class=\"notice success\">'; echo '<span class=\"notice success\">';
printf(__('The %s is being used for caching. To change the config edit APP/config/core.php ', true), '<em>'. \$settings['engine'] . 'Engine</em>'); printf(__('The %s is being used for caching. To change the config edit APP/config/core.php '), '<em>'. \$settings['engine'] . 'Engine</em>');
echo '</span>'; echo '</span>';
else: else:
echo '<span class=\"notice\">'; echo '<span class=\"notice\">';
__('Your cache is NOT working. Please check the settings in APP/config/core.php'); echo __('Your cache is NOT working. Please check the settings in APP/config/core.php');
echo '</span>'; echo '</span>';
endif; endif;
?> ?>
@ -38,14 +38,14 @@ endif;
\$filePresent = null; \$filePresent = null;
if (file_exists(CONFIGS . 'database.php')): if (file_exists(CONFIGS . 'database.php')):
echo '<span class=\"notice success\">'; echo '<span class=\"notice success\">';
__('Your database configuration file is present.'); echo __('Your database configuration file is present.');
\$filePresent = true; \$filePresent = true;
echo '</span>'; echo '</span>';
else: else:
echo '<span class=\"notice\">'; echo '<span class=\"notice\">';
__('Your database configuration file is NOT present.'); echo __('Your database configuration file is NOT present.');
echo '<br/>'; echo '<br/>';
__('Rename config/database.php.default to config/database.php'); echo __('Rename config/database.php.default to config/database.php');
echo '</span>'; echo '</span>';
endif; endif;
?> ?>
@ -62,22 +62,22 @@ if (!empty(\$filePresent)):
<?php <?php
if (\$connected->isConnected()): if (\$connected->isConnected()):
echo '<span class=\"notice success\">'; echo '<span class=\"notice success\">';
__('Cake is able to connect to the database.'); echo __('Cake is able to connect to the database.');
echo '</span>'; echo '</span>';
else: else:
echo '<span class=\"notice\">'; echo '<span class=\"notice\">';
__('Cake is NOT able to connect to the database.'); echo __('Cake is NOT able to connect to the database.');
echo '</span>'; echo '</span>';
endif; endif;
?> ?>
</p>\n"; </p>\n";
$output .= "<?php endif;?>\n"; $output .= "<?php endif;?>\n";
$output .= "<h3><?php __('Editing this Page') ?></h3>\n"; $output .= "<h3><?php echo __('Editing this Page') ?></h3>\n";
$output .= "<p>\n"; $output .= "<p>\n";
$output .= "<?php\n"; $output .= "<?php\n";
$output .= "\tprintf(__('To change the content of this page, edit: %s\n"; $output .= "\tprintf(__('To change the content of this page, edit: %s\n";
$output .= "\t\tTo change its layout, edit: %s\n"; $output .= "\t\tTo change its layout, edit: %s\n";
$output .= "\t\tYou can also add some CSS styles for your pages at: %s', true),\n"; $output .= "\t\tYou can also add some CSS styles for your pages at: %s'),\n";
$output .= "\t\tAPP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n"; $output .= "\t\tAPP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n";
$output .= "?>\n"; $output .= "?>\n";
$output .= "</p>\n"; $output .= "</p>\n";

View file

@ -18,13 +18,13 @@
*/ */
?> ?>
<div class="<?php echo $pluralVar;?> index"> <div class="<?php echo $pluralVar;?> index">
<h2><?php echo "<?php __('{$pluralHumanName}');?>";?></h2> <h2><?php echo "<?php echo __('{$pluralHumanName}');?>";?></h2>
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<?php foreach ($fields as $field):?> <?php foreach ($fields as $field):?>
<th><?php echo "<?php echo \$this->Paginator->sort('{$field}');?>";?></th> <th><?php echo "<?php echo \$this->Paginator->sort('{$field}');?>";?></th>
<?php endforeach;?> <?php endforeach;?>
<th class="actions"><?php echo "<?php __('Actions');?>";?></th> <th class="actions"><?php echo "<?php echo __('Actions');?>";?></th>
</tr> </tr>
<?php <?php
echo "<?php echo "<?php
@ -53,9 +53,9 @@
} }
echo "\t\t<td class=\"actions\">\n"; echo "\t\t<td class=\"actions\">\n";
echo "\t\t\t<?php echo \$this->Html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n"; echo "\t\t\t<?php echo \$this->Html->link(__('View'), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n"; echo "\t\t\t<?php echo \$this->Html->link(__('Edit'), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n"; echo "\t\t\t<?php echo \$this->Html->link(__('Delete'), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?'), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t</td>\n"; echo "\t\t</td>\n";
echo "\t</tr>\n"; echo "\t</tr>\n";
@ -65,28 +65,28 @@
<p> <p>
<?php echo "<?php <?php echo "<?php
echo \$this->Paginator->counter(array( echo \$this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) 'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%')
)); ));
?>";?> ?>";?>
</p> </p>
<div class="paging"> <div class="paging">
<?php echo "\t<?php echo \$this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?> <?php echo "\t<?php echo \$this->Paginator->prev('<< '.__('previous'), array(), null, array('class'=>'disabled'));?>\n";?>
| <?php echo "\t<?php echo \$this->Paginator->numbers();?>\n"?> | | <?php echo "\t<?php echo \$this->Paginator->numbers();?>\n"?> |
<?php echo "\t<?php echo \$this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>\n";?> <?php echo "\t<?php echo \$this->Paginator->next(__('next').' >>', array(), null, array('class' => 'disabled'));?>\n";?>
</div> </div>
</div> </div>
<div class="actions"> <div class="actions">
<h3><?php echo "<?php __('Actions'); ?>"; ?></h3> <h3><?php echo "<?php echo __('Actions'); ?>"; ?></h3>
<ul> <ul>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?>";?></li> <li><?php echo "<?php echo \$this->Html->link(sprintf(__('New %s'), __('{$singularHumanName}')), array('action' => 'add')); ?>";?></li>
<?php <?php
$done = array(); $done = array();
foreach ($associations as $type => $data) { foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) { foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) { if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s'), __('" . Inflector::humanize($details['controller']) . "')), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s'), __('" . Inflector::humanize(Inflector::underscore($alias)) . "')), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller']; $done[] = $details['controller'];
} }
} }

View file

@ -18,7 +18,7 @@
*/ */
?> ?>
<div class="<?php echo $pluralVar;?> view"> <div class="<?php echo $pluralVar;?> view">
<h2><?php echo "<?php __('{$singularHumanName}');?>";?></h2> <h2><?php echo "<?php echo __('{$singularHumanName}');?>";?></h2>
<dl><?php echo "<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?> <dl><?php echo "<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?>
<?php <?php
foreach ($fields as $field) { foreach ($fields as $field) {
@ -27,14 +27,14 @@ foreach ($fields as $field) {
foreach ($associations['belongsTo'] as $alias => $details) { foreach ($associations['belongsTo'] as $alias => $details) {
if ($field === $details['foreignKey']) { if ($field === $details['foreignKey']) {
$isKey = true; $isKey = true;
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n"; echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php echo __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n"; echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
break; break;
} }
} }
} }
if ($isKey !== true) { if ($isKey !== true) {
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize($field) . "'); ?></dt>\n"; echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php echo __('" . Inflector::humanize($field) . "'); ?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t\t&nbsp;\n\t\t</dd>\n"; echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
} }
} }
@ -42,20 +42,20 @@ foreach ($fields as $field) {
</dl> </dl>
</div> </div>
<div class="actions"> <div class="actions">
<h3><?php echo "<?php __('Actions'); ?>"; ?></h3> <h3><?php echo "<?php echo __('Actions'); ?>"; ?></h3>
<ul> <ul>
<?php <?php
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('Edit %s'), __('{$singularHumanName}')), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('Delete %s'), __('{$singularHumanName}')), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?'), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s'), __('{$pluralHumanName}')), array('action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s'), __('{$singularHumanName}')), array('action' => 'add')); ?> </li>\n";
$done = array(); $done = array();
foreach ($associations as $type => $data) { foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) { foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) { if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s'), __('" . Inflector::humanize($details['controller']) . "')), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n"; echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s'), __('" . Inflector::humanize(Inflector::underscore($alias)) . "')), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller']; $done[] = $details['controller'];
} }
} }

View file

@ -22,7 +22,7 @@
<head> <head>
<?php echo $this->Html->charset(); ?> <?php echo $this->Html->charset(); ?>
<title> <title>
<?php __('CakePHP: the rapid development php framework:'); ?> <?php echo __('CakePHP: the rapid development php framework:'); ?>
<?php echo $title_for_layout; ?> <?php echo $title_for_layout; ?>
</title> </title>
<?php <?php
@ -36,7 +36,7 @@
<body> <body>
<div id="container"> <div id="container">
<div id="header"> <div id="header">
<h1><?php echo $this->Html->link(__('CakePHP: the rapid development php framework', true), 'http://cakephp.org'); ?></h1> <h1><?php echo $this->Html->link(__('CakePHP: the rapid development php framework'), 'http://cakephp.org'); ?></h1>
</div> </div>
<div id="content"> <div id="content">
@ -47,7 +47,7 @@
</div> </div>
<div id="footer"> <div id="footer">
<?php echo $this->Html->link( <?php echo $this->Html->link(
$this->Html->image('cake.power.gif', array('alt'=> __('CakePHP: the rapid development php framework', true), 'border' => '0')), $this->Html->image('cake.power.gif', array('alt'=> __('CakePHP: the rapid development php framework'), 'border' => '0')),
'http://www.cakephp.org/', 'http://www.cakephp.org/',
array('target' => '_blank', 'escape' => false) array('target' => '_blank', 'escape' => false)
); );

View file

@ -85,7 +85,7 @@ if (isset($corePath[0])) {
} }
if (Configure::read('debug') < 1) { if (Configure::read('debug') < 1) {
die(__('Debug setting does not allow access to this url.', true)); die(__('Debug setting does not allow access to this url.'));
} }
require_once CAKE_TESTS_LIB . 'cake_test_suite_dispatcher.php'; require_once CAKE_TESTS_LIB . 'cake_test_suite_dispatcher.php';