Skip to content

Commit

Permalink
Changing default bake views to allow easier i18n. Refs #3356
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 12, 2009
1 parent a898825 commit 4f6e9d4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions cake/console/templates/default/views/form.ctp
Expand Up @@ -26,7 +26,7 @@
<div class="<?php echo $pluralVar;?> form">
<?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
<fieldset>
<legend><?php echo "<?php __('" . Inflector::humanize($action) . " {$singularHumanName}');?>";?></legend>
<legend><?php echo "<?php printf(__('" . Inflector::humanize($action) . " %s', true), __('{$singularHumanName}', true)); ?>";?></legend>
<?php
echo "\t<?php\n";
foreach ($fields as $field) {
Expand All @@ -45,22 +45,22 @@
?>
</fieldset>
<?php
echo "<?php echo \$form->end('Submit');?>\n";
echo "<?php echo \$form->end(__('Submit', true));?>\n";
?>
</div>
<div class="actions">
<ul>
<?php if ($action != 'add'):?>
<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action' => 'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
<?php endif;?>
<li><?php echo "<?php echo \$html->link(__('List {$pluralHumanName}', true), array('action' => 'index'));?>";?></li>
<li><?php echo "<?php echo \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index'));?>";?></li>
<?php
$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$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 \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
}
Expand Down
6 changes: 3 additions & 3 deletions cake/console/templates/default/views/index.ctp
Expand Up @@ -83,14 +83,14 @@ echo "<?php endforeach; ?>\n";
</div>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link(__('New {$singularHumanName}', true), array('action' => 'add')); ?>";?></li>
<li><?php echo "<?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?>";?></li>
<?php
$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$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 \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
}
Expand Down
20 changes: 10 additions & 10 deletions cake/console/templates/default/views/view.ctp
Expand Up @@ -50,17 +50,17 @@ foreach ($fields as $field) {
<div class="actions">
<ul>
<?php
echo "\t\t<li><?php echo \$html->link(__('Edit {$singularHumanName}', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('Delete {$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 \$html->link(__('List {$pluralHumanName}', true), array('action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New {$singularHumanName}', true), array('action' => 'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$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 \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n";

$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$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 \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
}
Expand All @@ -72,7 +72,7 @@ foreach ($fields as $field) {
if (!empty($associations['hasOne'])) :
foreach ($associations['hasOne'] as $alias => $details): ?>
<div class="related">
<h3><?php echo "<?php __('Related " . Inflector::humanize($details['controller']) . "');?>";?></h3>
<h3><?php echo "<?php printf(__('Related %s', true), __('" . Inflector::humanize($details['controller']) . "', true));?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?>
<dl><?php echo "\t<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?>
<?php
Expand All @@ -85,7 +85,7 @@ if (!empty($associations['hasOne'])) :
<?php echo "<?php endif; ?>\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link(__('Edit " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
<li><?php echo "<?php echo \$html->link(sprintf(__('Edit %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
</ul>
</div>
</div>
Expand All @@ -105,7 +105,7 @@ foreach ($relations as $alias => $details):
$otherPluralHumanName = Inflector::humanize($details['controller']);
?>
<div class="related">
<h3><?php echo "<?php __('Related {$otherPluralHumanName}');?>";?></h3>
<h3><?php echo "<?php printf(__('Related %s', true), __('{$otherPluralHumanName}', true));?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?>
<table cellpadding = "0" cellspacing = "0">
<tr>
Expand Down Expand Up @@ -144,7 +144,7 @@ echo "\t<?php endforeach; ?>\n";
<?php echo "<?php endif; ?>\n\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
<li><?php echo "<?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
</ul>
</div>
</div>
Expand Down

0 comments on commit 4f6e9d4

Please sign in to comment.