CC-1960: Internationalize Airtime / Support translations

-added gettext wrapper functions for all strings in view/scripts, and forms
This commit is contained in:
denise 2012-11-15 10:59:06 -05:00
parent f0e2d5d295
commit b173b6dda4
78 changed files with 481 additions and 423 deletions

View file

@ -16,24 +16,24 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
// automatic trasition on source disconnection
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
$auto_transition->setLabel("Auto Switch Off")
$auto_transition->setLabel(_("Auto Switch Off"))
->setValue(Application_Model_Preference::GetAutoTransition())
->setDecorators(array('ViewHelper'));
$this->addElement($auto_transition);
// automatic switch on upon source connection
$auto_switch = new Zend_Form_Element_Checkbox("auto_switch");
$auto_switch->setLabel("Auto Switch On")
$auto_switch->setLabel(_("Auto Switch On"))
->setValue(Application_Model_Preference::GetAutoSwitch())
->setDecorators(array('ViewHelper'));
$this->addElement($auto_switch);
// Default transition fade
$transition_fade = new Zend_Form_Element_Text("transition_fade");
$transition_fade->setLabel("Switch Transition Fade (s)")
$transition_fade->setLabel(_("Switch Transition Fade (s)"))
->setFilters(array('StringTrim'))
->addValidator('regex', false, array('/^[0-9]{1,2}(\.\d{1,6})?$/',
'messages' => 'enter a time in seconds 00{.000000}'))
'messages' => _('enter a time in seconds 00{.000000}')))
->setValue($defaultFade)
->setDecorators(array('ViewHelper'));
$this->addElement($transition_fade);
@ -42,7 +42,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$master_username = new Zend_Form_Element_Text('master_username');
$master_username->setAttrib('autocomplete', 'off')
->setAllowEmpty(true)
->setLabel('Master Username')
->setLabel(_('Master Username'))
->setFilters(array('StringTrim'))
->setValue(Application_Model_Preference::GetLiveStreamMasterUsername())
->setDecorators(array('ViewHelper'));
@ -59,7 +59,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
->setAttrib('renderPassword','true')
->setAllowEmpty(true)
->setValue(Application_Model_Preference::GetLiveStreamMasterPassword())
->setLabel('Master Password')
->setLabel(_('Master Password'))
->setFilters(array('StringTrim'))
->setDecorators(array('ViewHelper'));
$this->addElement($master_password);
@ -67,7 +67,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
//Master source connection url
$master_dj_connection_url = new Zend_Form_Element_Text('master_dj_connection_url');
$master_dj_connection_url->setAttrib('readonly', true)
->setLabel('Master Source Connection URL')
->setLabel(_('Master Source Connection URL'))
->setValue(Application_Model_Preference::GetMasterDJSourceConnectionURL())
->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_connection_url);
@ -75,7 +75,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
//Show source connection url
$live_dj_connection_url = new Zend_Form_Element_Text('live_dj_connection_url');
$live_dj_connection_url->setAttrib('readonly', true)
->setLabel('Show Source Connection URL')
->setLabel(_('Show Source Connection URL'))
->setValue(Application_Model_Preference::GetLiveDJSourceConnectionURL())
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_connection_url);
@ -83,38 +83,38 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
//liquidsoap harbor.input port
$m_port = Application_Model_StreamSetting::getMasterLiveStreamPort();
$master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port');
$master_dj_port->setLabel("Master Source Port")
$master_dj_port->setLabel(_("Master Source Port"))
->setValue($m_port)
->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151))))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>_('Only numbers are allowed.'))))
->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_port);
$m_mount = Application_Model_StreamSetting::getMasterLiveStreamMountPoint();
$master_dj_mount = new Zend_Form_Element_Text('master_harbor_input_mount_point');
$master_dj_mount->setLabel("Master Source Mount Point")
$master_dj_mount->setLabel(_("Master Source Mount Point"))
->setValue($m_mount)
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_mount);
//liquidsoap harbor.input port
$l_port = Application_Model_StreamSetting::getDjLiveStreamPort();
$live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port');
$live_dj_port->setLabel("Show Source Port")
$live_dj_port->setLabel(_("Show Source Port"))
->setValue($l_port)
->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151))))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>_('Only numbers are allowed.'))))
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_port);
$l_mount = Application_Model_StreamSetting::getDjLiveStreamMountPoint();
$live_dj_mount = new Zend_Form_Element_Text('dj_harbor_input_mount_point');
$live_dj_mount->setLabel("Show Source Mount Point")
$live_dj_mount->setLabel(_("Show Source Mount Point"))
->setValue($l_mount)
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_mount);
// demo only code
@ -149,7 +149,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
if ($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != "") {
$element = $this->getElement("dj_harbor_input_port");
$element->addError("You cannot use same port as Master DJ port.");
$element->addError(_("You cannot use same port as Master DJ port."));
$isValid = false;
}
if ($master_harbor_input_port != "") {
@ -160,7 +160,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
socket_bind($sock, 0, $master_harbor_input_port);
} catch (Exception $e) {
$element = $this->getElement("master_harbor_input_port");
$element->addError("Port '$master_harbor_input_port' is not available.");
$element->addError(sprintf(_("Port %s is not available"), $master_harbor_input_port));
$isValid = false;
}
@ -178,7 +178,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
socket_bind($sock, 0, $dj_harbor_input_port);
} catch (Exception $e) {
$element = $this->getElement("dj_harbor_input_port");
$element->addError("Port '$dj_harbor_input_port' is not available.");
$element->addError(sprintf(_("Port %s is not available"). $dj_harbor_input_port));
$isValid = false;
}
socket_close($sock);