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->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"),
_("Enabled")));
$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);
//liquidsoap harbor.input port
$betweenValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(1024, 49151);
$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"))
->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.'))))
->setDecorators(array('ViewHelper'));
$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->setLabel(_("Show Source 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.'))))
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_port);

View File

@ -191,7 +191,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$user->setAttrib('alt', 'regular_text');
$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(
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()
{
$country_list = Application_Model_Preference::GetCountryList();
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/support-setting.phtml')),
@ -20,7 +21,7 @@ class Application_Form_SupportSettings extends Zend_Form
'label' => _('Station Name'),
'required' => true,
'filters' => array('StringTrim'),
'validator' => array('NotEmpty'),
'validators' => array($notEmptyValidator),
'value' => Application_Model_Preference::GetStationName(),
'decorators' => array(
'ViewHelper'

View File

@ -61,11 +61,23 @@ Class Application_Form_Helper_ValidationTypes {
);
$validator->setMessage(
_("'%value%' is less than %max% characters long"),
_("'%value%' is more than %max% characters long"),
Zend_Validate_StringLength::TOO_LONG
);
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";
$res = $con->query($sql)->fetchAll();
$out = array();
$out[""] = "Select Country";
$out[""] = _("Select Country");
foreach ($res as $r) {
$out[$r["isocode"]] = $r["name"];
}

View File

@ -41,7 +41,7 @@
<dt id="mailServer-label" class="block-display">
<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 class="required" for="msRequiresAuth">
@ -71,7 +71,7 @@
<dt id="email-label" class="block-display">
<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>
</dt>
<dd id="email-element" class="block-display">
@ -87,7 +87,7 @@
<dt id="password-label" class="block-display">
<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>
</dt>
<dd id="password-element" class="block-display">

View File

@ -117,7 +117,7 @@
</span><br>
<?php } ?>
<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>
</dd>
<dt id="dj_harbor_input_port-label">
@ -161,7 +161,7 @@
</span><br>
<?php } ?>
<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>
</dd>
</dl>

View File

@ -4,7 +4,7 @@
<?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">
<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">
<fieldset class="padded display_field push-down-8 closed">
<legend style="cursor: pointer;">

View File

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

View File

@ -43,7 +43,7 @@
<dl id="public-info" style="display:<?php echo "none"?>;">
<dt id="stationName-label" class="block-display">
<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>
</dt>
<dd id="stationName-element" class="block-display">
@ -58,7 +58,7 @@
</dd>
<dt id="Phone-label" class="block-display">
<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>
<dd id="Phone-element" class="block-display">
<?php echo $this->element->getElement('Phone') ?>
@ -148,7 +148,7 @@
<?php echo $this->element->getElement('Logo') ?>
<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>
<?php if($this->element->getElement('Logo')->hasErrors()) : ?>
<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="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>
<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="progress-song" id="progress-bar" style="width:0%;"></div>
</div>
@ -42,7 +42,7 @@
<div class="line-to-on-air"></div>
</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>
<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>

View File

@ -30,11 +30,11 @@ var AIRTIME = (function(AIRTIME) {
var objType = $('#obj_type').val(),
btnText;
if (objType === 'playlist') {
btnText = $.i18n._(' Add to current playlist');
btnText = ' '+$.i18n._('Add to current playlist');
} else if (objType === 'block') {
btnText = $.i18n._(' Add to current smart block');
btnText = ' '+$.i18n._('Add to current smart block');
} else {
btnText = $.i18n._(' Add to current playlist');
btnText = ' '+$.i18n._('Add to current playlist');
}
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.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) {