Made several reoccurring strings into application constants and altered any static strings containing them to use these constants in string format calls.

This commit is contained in:
Duncan Sommerville 2014-11-06 18:24:29 -05:00
parent 62a915f109
commit 795e239ff3
14 changed files with 101 additions and 67 deletions

View file

@ -768,7 +768,7 @@ class ApiController extends Zend_Controller_Action
//File is not in database anymore. //File is not in database anymore.
if (is_null($file)) { if (is_null($file)) {
$return_hash['error'] = _("File does not exist in Airtime."); $return_hash['error'] = sprintf(_("File does not exist in %s"), PRODUCT_NAME);
} }
//Updating a metadata change. //Updating a metadata change.
else { else {
@ -788,7 +788,7 @@ class ApiController extends Zend_Controller_Action
$md['MDATA_KEY_ORIGINAL_PATH'], $con); $md['MDATA_KEY_ORIGINAL_PATH'], $con);
if (is_null($file)) { if (is_null($file)) {
$return_hash['error'] = _('File does not exist in Airtime'); $return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME);
} else { } else {
$filepath = $md['MDATA_KEY_FILEPATH']; $filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath); //$filepath = str_replace("\\", "", $filepath);
@ -800,7 +800,7 @@ class ApiController extends Zend_Controller_Action
$file = Application_Model_StoredFile::RecallByFilepath($filepath, $con); $file = Application_Model_StoredFile::RecallByFilepath($filepath, $con);
if (is_null($file)) { if (is_null($file)) {
$return_hash['error'] = _("File doesn't exist in Airtime."); $return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME);
Logging::warn("Attempt to delete file that doesn't exist. Logging::warn("Attempt to delete file that doesn't exist.
Path: '$filepath'"); Path: '$filepath'");
} else { } else {

View file

@ -7,7 +7,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
public function init() public function init()
{ {
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth"); $cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
$cb_airtime_auth->setLabel(_("Use Airtime Authentication:")) $cb_airtime_auth->setLabel(sprintf(_("Use %s Authentication:"), PRODUCT_NAME))
->setRequired(false) ->setRequired(false)
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($cb_airtime_auth); $this->addElement($cb_airtime_auth);

View file

@ -123,7 +123,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// checkbox for publicise // checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
$checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org')) $checkboxPublicise->setLabel(sprintf(_('Promote my station on %s'), COMPANY_SITE))
->setRequired(false) ->setRequired(false)
->setDecorators(array('ViewHelper')) ->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise()); ->setValue(Application_Model_Preference::GetPublicise());
@ -143,11 +143,14 @@ class Application_Form_RegisterAirtime extends Zend_Form
) )
)); ));
$privacyPolicyAnchorOpen = "<a id='link_to_privacy' href='" . PRIVACY_POLICY_URL
. "' onclick='window.open(this.href); return false;'>";
// checkbox for privacy policy // checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel( $checkboxPrivacy->setLabel(
sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."), sprintf(_('By checking this box, I agree to %s\'s %sprivacy policy%s.'),
"<a id='link_to_privacy' href='http://www.sourcefabric.org/en/about/policy/' onclick='window.open(this.href); return false;'>", COMPANY_NAME,
$privacyPolicyAnchorOpen,
"</a>")) "</a>"))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy); $this->addElement($checkboxPrivacy);

View file

@ -119,7 +119,7 @@ class Application_Form_SupportSettings extends Zend_Form
// checkbox for publicise // checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
$checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org')) $checkboxPublicise->setLabel(sprintf(_('Promote my station on %s'), COMPANY_SITE))
->setRequired(false) ->setRequired(false)
->setDecorators(array('ViewHelper')) ->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise()); ->setValue(Application_Model_Preference::GetPublicise());
@ -142,11 +142,14 @@ class Application_Form_SupportSettings extends Zend_Form
) )
)); ));
$privacyPolicyAnchorOpen = "<a id='link_to_privacy' href='" . PRIVACY_POLICY_URL
. "' onclick='window.open(this.href); return false;'>";
// checkbox for privacy policy // checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel( $checkboxPrivacy->setLabel(
sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."), sprintf(_('By checking this box, I agree to %s\'s %sprivacy policy%s.'),
"<a id='link_to_privacy' href='http://www.sourcefabric.org/en/about/policy/' onclick='window.open(this.href); return false;'>", COMPANY_NAME,
$privacyPolicyAnchorOpen,
"</a>")) "</a>"))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy); $this->addElement($checkboxPrivacy);

