Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Separate translate and use_messages config params. Fixes #144.

  • Loading branch information...
commit 81f55917333b4fd3e635c107b77f5466405c41ae 1 parent ebb586b
@bmidget bmidget authored
View
4 classes/formo/core/container.php
@@ -637,12 +637,12 @@ public function find($alias)
* @access public
* @return void
*/
- public function translate_label()
+ public function message_label()
{
$str = NULL;
if ($parent = $this->parent())
{
- $str .= $parent->translate_label().'.';
+ $str .= $parent->message_label().'.';
}
return $str .= $this->alias();
View
11 classes/formo/core/view.php
@@ -59,15 +59,20 @@ public function label($utf8 = FALSE)
if ( ! $label)
{
- if (Formo::config($this->_field, 'translate') === TRUE)
+ if (Formo::config($this->_field, 'use_messages') === TRUE)
{
- $translate_label = $this->_field->translate_label();
- $label = __(Kohana::message(Formo::config($this->_field, 'message_file'), $translate_label, $translate_label));
+ $translate_label = $this->_field->message_label();
+ $label = Kohana::message(Formo::config($this->_field, 'message_file'), $translate_label, $translate_label);
}
else
{
$label = $this->_field->alias();
}
+
+ if (Formo::config($this->_field, 'translate') === TRUE)
+ {
+ $label = __($label);
+ }
}
return $label;
View
2  config/formo.php
@@ -4,6 +4,8 @@
(
// Whether to translate labels
'translate' => FALSE,
+ // Whether to use Kohana messages
+ 'use_messages' => FALSE,
// File for validate messages
'message_file' => 'validate',
// Default path to view files
Please sign in to comment.
Something went wrong with that request. Please try again.