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

@ -46,8 +46,8 @@ class LocaleController extends Zend_Controller_Action
"This version is no longer supported." => _("This version is no longer supported."), "This version is no longer supported." => _("This version is no longer supported."),
"Please upgrade to " => _("Please upgrade to "), "Please upgrade to " => _("Please upgrade to "),
//library/events/library_playlistbuilder.js //library/events/library_playlistbuilder.js
" Add to current playlist" => _(" Add to current playlist"), "Add to current playlist" => _("Add to current playlist"),
" Add to current smart block" => _(" Add to current smart block"), "Add to current smart block" => _("Add to current smart block"),
"Adding 1 Item" => _("Adding 1 Item"), "Adding 1 Item" => _("Adding 1 Item"),
"Adding %s Items" => _("Adding %s Items"), "Adding %s Items" => _("Adding %s Items"),
"You can only add tracks to smart blocks." => _("You can only add tracks to smart blocks."), "You can only add tracks to smart blocks." => _("You can only add tracks to smart blocks."),
@ -57,7 +57,7 @@ class LocaleController extends Zend_Controller_Action
//"Adding 1 Item" => _("Adding 1 Item"), //"Adding 1 Item" => _("Adding 1 Item"),
//"Adding %s Items" => _("Adding %s Items"), //"Adding %s Items" => _("Adding %s Items"),
//library/library.js //library/library.js
" Add to selected show" => _(" Add to selected show"), "Add to selected show" => _("Add to selected show"),
"Select" => _("Select"), "Select" => _("Select"),
"Select this page" => _("Select this page"), "Select this page" => _("Select this page"),
"Deselect this page" => _("Deselect this page"), "Deselect this page" => _("Deselect this page"),
@ -311,10 +311,10 @@ class LocaleController extends Zend_Controller_Action
"Show / hide columns" => _("Show / hide columns"), "Show / hide columns" => _("Show / hide columns"),
//datatables.columnFilter.js //datatables.columnFilter.js
"From {from} to {to}" => _("From {from} to {to}"), "From {from} to {to}" => _("From {from} to {to}"),
" kbps" => _(" kbps"), "kbps" => _("kbps"),
" yyyy-mm-dd" => _(" yyyy-mm-dd"), "yyyy-mm-dd" => _("yyyy-mm-dd"),
" hh:mm:ss.t" => _(" hh:mm:ss.t"), "hh:mm:ss.t" => _("hh:mm:ss.t"),
" kHz" => _(" kHz"), "kHz" => _("kHz"),
//datepicker //datepicker
//months are already in schedule/schedule.js //months are already in schedule/schedule.js
"Su" => _("Su"), "Su" => _("Su"),

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) {

View File

@ -88,13 +88,13 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
+ +
+ var label = ""; + var label = "";
+ if (th.attr('id') == "bit_rate") { + if (th.attr('id') == "bit_rate") {
+ label = $.i18n._(" kbps"); + label = $.i18n._("kbps");
+ } else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") { + } else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") {
+ label = $.i18n._(" yyyy-mm-dd"); + label = $.i18n._("yyyy-mm-dd");
+ } else if (th.attr('id') == "length") { + } else if (th.attr('id') == "length") {
+ label = $.i18n._(" hh:mm:ss.t"); + label = $.i18n._("hh:mm:ss.t");
+ } else if (th.attr('id') == "sample_rate") { + } else if (th.attr('id') == "sample_rate") {
+ label = $.i18n._(" kHz"); + label = $.i18n._("kHz");
+ } + }
+ +
th.html(_fnRangeLabelPart(0)); th.html(_fnRangeLabelPart(0));

View File

@ -184,13 +184,13 @@
var label = ""; var label = "";
if (th.attr('id') == "bit_rate") { if (th.attr('id') == "bit_rate") {
label = $.i18n._(" kbps"); label = $.i18n._("kbps");
} else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") { } else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") {
label = $.i18n._(" yyyy-mm-dd"); label = $.i18n._("yyyy-mm-dd");
} else if (th.attr('id') == "length") { } else if (th.attr('id') == "length") {
label = $.i18n._(" hh:mm:ss.t"); label = $.i18n._("hh:mm:ss.t");
} else if (th.attr('id') == "sample_rate") { } else if (th.attr('id') == "sample_rate") {
label = $.i18n._(" kHz"); label = $.i18n._("kHz");
} }
th.html(_fnRangeLabelPart(0)); th.html(_fnRangeLabelPart(0));