View file

@ -13,9 +13,20 @@
<?php echo $this->layout()->content ?> <?php echo $this->layout()->content ?>
</div> </div>
<div class="footer"> <div class="footer">
<?php echo sprintf(_("Airtime copyright &copy; Sourcefabric z.ú. All rights reserved.%s" <?php
."Maintained and distributed under the GNU GPL v.3 by %sSourcefabric z.ú.%s"), $company = COMPANY_NAME . " " . COMPANY_SUFFIX;
"<br>", "<a href='http://www.sourcefabric.org'>" ,"</a>");?> $licenseSiteAnchor = "<a href='" . LICENSE_URL . "'>"
. LICENSE_VERSION
. "</a>";
$companySiteAnchor = "<a href='" . COMPANY_SITE_URL . "'>"
. $company
. "</a>";
echo sprintf(_('%1$s copyright &copy; %2$s All rights reserved.%3$s'
. 'Maintained and distributed under the %4$s by %5$s'),
PRODUCT_NAME, $company, "<br>",
$licenseSiteAnchor,
$companySiteAnchor);
?>
</div> </div>
</body> </body>

View file

@ -33,7 +33,8 @@ class Application_Model_Auth
$message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin()); $message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin());
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}"; $message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
$success = Application_Model_Email::send(_('Airtime Password Reset'), $message, $user->getDbEmail()); $str = sprintf(_('%s Password Reset'), PRODUCT_NAME);
$success = Application_Model_Email::send($str, $message, $user->getDbEmail());
return $success; return $success;
} }

View file

@ -2,19 +2,25 @@
<h2><?php echo _("About") ?></h2> <h2><?php echo _("About") ?></h2>
<p> <p>
<?php <?php
echo sprintf(_("%sAirtime%s %s, the open radio software for scheduling and remote station management. %s"),
"<a href='http://airtime.sourcefabric.org' target='_blank'>", $productSiteAnchor = "<a href='" . PRODUCT_SITE_URL . "' target='_blank'>"
"</a>", . PRODUCT_NAME
$this->airtime_version, . "</a>";
"<br />") echo sprintf(_('%1$s %2$s, the open radio software for scheduling and remote station management.'),
$productSiteAnchor,
$this->airtime_version)
?> ?>
<br>© 2013 <br />
<br />© 2013
<?php <?php
echo sprintf(_("%sSourcefabric%s z.ú Airtime is distributed under the %sGNU GPL v.3%s"), $companySiteAnchor = "<a href='" . COMPANY_SITE_URL . "' target='_blank'>"
"<a href='http://www.sourcefabric.org' target='_blank'>", . COMPANY_NAME . " " . COMPANY_SUFFIX
"</a>", . "</a>";
"<a href='http://www.gnu.org/licenses/gpl-3.0-standalone.html' target='_blank'>", $licenseAnchor = "<a href='" . LICENSE_URL . "' target='_blank'>"
"</a>") . LICENSE_VERSION
. "</a>";
echo sprintf(_('%1$s %2$s is distributed under the %3$s'),
$companySiteAnchor, PRODUCT_NAME, $licenseAnchor)
?> ?>
</p> </p>
</div> </div>

View file

@ -1,7 +1,7 @@
<div class="gray-logo"></div> <div class="gray-logo"></div>
<div class="text-content"> <div class="text-content">
<h2><?php echo _("Welcome to Airtime!") ?></h2> <h2><?php echo sprintf(_("Welcome to %s!"), PRODUCT_NAME) ?></h2>
<p><?php echo _("Here's how you can get started using Airtime to automate your broadcasts: ")?></p> <p><?php echo sprintf(_("Here's how you can get started using %s to automate your broadcasts: "), PRODUCT_NAME)?></p>
<ol> <ol>
<li><?php echo _("Begin by adding your files to the library using the 'Add Media' menu button. You can drag and drop your files to this window too.")?></li> <li><?php echo _("Begin by adding your files to the library using the 'Add Media' menu button. You can drag and drop your files to this window too.")?></li>
@ -10,8 +10,12 @@
<li><?php echo _("Select your media from the left pane and drag them to your show in the right pane."); ?></li> <li><?php echo _("Select your media from the left pane and drag them to your show in the right pane."); ?></li>
</ol> </ol>
<p><strong><?php echo _("Then you're good to go!")?></strong><br /> <p><strong><?php echo _("Then you're good to go!")?></strong><br />
<?php echo sprintf(_("For more detailed help, read the %suser manual%s."), <?php
"<a href='http://www.sourcefabric.org/en/airtime/manuals/' target='_blank'>", $userManualAnchorOpen = "<a href='" . USER_MANUAL_URL . "' target='_blank'>";
"</a>") ?></p> echo sprintf(_("For more detailed help, read the %suser manual%s."),
$userManualAnchorOpen, "</a>")
?>
</p>
</div> </div>

