CC-1960: Internationalize Airtime / Support translations

-got rid of spaces at beginning of strings
-removed empty string translations
-overwrote Zend_Validate_Between object error messages
This commit is contained in:
denise 2012-11-28 16:16:39 -05:00
parent 9689c75bed
commit 542434d9f0
17 changed files with 52 additions and 38 deletions

View file

@ -45,7 +45,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel( $third_party_api->setLabel(
sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.'), '<br>')); sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '<br>'));
$third_party_api->setMultiOptions(array(_("Disabled"), $third_party_api->setMultiOptions(array(_("Disabled"),
_("Enabled"))); _("Enabled")));
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());

View file

@ -81,11 +81,12 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$this->addElement($live_dj_connection_url); $this->addElement($live_dj_connection_url);
//liquidsoap harbor.input port //liquidsoap harbor.input port
$betweenValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(1024, 49151);
$m_port = Application_Model_StreamSetting::getMasterLiveStreamPort(); $m_port = Application_Model_StreamSetting::getMasterLiveStreamPort();
$master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port'); $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) ->setValue($m_port)
->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151)))) ->setValidators(array($betweenValidator))
->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')); ->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_port); $this->addElement($master_dj_port);
@ -104,7 +105,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port'); $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) ->setValue($l_port)
->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151)))) ->setValidators(array($betweenValidator))
->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')); ->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_port); $this->addElement($live_dj_port);

View file

@ -191,7 +191,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$user->setAttrib('alt', 'regular_text'); $user->setAttrib('alt', 'regular_text');
$this->addElement($user); $this->addElement($user);
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>'; $liquidsopa_error_msg = '<div class="stream-status status-info"><h3>'._('Getting information from the server...').'</h3></div>';
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "enabled"=>$enable->getValue(), "liquidsoap_error_msg"=>$liquidsopa_error_msg)) array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "enabled"=>$enable->getValue(), "liquidsoap_error_msg"=>$liquidsopa_error_msg))

View file

@ -8,6 +8,7 @@ class Application_Form_SupportSettings extends Zend_Form
public function init() public function init()
{ {
$country_list = Application_Model_Preference::GetCountryList(); $country_list = Application_Model_Preference::GetCountryList();
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/support-setting.phtml')), array('ViewScript', array('viewScript' => 'form/support-setting.phtml')),
@ -20,7 +21,7 @@ class Application_Form_SupportSettings extends Zend_Form
'label' => _('Station Name'), 'label' => _('Station Name'),
'required' => true, 'required' => true,
'filters' => array('StringTrim'), 'filters' => array('StringTrim'),
'validator' => array('NotEmpty'), 'validators' => array($notEmptyValidator),
'value' => Application_Model_Preference::GetStationName(), 'value' => Application_Model_Preference::GetStationName(),
'decorators' => array( 'decorators' => array(
'ViewHelper' 'ViewHelper'

View file

@ -61,11 +61,23 @@ Class Application_Form_Helper_ValidationTypes {
); );
$validator->setMessage( $validator->setMessage(
_("'%value%' is less than %max% characters long"), _("'%value%' is more than %max% characters long"),
Zend_Validate_StringLength::TOO_LONG Zend_Validate_StringLength::TOO_LONG
); );
return $validator; return $validator;
} }
public static function overrideBetweenValidator($p_min, $p_max)
{
$validator = new Zend_Validate_Between($p_min, $p_max, true);
$validator->setMessage(
_("'%value%' is not between '%min%' and '%max%', inclusively"),
Zend_Validate_Between::NOT_BETWEEN
);
return $validator;
}
} }

View file

@ -466,7 +466,7 @@ class Application_Model_Preference
$sql = "SELECT * FROM cc_country"; $sql = "SELECT * FROM cc_country";
$res = $con->query($sql)->fetchAll(); $res = $con->query($sql)->fetchAll();
$out = array(); $out = array();
$out[""] = "Select Country"; $out[""] = _("Select Country");
foreach ($res as $r) { foreach ($res as $r) {
$out[$r["isocode"]] = $r["name"]; $out[$r["isocode"]] = $r["name"];
} }

View file