View file

@ -40,9 +40,8 @@
<?php foreach($watched_dirs as $watched_dir): ?> <?php foreach($watched_dirs as $watched_dir): ?>
<dd class="block-display selected-item"> <dd class="block-display selected-item">
<?php echo ($watched_dir->getExistsFlag())?"":"<span class='ui-icon-alert'><img src='/css/images/warning-icon.png'></span>"?><span id="folderPath" style="display:block; width:350px"><?php echo htmlspecialchars($watched_dir->getDirectory());?></span></span> <?php echo ($watched_dir->getExistsFlag())?"":"<span class='ui-icon-alert'><img src='/css/images/warning-icon.png'></span>"?><span id="folderPath" style="display:block; width:350px"><?php echo htmlspecialchars($watched_dir->getDirectory());?></span></span>
<span title="<?php echo _("Rescan watched directory (This is useful if it is network mount and may be out of sync with Airtime)")?>" class="ui-icon ui-icon-refresh"></span> <span title="<?php echo sprintf(_("Rescan watched directory (This is useful if it is network mount and may be out of sync with %s)"), PRODUCT_NAME)?>" class="ui-icon ui-icon-refresh"></span>
<span title="<?php echo _("Remove watched directory")?>" class="ui-icon ui-icon-close"></span> <span title="<?php echo _("Remove watched directory")?>" class="ui-icon ui-icon-close"></span>
</dd> </dd>
<?php endforeach; ?> <?php endforeach; ?>
<?php else: ?> <?php else: ?>

View file

@ -3,10 +3,10 @@
<fieldset> <fieldset>
<dl class="zend_form"> <dl class="zend_form">
<dt class="block-display info-text"> <dt class="block-display info-text">
<?php echo sprintf(_("Help Airtime improve by letting us know how you are using it. This info " <?php echo sprintf(_('Help %1$s improve by letting us know how you are using it. This info '
."will be collected regularly in order to enhance your user experience.%s" .'will be collected regularly in order to enhance your user experience.%2$s'
."Click 'Yes, help Airtime' and we'll make sure the features you use are " .'Click \'Yes, help %1$s\' and we\'ll make sure the features you use are '
."constantly improving."), "<br /><br />") ?> .'constantly improving.'), PRODUCT_NAME, "<br /><br />") ?>
</dt> </dt>
<dd id="SupportFeedback-element" class="block-display"> <dd id="SupportFeedback-element" class="block-display">
<label class="optional" for="SupportFeedback"> <label class="optional" for="SupportFeedback">
@ -22,10 +22,12 @@
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt class="block-display info-text"> <dt class="block-display info-text">
<?php echo sprintf(_("Click the box below to advertise your station on %sSourcefabric.org%s." <?php
." In order to promote your station, 'Send support feedback' must be enabled. This data will be collected in addition to the support feedback."), $whosUsingAnchor = "<a id='link_to_whos_using' href='" . WHOS_USING_URL . "' onclick='window.open(this.href); return false'>"
"<a id='link_to_whos_using' href='http://sourcefabric.org/en/airtime/whosusing' onclick='window.open(this.href); return false'>", . COMPANY_SITE
"</a>")?> . "</a>";
echo sprintf(_("Click the box below to promote your station on %s."), $whosUsingAnchor)
?>
</dt> </dt>
<dd id="publicize-element" class="block-display"> <dd id="publicize-element" class="block-display">
<label class="optional" for="Publicise"> <label class="optional" for="Publicise">
@ -175,7 +177,7 @@
<?php echo $this->element->getElement('Privacy')->getLabel() ?> <?php echo $this->element->getElement('Privacy')->getLabel() ?>
</label> </label>
<?php }else{?> <?php }else{?>
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;"><?php echo _("Terms and Conditions") ?></a> <a id="link_to_terms_and_condition" href="<?php echo TERMS_AND_CONDITIONS_URL ?>" onclick="window.open(this.href); return false;"><?php echo _("Terms and Conditions") ?></a>
<?php }?> <?php }?>
</div> </div>
</form> </form>

View file

@ -2,9 +2,10 @@
<dl class="zend_form"> <dl class="zend_form">
<dd id="SupportFeedback-element" style="width:90%;"> <dd id="SupportFeedback-element" style="width:90%;">
<div class="info-text"> <div class="info-text">
<?php echo sprintf(_("Help Airtime improve by letting Sourcefabric know how you are using it. This information" <?php echo sprintf(_("Help %s improve by letting %s know how you are using it. This information"
." will be collected regularly in order to enhance your user experience.%s" ." will be collected regularly in order to enhance your user experience.%s"
."Click the 'Send support feedback' box and we'll make sure the features you use are constantly improving."), "<br />")?> ."Click the 'Send support feedback' box and we'll make sure the features you use are constantly improving."),
PRODUCT_NAME, COMPANY_NAME, "<br />")?>
</div> </div>
<label class="optional" for="SupportFeedback"> <label class="optional" for="SupportFeedback">
<?php echo $this->element->getElement('SupportFeedback') ?> <?php echo $this->element->getElement('SupportFeedback') ?>
@ -20,9 +21,13 @@
</dd> </dd>
<dd id="publicize-element" style="width:90%;"> <dd id="publicize-element" style="width:90%;">
<div class="info-text"> <div class="info-text">
<?php echo sprintf(_("Click the box below to promote your station on %sSourcefabric.org%s."), <?php
"<a id='link_to_whos_using' href='http://www.sourcefabric.org/en/airtime/whosusing/' onclick='window.open(this.href); return false'>",
"</a>")?> $whosUsingAnchor = "<a id='link_to_whos_using' href='" . WHOS_USING_URL . "' onclick='window.open(this.href); return false'>"
. COMPANY_SITE
. "</a>";
echo sprintf(_("Click the box below to promote your station on %s."), $whosUsingAnchor)
?>
</div> </div>
<label class="optional" for="Publicise"> <label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?> <?php echo $this->element->getElement('Publicise') ?>
@ -183,7 +188,7 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
<?php }else{?> <?php }else{?>
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;"><?php echo _("Sourcefabric Privacy Policy") ?></a> <a id="link_to_terms_and_condition" href="<?php echo PRIVACY_POLICY_URL ?>" onclick="window.open(this.href); return false;"><?php echo _("Sourcefabric Privacy Policy") ?></a>
<?php }?> <?php }?>
</div> </div>
</fieldset> </fieldset>

View file

@ -4,7 +4,7 @@
<div id="login" class="login-content clearfix"> <div id="login" class="login-content clearfix">
<?php if(isset($this->demo) && $this->demo == 1){?> <?php if(isset($this->demo) && $this->demo == 1){?>
<p style="font-weight:bold"> <p style="font-weight:bold">
<?php echo _("Welcome to the Airtime demo! You can log in using the username 'admin' and the password 'admin'.")?> <?php echo sprintf(_("Welcome to the %s demo! You can log in using the username 'admin' and the password 'admin'."), PRODUCT_NAME)?>
</p> </p>
<?php }?> <?php }?>
<p class="light" style='<?php echo $this->error?"color:#902d2d;font-size:11px;padding:2px 4px;background:#c6b4b4;margin-bottom:2px;border:1px solid #c83f3f;":""?>'><?php echo $this->message; ?></p> <p class="light" style='<?php echo $this->error?"color:#902d2d;font-size:11px;padding:2px 4px;background:#c6b4b4;margin-bottom:2px;border:1px solid #c83f3f;":""?>'><?php echo $this->message; ?></p>

View file

@ -6,7 +6,7 @@
<div class="trial-box-calendar-gray"><?php echo _("days") ?></div> <div class="trial-box-calendar-gray"><?php echo _("days") ?></div>
</div> </div>
<div class="trial-box-button"> <div class="trial-box-button">
<a title="<?php echo _("Purchase your copy of Airtime")?> href="https://account.sourcefabric.com/clientarea.php" target="_blank"><?php echo _("My Account") ?></a> <a title="<?php echo sprintf(_("Purchase your copy of %s"), PRODUCT_NAME)?> href="https://account.sourcefabric.com/clientarea.php" target="_blank"><?php echo _("My Account") ?></a>
</div> </div>
</div> </div>
<?php }?> <?php }?>

View file

@ -11,7 +11,7 @@
<tbody> <tbody>
<!-- <!--
<tr class="odd"> <tr class="odd">
<td><?php echo _("Airtime Version") ?></td> <td><?php echo sprintf(_("%s Version"), PRODUCT_NAME) ?></td>
<td>1.9.3</td> <td>1.9.3</td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>