@ -41,7 +41,7 @@
<dt id="mailServer-label" class="block-display"> <dt id="mailServer-label" class="block-display">
<label class="required" for="mailServer"><?php echo $this->element->getElement('mailServer')->getLabel() ?> <label class="required" for="mailServer"><?php echo $this->element->getElement('mailServer')->getLabel() ?>
<span class="info-text-small"><?php _("(Required)") ?></span>: <span class="info-text-small"><?php echo _("(Required)") ?></span>:
</label> </label>
<label class="required" for="msRequiresAuth"> <label class="required" for="msRequiresAuth">
@ -71,7 +71,7 @@
<dt id="email-label" class="block-display"> <dt id="email-label" class="block-display">
<label class="required" for="email"><?php echo $this->element->getElement('email')->getLabel() ?> <label class="required" for="email"><?php echo $this->element->getElement('email')->getLabel() ?>
<span class="info-text-small"><?php _("(Required)") ?></span>: <span class="info-text-small"><?php echo _("(Required)") ?></span>:
</label> </label>
</dt> </dt>
<dd id="email-element" class="block-display"> <dd id="email-element" class="block-display">
@ -87,7 +87,7 @@
<dt id="password-label" class="block-display"> <dt id="password-label" class="block-display">
<label class="required" for="password"><?php echo $this->element->getElement('ms_password')->getLabel() ?> <label class="required" for="password"><?php echo $this->element->getElement('ms_password')->getLabel() ?>
<span class="info-text-small"><?php _("(Required)") ?></span>: <span class="info-text-small"><?php echo _("(Required)") ?></span>:
</label> </label>
</dt> </dt>
<dd id="password-element" class="block-display"> <dd id="password-element" class="block-display">

View file

@ -117,7 +117,7 @@
</span><br> </span><br>
<?php } ?> <?php } ?>
<div id="master_dj_connection_url_actions" style="display:none"> <div id="master_dj_connection_url_actions" style="display:none">
<a href=# id="ok" style="font-size: 12px;"><? echo _("OK") ?></a><? echo _(" "); ?><a href=# id="reset" style="font-size: 12px;"><? echo _("RESET"); ?></a> <a href=# id="ok" style="font-size: 12px;"><? echo _("OK") ?></a> <a href=# id="reset" style="font-size: 12px;"><? echo _("RESET"); ?></a>
</div> </div>
</dd> </dd>
<dt id="dj_harbor_input_port-label"> <dt id="dj_harbor_input_port-label">
@ -161,7 +161,7 @@
</span><br> </span><br>
<?php } ?> <?php } ?>
<div id="live_dj_connection_url_actions" style="display:none"> <div id="live_dj_connection_url_actions" style="display:none">
<a href=# id="ok" style="font-size: 12px;"><? echo _("OK") ?></a><? echo _(" "); ?><a href=# id="reset" style="font-size: 12px;"><? echo _("RESET"); ?></a> <a href=# id="ok" style="font-size: 12px;"><? echo _("OK") ?></a> <a href=# id="reset" style="font-size: 12px;"><? echo _("RESET"); ?></a>
</div> </div>
</dd> </dd>
</dl> </dl>

View file

@ -4,7 +4,7 @@
<?php echo $this->element->getElement('sb_time_end'); ?> <?php echo $this->element->getElement('sb_time_end'); ?>
<a id="sb_submit" class="btn btn-small" href="#" title="Display shows in the specified date and time range"> <a id="sb_submit" class="btn btn-small" href="#" title="Display shows in the specified date and time range">
<i class="icon-white icon-search"></i><? echo _(" Find Shows") ?></a> <i class="icon-white icon-search"></i><? echo " "._("Find Shows") ?></a>
<div class="sb-advanced-options"> <div class="sb-advanced-options">
<fieldset class="padded display_field push-down-8 closed"> <fieldset class="padded display_field push-down-8 closed">
<legend style="cursor: pointer;"> <legend style="cursor: pointer;">

View file

@ -130,7 +130,7 @@
<?php <?php
} else { } else {
?> ?>
0 <?php echo _(" files meet the criteria")?> 0 <?php echo " "._("files meet the criteria")?>
</span> </span>
<span class='sp-warning-icon' id='sp_pool_count_icon'></span> <span class='sp-warning-icon' id='sp_pool_count_icon'></span>
<?php <?php

View file

@ -43,7 +43,7 @@
<dl id="public-info" style="display:<?php echo "none"?>;"> <dl id="public-info" style="display:<?php echo "none"?>;">
<dt id="stationName-label" class="block-display"> <dt id="stationName-label" class="block-display">
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?> <label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?>
<span class="info-text-small">(Required)</span>: <span class="info-text-small"><?php echo _("(Required)")?></span>:
</label> </label>
</dt> </dt>
<dd id="stationName-element" class="block-display"> <dd id="stationName-element" class="block-display">
@ -58,7 +58,7 @@
</dd> </dd>
<dt id="Phone-label" class="block-display"> <dt id="Phone-label" class="block-display">
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label> <label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
<span class="info-text-small">(for verification purposes only, will not be published)</span> <span class="info-text-small"><?php echo _("(for verification purposes only, will not be published)")?></span>
</dt> </dt>
<dd id="Phone-element" class="block-display"> <dd id="Phone-element" class="block-display">
<?php echo $this->element->getElement('Phone') ?> <?php echo $this->element->getElement('Phone') ?>
@ -148,7 +148,7 @@
<?php echo $this->element->getElement('Logo') ?> <?php echo $this->element->getElement('Logo') ?>
<div class="info-text"> <div class="info-text">
<p><?php echo ("Note: Anything larger than 600x600 will be resized.")?></p> <p><?php echo _("Note: Anything larger than 600x600 will be resized.")?></p>
</div> </div>
<?php if($this->element->getElement('Logo')->hasErrors()) : ?> <?php if($this->element->getElement('Logo')->hasErrors()) : ?>
<ul class='errors'> <ul class='errors'>

View file

@ -3,7 +3,7 @@
<div class="text-row"><strong><? echo _("Previous:"); ?></strong> <span id='previous'></span> <span id='prev-length'></span></div> <div class="text-row"><strong><? echo _("Previous:"); ?></strong> <span id='previous'></span> <span id='prev-length'></span></div>
<div class="now-playing-info song"> <div class="now-playing-info song">
<div class="time-flow"><span class="time-elapsed" id="time-elapsed"></span><span class="time-remaining" id="time-remaining"></span></div> <div class="time-flow"><span class="time-elapsed" id="time-elapsed"></span><span class="time-remaining" id="time-remaining"></span></div>
<span id='current'></span><? echo _(" "); ?><span class="length" id="song-length"></span><? echo _(" ") ?></div> <span id='current'></span><span class="length" id="song-length"></span></div>
<div class="progressbar"> <div class="progressbar">
<div class="progress-song" id="progress-bar" style="width:0%;"></div> <div class="progress-song" id="progress-bar" style="width:0%;"></div>
</div> </div>
@ -42,7 +42,7 @@
<div class="line-to-on-air"></div> <div class="line-to-on-air"></div>
</li> </li>
<li> <li>
<div id="scheduled_play_div" class="source-label"><? echo _(" Scheduled Play") ?></div> <div id="scheduled_play_div" class="source-label"><? echo " "._("Scheduled Play") ?></div>
<div class="line-to-switch"></div> <div class="line-to-switch"></div>
<a href="#" id="scheduled_play" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->scheduled_play_switch?></span></a> <a href="#" id="scheduled_play" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->scheduled_play_switch?></span></a>
<div class="line-to-on-air"></div> <div class="line-to-on-air"></div>

View file

@ -30,11 +30,11 @@ var AIRTIME = (function(AIRTIME) {
var objType = $('#obj_type').val(), var objType = $('#obj_type').val(),
btnText; btnText;
if (objType === 'playlist') { if (objType === 'playlist') {
btnText = $.i18n._(' Add to current playlist'); btnText = ' '+$.i18n._('Add to current playlist');
} else if (objType === 'block') { } else if (objType === 'block') {
btnText = $.i18n._(' Add to current smart block'); btnText = ' '+$.i18n._('Add to current smart block');
} else { } else {
btnText = $.i18n._(' Add to current playlist'); btnText = ' '+$.i18n._('Add to current playlist');
} }
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), btnText); AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), btnText);
}; };

View file

@ -21,7 +21,7 @@ var AIRTIME = (function(AIRTIME) {
AIRTIME.button.disableButton("btn-group #library-plus", false); AIRTIME.button.disableButton("btn-group #library-plus", false);
} }
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), $.i18n._(' Add to selected show')); AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), ' '+$.i18n._('Add to selected show'));
}; };
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {