diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index 6b52c2a9c..6a7a2c896 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -10,6 +10,7 @@ require_once 'Preference.php';
require_once "DateHelper.php";
require_once "OsPath.php";
require_once "Database.php";
+require_once __DIR__.'/forms/helpers/ValidationTypes.php';
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
@@ -31,6 +32,19 @@ Zend_Validate::setDefaultNamespaces("Zend");
$front = Zend_Controller_Front::getInstance();
$front->registerPlugin(new RabbitMqPlugin());
+//localization configuration
+$codeset = 'UTF-8';
+$lang = Application_Model_Preference::GetLocale().'.'.$codeset;
+
+putenv("LC_ALL=$lang");
+putenv("LANG=$lang");
+$res = setlocale(LC_MESSAGES, $lang);
+
+$domain = 'airtime';
+bindtextdomain($domain, '/usr/share/airtime/locale');
+textdomain($domain);
+bind_textdomain_codeset($domain, $codeset);
+
/* The bootstrap class should only be used to initialize actions that return a view.
Actions that return JSON will not use the bootstrap class! */
@@ -91,6 +105,10 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'/js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/js/i18n/jquery.i18n.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $view->headScript()->appendFile($baseUrl.'/locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $view->headScript()->appendScript("$.i18n.setDictionary(general_dict)");
$view->headScript()->appendScript("var baseUrl='$baseUrl'");
//scripts for now playing bar
diff --git a/airtime_mvc/application/common/DateHelper.php b/airtime_mvc/application/common/DateHelper.php
index a22a26b4a..cc02544cd 100644
--- a/airtime_mvc/application/common/DateHelper.php
+++ b/airtime_mvc/application/common/DateHelper.php
@@ -332,10 +332,10 @@ class Application_Common_DateHelper
// if year is < 1753 or > 9999 it's out of range
if ($year < 1753) {
$retVal['success'] = false;
- $retVal['errMsg'] = "The year '$year' must be within the range of 1753 - 9999";
+ $retVal['errMsg'] = sprintf(_("The year %s must be within the range of 1753 - 9999"), $year);
} else if (!checkdate($month, $day, $year)) {
$retVal['success'] = false;
- $retVal['errMsg'] = "'$year-$month-$day' is not a valid date";
+ $retVal['errMsg'] = sprintf(_("%s-%s-%s is not a valid date"), $year, $month, $day);
} else {
// check time
if (isset($timeInfo)) {
@@ -359,7 +359,7 @@ class Application_Common_DateHelper
if ( ($hour < 0 || $hour > 23) || ($min < 0 || $min > 59) || ($sec < 0 || $sec > 59) ) {
$retVal['success'] = false;
- $retVal['errMsg'] = "'$timeInfo[0]:$timeInfo[1]:$timeInfo[2]' is not a valid time";
+ $retVal['errMsg'] = sprintf(_("%s:%s:%s is not a valid time"), $timeInfo[0], $timeInfo[1] ,$timeInfo[2]);
}
}
}
diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php
index 6687011a4..46ec0c6a3 100644
--- a/airtime_mvc/application/configs/ACL.php
+++ b/airtime_mvc/application/configs/ACL.php
@@ -26,7 +26,8 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('listenerstat'))
->add(new Zend_Acl_Resource('usersettings'))
->add(new Zend_Acl_Resource('audiopreview'))
- ->add(new Zend_Acl_Resource('webstream'));
+ ->add(new Zend_Acl_Resource('webstream'))
+ ->add(new Zend_Acl_Resource('locale'));
/** Creating permissions */
$ccAcl->allow('G', 'index')
@@ -38,6 +39,7 @@ $ccAcl->allow('G', 'index')
->allow('G', 'dashboard')
->allow('G', 'audiopreview')
->allow('G', 'webstream')
+ ->allow('G', 'locale')
->allow('H', 'preference', 'is-import-in-progress')
->allow('H', 'usersettings')
->allow('H', 'plupload')
diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php
index bc786f729..ef0357425 100644
--- a/airtime_mvc/application/configs/classmap-airtime-conf.php
+++ b/airtime_mvc/application/configs/classmap-airtime-conf.php
@@ -197,4 +197,11 @@ return array (
'BaseCcListenerCountPeer' => 'airtime/om/BaseCcListenerCountPeer.php',
'BaseCcListenerCount' => 'airtime/om/BaseCcListenerCount.php',
'BaseCcListenerCountQuery' => 'airtime/om/BaseCcListenerCountQuery.php',
+ 'CcLocaleTableMap' => 'airtime/map/CcLocaleTableMap.php',
+ 'CcLocalePeer' => 'airtime/CcLocalePeer.php',
+ 'CcLocale' => 'airtime/CcLocale.php',
+ 'CcLocaleQuery' => 'airtime/CcLocaleQuery.php',
+ 'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php',
+ 'BaseCcLocale' => 'airtime/om/BaseCcLocale.php',
+ 'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php',
);
\ No newline at end of file
diff --git a/airtime_mvc/application/configs/navigation.php b/airtime_mvc/application/configs/navigation.php
index 59ce874fe..32b4af39d 100644
--- a/airtime_mvc/application/configs/navigation.php
+++ b/airtime_mvc/application/configs/navigation.php
@@ -9,85 +9,85 @@
*/
$pages = array(
array(
- 'label' => 'Now Playing',
+ 'label' => _('Now Playing'),
'module' => 'default',
'controller' => 'Showbuilder',
'action' => 'index',
'resource' => 'showbuilder'
),
array(
- 'label' => 'Add Media',
+ 'label' => _('Add Media'),
'module' => 'default',
'controller' => 'Plupload',
'action' => 'index',
'resource' => 'plupload'
),
array(
- 'label' => 'Library',
+ 'label' => _('Library'),
'module' => 'default',
'controller' => 'Library',
'action' => 'index',
'resource' => 'playlist'
),
array(
- 'label' => 'Calendar',
+ 'label' => _('Calendar'),
'module' => 'default',
'controller' => 'Schedule',
'action' => 'index',
'resource' => 'schedule'
),
array(
- 'label' => 'System',
+ 'label' => _('System'),
'uri' => '#',
'resource' => 'preference',
'pages' => array(
array(
- 'label' => 'Preferences',
+ 'label' => _('Preferences'),
'module' => 'default',
'controller' => 'Preference'
),
array(
- 'label' => 'Users',
+ 'label' => _('Users'),
'module' => 'default',
'controller' => 'user',
'action' => 'add-user',
'resource' => 'user'
),
array(
- 'label' => 'Media Folders',
+ 'label' => _('Media Folders'),
'module' => 'default',
'controller' => 'Preference',
'action' => 'directory-config',
'id' => 'manage_folder'
),
array(
- 'label' => 'Streams',
+ 'label' => _('Streams'),
'module' => 'default',
'controller' => 'Preference',
'action' => 'stream-setting'
),
array(
- 'label' => 'Support Feedback',
+ 'label' => _('Support Feedback'),
'module' => 'default',
'controller' => 'Preference',
'action' => 'support-setting'
),
array(
- 'label' => 'Status',
+ 'label' => _('Status'),
'module' => 'default',
'controller' => 'systemstatus',
'action' => 'index',
'resource' => 'systemstatus'
),
array(
- 'label' => 'Playout History',
+ 'label' => _('Playout History'),
'module' => 'default',
'controller' => 'playouthistory',
'action' => 'index',
'resource' => 'playouthistory'
),
array(
- 'label' => 'Listener Stats',
+ 'label' => _('Listener Stats'),
'module' => 'default',
'controller' => 'listenerstat',
'action' => 'index',
@@ -96,24 +96,24 @@ $pages = array(
)
),
array(
- 'label' => 'Help',
+ 'label' => _('Help'),
'uri' => '#',
'resource' => 'dashboard',
'pages' => array(
array(
- 'label' => 'Getting Started',
+ 'label' => _('Getting Started'),
'module' => 'default',
'controller' => 'dashboard',
'action' => 'help',
'resource' => 'dashboard'
),
array(
- 'label' => 'User Manual',
+ 'label' => _('User Manual'),
'uri' => "http://www.sourcefabric.org/en/airtime/manuals/",
'target' => "_blank"
),
array(
- 'label' => 'About',
+ 'label' => _('About'),
'module' => 'default',
'controller' => 'dashboard',
'action' => 'about',
diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php
index 44ad714e6..63625335c 100644
--- a/airtime_mvc/application/controllers/ApiController.php
+++ b/airtime_mvc/application/controllers/ApiController.php
@@ -53,7 +53,7 @@ class ApiController extends Zend_Controller_Action
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read())) {
header('HTTP/1.0 401 Unauthorized');
- print 'You are not allowed to access this resource.';
+ print _('You are not allowed to access this resource.');
exit;
}
}
@@ -80,7 +80,7 @@ class ApiController extends Zend_Controller_Action
if (is_null(Zend_Auth::getInstance()->getStorage()->read())) {
header('HTTP/1.0 401 Unauthorized');
- print 'You are not allowed to access this resource.';
+ print _('You are not allowed to access this resource.');
return;
}
@@ -282,7 +282,7 @@ class ApiController extends Zend_Controller_Action
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
} else {
header('HTTP/1.0 401 Unauthorized');
- print 'You are not allowed to access this resource. ';
+ print _('You are not allowed to access this resource. ');
exit;
}
}
@@ -321,7 +321,7 @@ class ApiController extends Zend_Controller_Action
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
} else {
header('HTTP/1.0 401 Unauthorized');
- print 'You are not allowed to access this resource. ';
+ print _('You are not allowed to access this resource. ');
exit;
}
}
@@ -502,7 +502,7 @@ class ApiController extends Zend_Controller_Action
//File is not in database anymore.
if (is_null($file)) {
- $return_hash['error'] = "File does not exist in Airtime.";
+ $return_hash['error'] = _("File does not exist in Airtime.");
return $return_hash;
}
@@ -515,7 +515,7 @@ class ApiController extends Zend_Controller_Action
$md['MDATA_KEY_ORIGINAL_PATH']);
if (is_null($file)) {
- $return_hash['error'] = 'File does not exist in Airtime';
+ $return_hash['error'] = _('File does not exist in Airtime');
} else {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
@@ -527,7 +527,7 @@ class ApiController extends Zend_Controller_Action
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
if (is_null($file)) {
- $return_hash['error'] = "File doesn't exist in Airtime.";
+ $return_hash['error'] = _("File doesn't exist in Airtime.");
Logging::warn("Attempt to delete file that doesn't exist.
Path: '$filepath'");
@@ -573,7 +573,7 @@ class ApiController extends Zend_Controller_Action
Logging::info("Received bad request(key=$k), no 'mode' parameter. Bad request is:");
Logging::info( $info_json );
array_push( $responses, array(
- 'error' => "Bad request. no 'mode' parameter passed.",
+ 'error' => _("Bad request. no 'mode' parameter passed."),
'key' => $k));
continue;
} elseif ( !in_array($info_json['mode'], $valid_modes) ) {
@@ -583,7 +583,7 @@ class ApiController extends Zend_Controller_Action
Logging::info("Received bad request(key=$k). 'mode' parameter was invalid with value: '$mode'. Request:");
Logging::info( $info_json );
array_push( $responses, array(
- 'error' => "Bad request. 'mode' parameter is invalid",
+ 'error' => _("Bad request. 'mode' parameter is invalid"),
'key' => $k,
'mode' => $mode ) );
continue;
diff --git a/airtime_mvc/application/controllers/AudiopreviewController.php b/airtime_mvc/application/controllers/AudiopreviewController.php
index afd413631..3adf3351c 100644
--- a/airtime_mvc/application/controllers/AudiopreviewController.php
+++ b/airtime_mvc/application/controllers/AudiopreviewController.php
@@ -210,7 +210,7 @@ class AudiopreviewController extends Zend_Controller_Action
throw new Exception("Unknown file type: $mime");
}
- $elementMap['uri'] = "/api/get-media/file/".$track['item_id'];
+ $elementMap['uri'] = $baseUrl."/api/get-media/file/".$track['item_id'];
} else {
$elementMap['uri'] = $track['path'];
}
diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php
index 1e693b08f..fe0a0e71c 100644
--- a/airtime_mvc/application/controllers/DashboardController.php
+++ b/airtime_mvc/application/controllers/DashboardController.php
@@ -33,9 +33,9 @@ class DashboardController extends Zend_Controller_Action
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
} else {
if ($source_connected) {
- $this->view->error = "You don't have permission to disconnect source.";
+ $this->view->error = _("You don't have permission to disconnect source.");
} else {
- $this->view->error = "There is no source connected to this input.";
+ $this->view->error = _("There is no source connected to this input.");
}
}
}
@@ -79,12 +79,12 @@ class DashboardController extends Zend_Controller_Action
}
} else {
if ($source_connected) {
- $this->view->error = "You don't have permission to switch source.";
+ $this->view->error = _("You don't have permission to switch source.");
} else {
if ($sourcename == 'scheduled_play') {
- $this->view->error = "You don't have permission to disconnect source.";
+ $this->view->error = _("You don't have permission to disconnect source.");
} else {
- $this->view->error = "There is no source connected to this input.";
+ $this->view->error = _("There is no source connected to this input.");
}
}
}
diff --git a/airtime_mvc/application/controllers/ErrorController.php b/airtime_mvc/application/controllers/ErrorController.php
index 2c1aa0b87..0a4fee725 100644
--- a/airtime_mvc/application/controllers/ErrorController.php
+++ b/airtime_mvc/application/controllers/ErrorController.php
@@ -14,12 +14,12 @@ class ErrorController extends Zend_Controller_Action
// 404 error -- controller or action not found
$this->getResponse()->setHttpResponseCode(404);
- $this->view->message = 'Page not found';
+ $this->view->message = _('Page not found');
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
- $this->view->message = 'Application error';
+ $this->view->message = _('Application error');
break;
}
diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php
index df2dd5419..3e5be64d2 100644
--- a/airtime_mvc/application/controllers/LibraryController.php
+++ b/airtime_mvc/application/controllers/LibraryController.php
@@ -90,7 +90,7 @@ class LibraryController extends Zend_Controller_Action
protected function playlistNotFound($p_type)
{
- $this->view->error = "$p_type not found";
+ $this->view->error = sprintf(_("%s not found"), $p_type);
Logging::info("$p_type not found");
Application_Model_Library::changePlaylist(null, $p_type);
@@ -99,7 +99,7 @@ class LibraryController extends Zend_Controller_Action
protected function playlistUnknownError($e)
{
- $this->view->error = "Something went wrong.";
+ $this->view->error = _("Something went wrong.");
Logging::info($e->getMessage());
}
@@ -156,7 +156,7 @@ class LibraryController extends Zend_Controller_Action
$user = new Application_Model_User($userInfo->id);
//Open a jPlayer window and play the audio clip.
- $menu["play"] = array("name"=> "Preview", "icon" => "play", "disabled" => false);
+ $menu["play"] = array("name"=> _("Preview"), "icon" => "play", "disabled" => false);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
@@ -177,19 +177,19 @@ class LibraryController extends Zend_Controller_Action
}
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($obj_sess->type === "playlist") {
- $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
+ $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy");
} elseif ($obj_sess->type === "block" && $obj->isStatic()) {
- $menu["pl_add"] = array("name"=> "Add to Smart Block", "icon" => "add-playlist", "icon" => "copy");
+ $menu["pl_add"] = array("name"=> _("Add to Smart Block"), "icon" => "add-playlist", "icon" => "copy");
}
}
}
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
- $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/library/delete");
- $menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}");
+ $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/library/delete");
+ $menu["edit"] = array("name"=> _("Edit Metadata"), "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}");
}
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
- $menu["download"] = array("name" => "Download", "icon" => "download", "url" => $url);
+ $menu["download"] = array("name" => _("Download"), "icon" => "download", "url" => $url);
} elseif ($type === "playlist" || $type === "block") {
if ($type === 'playlist') {
$obj = new Application_Model_Playlist($id);
@@ -200,19 +200,19 @@ class LibraryController extends Zend_Controller_Action
}
if (($isAdminOrPM || $obj->getCreatorId() == $user->getId()) && $screen == "playlist") {
if ($obj_sess->type === "playlist") {
- $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
+ $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy");
}
}
}
if ($obj_sess->id !== $id && $screen == "playlist") {
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
- $menu["edit"] = array("name"=> "Edit", "icon" => "edit");
+ $menu["edit"] = array("name"=> _("Edit"), "icon" => "edit");
}
}
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
- $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/library/delete");
+ $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/library/delete");
}
} elseif ($type == "stream") {
@@ -221,15 +221,15 @@ class LibraryController extends Zend_Controller_Action
if (isset($obj_sess->id) && $screen == "playlist") {
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($obj_sess->type === "playlist") {
- $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
+ $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy");
}
}
}
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($screen == "playlist") {
- $menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}");
+ $menu["edit"] = array("name"=> _("Edit"), "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}");
}
- $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/library/delete");
+ $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/library/delete");
}
}
@@ -240,26 +240,26 @@ class LibraryController extends Zend_Controller_Action
$menu["sep1"] = "-----------";
//create a sub menu for Soundcloud actions.
- $menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array());
+ $menu["soundcloud"] = array("name" => _("Soundcloud"), "icon" => "soundcloud", "items" => array());
$scid = $file->getSoundCloudId();
if ($scid > 0) {
$url = $file->getSoundCloudLinkToFile();
- $menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
+ $menu["soundcloud"]["items"]["view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $url);
}
if (!is_null($scid)) {
- $text = "Re-upload to SoundCloud";
+ $text = _("Re-upload to SoundCloud");
} else {
- $text = "Upload to SoundCloud";
+ $text = _("Upload to SoundCloud");
}
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => $baseUrl."/library/upload-file-soundcloud/id/{$id}");
}
if (empty($menu)) {
- $menu["noaction"] = array("name"=>"No action available");
+ $menu["noaction"] = array("name"=>_("No action available"));
}
$this->view->items = $menu;
@@ -279,7 +279,7 @@ class LibraryController extends Zend_Controller_Action
$streams = array();
$message = null;
- $noPermissionMsg = "You don't have permission to delete selected items.";
+ $noPermissionMsg = _("You don't have permission to delete selected items.");
foreach ($mediaItems as $media) {
@@ -328,7 +328,7 @@ class LibraryController extends Zend_Controller_Action
$message = $noPermissionMsg;
} catch (Exception $e) {
//could throw a scheduled in future exception.
- $message = "Could not delete some scheduled files.";
+ $message = _("Could not delete some scheduled files.");
Logging::debug($e->getMessage());
}
}
@@ -456,10 +456,10 @@ class LibraryController extends Zend_Controller_Action
$this->view->md = $md;
if ($block->isStatic()) {
- $this->view->blType = 'Static';
+ $this->view->blType = _('Static');
$this->view->contents = $block->getContents();
} else {
- $this->view->blType = 'Dynamic';
+ $this->view->blType = _('Dynamic');
$this->view->contents = $block->getCriteria();
}
$this->view->block = $block;
diff --git a/airtime_mvc/application/controllers/LocaleController.php b/airtime_mvc/application/controllers/LocaleController.php
new file mode 100644
index 000000000..7d9e1efcf
--- /dev/null
+++ b/airtime_mvc/application/controllers/LocaleController.php
@@ -0,0 +1,340 @@
+_helper->getHelper('AjaxContext');
+ $ajaxContext->addActionContext('general-translation-table', 'json')
+ ->addActionContext('datatables-translation-table', 'json')
+ ->initContext();
+ }
+
+ public function datatablesTranslationTableAction()
+ {
+ $this->view->layout()->disableLayout();
+ $this->_helper->viewRenderer->setNoRender(true);
+ header("Content-type: text/javascript");
+
+ $baseUrl = Application_Common_OsPath::getBaseDir();
+ $locale = Application_Model_Preference::GetLocale();
+ echo "var datatables_dict =" .
+ file_get_contents(Application_Common_OsPath::join(
+ $_SERVER['DOCUMENT_ROOT'],
+ $baseUrl,
+ '/js/datatables/i18n/',
+ $locale.'.txt')
+ );
+ }
+
+ public function generalTranslationTableAction()
+ {
+ $translations = array (
+ //common/common.js
+ "Audio Player" => _("Audio Player"),
+ //dashboard/dashboard.js
+ "Recording:" => _("Recording:"),
+ "Master Stream" => _("Master Stream"),
+ "Live Stream" => _("Live Stream"),
+ "Nothing Scheduled" => _("Nothing Scheduled"),
+ "Current Show:" => _("Current Show:"),
+ "Current" => _("Current"),
+ //dashboard/versiontooltip.js
+ "You are running the latest version" => _("You are running the latest version"),
+ "New version available: " => _("New version available: "),
+ "This version will soon be obsolete." => _("This version will soon be obsolete."),
+ "This version is no longer supported." => _("This version is no longer supported."),
+ "Please upgrade to " => _("Please upgrade to "),
+ //library/events/library_playlistbuilder.js
+ "Add to current playlist" => _("Add to current playlist"),
+ "Add to current smart block" => _("Add to current smart block"),
+ "Adding 1 Item" => _("Adding 1 Item"),
+ "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, smart blocks, and webstreams to playlists." => _("You can only add tracks, smart blocks, and webstreams to playlists."),
+ //library/events/library_showbuilder.js
+ //already in library/events/library_playlistbuilder.js
+ //"Adding 1 Item" => _("Adding 1 Item"),
+ //"Adding %s Items" => _("Adding %s Items"),
+ //library/library.js
+ "Add to selected show" => _("Add to selected show"),
+ "Select" => _("Select"),
+ "Select this page" => _("Select this page"),
+ "Deselect this page" => _("Deselect this page"),
+ "Deselect all" => _("Deselect all"),
+ "Are you sure you want to delete the selected item(s)?" => _("Are you sure you want to delete the selected item(s)?"),
+ "Title" => _("Title"),
+ "Creator" => _("Creator"),
+ "Album" => _("Album"),
+ "Bit Rate" => _("Bit Rate"),
+ "BPM" => _("BPM"),
+ "Composer" => _("Composer"),
+ "Conductor" => _("Conductor"),
+ "Copyright" => _("Copyright"),
+ "Encoded By" => _("Encoded By"),
+ "Genre" => _("Genre"),
+ "ISRC" => _("ISRC"),
+ "Label" => _("Label"),
+ "Language" => _("Language"),
+ "Last Modified" => _("Last Modified"),
+ "Last Played" => _("Last Played"),
+ "Length" => _("Length"),
+ "Mime" => _("Mime"),
+ "Mood" => _("Mood"),
+ "Owner" => _("Owner"),
+ "Replay Gain" => _("Replay Gain"),
+ "Sample Rate" => _("Sample Rate"),
+ "Track Number" => _("Track Number"),
+ "Uploaded" => _("Uploaded"),
+ "Website" => _("Website"),
+ "Year" => _("Year"),
+ "Loading..." => _("Loading..."),
+ "All" => _("All"),
+ "Files" => _("Files"),
+ "Playlists" => _("Playlists"),
+ "Smart Blocks" => _("Smart Blocks"),
+ "Web Streams" => _("Web Streams"),
+ "Unknown type: " => _("Unknown type: "),
+ "Are you sure you want to delete the selected item?" => _("Are you sure you want to delete the selected item?"),
+ "Uploading in progress..." => _("Uploading in progress..."),
+ "Retrieving data from the server..." => _("Retrieving data from the server..."),
+ "The soundcloud id for this file is: " => _("The soundcloud id for this file is: "),
+ "There was an error while uploading to soundcloud." => _("There was an error while uploading to soundcloud."),
+ "Error code: " => _("Error code: "),
+ "Error msg: " => _("Error msg: "),
+ "Input must be a positive number" => _("Input must be a positive number"),
+ "Input must be a number" => _("Input must be a number"),
+ "Input must be in the format: yyyy-mm-dd" => _("Input must be in the format: yyyy-mm-dd"),
+ "Input must be in the format: hh:mm:ss.t" => _("Input must be in the format: hh:mm:ss.t"),
+ //library/plupload.js
+ "You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"
+ => _("You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"),
+ //library/spl.js
+ "please put in a time '00:00:00 (.0)'" => _("please put in a time '00:00:00 (.0)'"),
+ "please put in a time in seconds '00 (.0)'" => _("please put in a time in seconds '00 (.0)'"),
+ "Your browser does not support playing this file type: " => _("Your browser does not support playing this file type: "),
+ "Dynamic block is not previewable" => _("Dynamic block is not previewable"),
+ "Limit to: " => _("Limit to: "),
+ "Playlist saved" => _("Playlist saved"),
+ "Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore."
+ => _("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore."),
+ //listenerstat/listenerstat.js
+ "Listener Count on %s: %s" => _("Listener Count on %s: %s"),
+ //nowplaying/register.js
+ "Remind me in 1 week" => _("Remind me in 1 week"),
+ "Remind me never" => _("Remind me never"),
+ "Yes, help Airtime" => _("Yes, help Airtime"),
+ "Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"),
+ //playlist/smart_blockbuilder.js
+ "A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show."
+ => _("A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show."),
+ "A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library."
+ => _("A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library."),
+ "The desired block length will not be reached if Airtime cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."
+ => _("The desired block length will not be reached if Airtime cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."),
+ "Smart block shuffled" => _("Smart block shuffled"),
+ "Smart block generated and criteria saved" => _("Smart block generated and criteria saved"),
+ "Smart block saved" => _("Smart block saved"),
+ "Processing..." => _("Processing..."),
+ "Select modifier" => _("Select modifier"),
+ "contains" => _("contains"),
+ "does not contain" => _("does not contain"),
+ "is" => _("is"),
+ "is not" => _("is not"),
+ "starts with" => _("starts with"),
+ "ends with" => _("ends with"),
+ "is greater than" => _("is greater than"),
+ "is less than" => _("is less than"),
+ "is in the range" => _("is in the range"),
+ //playouthistory/historytable.js
+ "Title" => _("Title"),
+ "Creator" => _("Creator"),
+ "Played" => _("Played"),
+ "Length" => _("Length"),
+ "Composer" => _("Composer"),
+ "Copyright" => _("Copyright"),
+ "All" => _("All"),
+ //preferences/musicdirs.js
+ "Choose Storage Folder" => _("Choose Storage Folder"),
+ "Choose Folder to Watch" => _("Choose Folder to Watch"),
+ "Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!"
+ => _("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!"),
+ "Manage Media Folders" => _("Manage Media Folders"),
+ "Are you sure you want to remove the watched folder?" => _("Are you sure you want to remove the watched folder?"),
+ "This path is currently not accessible." => _("This path is currently not accessible."),
+ //preferences/streamsetting.js
+ "Connected to the streaming server" => _("Connected to the streaming server"),
+ "The stream is disabled" => _("The stream is disabled"),
+ "Getting information from the server..." => _("Getting information from the server..."),
+ "Can not connect to the streaming server" => _("Can not connect to the streaming server"),
+ "If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151."
+ => _("If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151."),
+ "For more details, please read the %sAirtime Manual%s" => _("For more details, please read the %sAirtime Manual%s"),
+ "Check this option to enable metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option."
+ => _("Check this option to enable metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option."),
+ "Check this box to automatically switch off Master/Show source upon source disconnection." => _("Check this box to automatically switch off Master/Show source upon source disconnection."),
+ "Check this box to automatically switch on Master/Show source upon source connection." => _("Check this box to automatically switch on Master/Show source upon source connection."),
+ "If your Icecast server expects a username of 'source', this field can be left blank." => _("If your Icecast server expects a username of 'source', this field can be left blank."),
+ "If your live streaming client does not ask for a username, this field should be 'source'." => _("If your live streaming client does not ask for a username, this field should be 'source'."),
+ "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."
+ => _("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."),
+ //preferences/support-setting.js
+ "Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"),
+ //schedule/add-show.js
+ "No result found" => _("No result found"),
+ "This follows the same security pattern for the shows: only users assigned to the show can connect." => _("This follows the same security pattern for the shows: only users assigned to the show can connect."),
+ "Specify custom authentication which will work only for this show." => _("Specify custom authentication which will work only for this show."),
+ "If your live streaming client does not ask for a username, this field should be 'source'." => _("If your live streaming client does not ask for a username, this field should be 'source'."),
+ "The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"),
+ //schedule/full-calendar-functions
+ //already in schedule/add-show.js
+ //"The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"),
+ "Show" => _("Show"),
+ "Show is empty" => _("Show is empty"),
+ "1m" => _("1m"),
+ "5m" => _("5m"),
+ "10m" => _("10m"),
+ "15m" => _("15m"),
+ "30m" => _("30m"),
+ "60m" => _("60m"),
+ "Uploading in progress..." => _("Uploading in progress..."),
+ "Retreiving data from the server..." => _("Retreiving data from the server..."),
+ //already in library/library.js
+ //"The soundcloud id for this file is: " => _("The soundcloud id for this file is: "),
+ //"There was error while uploading to soundcloud." => _("There was error while uploading to soundcloud."),
+ //"Error code: " => _("Error code: "),
+ //"Error msg: " => _("Error msg: "),
+ "This show has no scheduled content." => _("This show has no scheduled content."),
+ //already in schedule/add-show.js
+ //"The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"),
+ //schedule/schedule.js
+ "January" => _("January"),
+ "February" => _("February"),
+ "March" => _("March"),
+ "April" => _("April"),
+ "May" => _("May"),
+ "June" => _("June"),
+ "July" => _("July"),
+ "August" => _("August"),
+ "September" => _("September"),
+ "October" => _("October"),
+ "November" => _("November"),
+ "December" => _("December"),
+ "Jan" => _("Jan"),
+ "Feb" => _("Feb"),
+ "Mar" => _("Mar"),
+ "Apr" => _("Apr"),
+ "May" => _("May"),
+ "Jun" => _("Jun"),
+ "Jul" => _("Jul"),
+ "Aug" => _("Aug"),
+ "Sep" => _("Sep"),
+ "Oct" => _("Oct"),
+ "Nov" => _("Nov"),
+ "Dec" => _("Dec"),
+ "today" => _("today"),
+ "day" => _("day"),
+ "week" => _("week"),
+ "month" => _("month"),
+ "Sunday" => _("Sunday"),
+ "Monday" => _("Monday"),
+ "Tuesday" => _("Tuesday"),
+ "Wednesday" => _("Wednesday"),
+ "Thursday" => _("Thursday"),
+ "Friday" => _("Friday"),
+ "Saturday" => _("Saturday"),
+ "Sun" => _("Sun"),
+ "Mon" => _("Mon"),
+ "Tue" => _("Tue"),
+ "Wed" => _("Wed"),
+ "Thu" => _("Thu"),
+ "Fri" => _("Fri"),
+ "Sat" => _("Sat"),
+ "Shows longer than their scheduled time will be cut off by a following show." => _("Shows longer than their scheduled time will be cut off by a following show."),
+ "Cancel Current Show?" => _("Cancel Current Show?"),
+ "Stop recording current show?" => _("Stop recording current show?"),
+ "Ok" => _("Ok"),
+ "Contents of Show" => _("Contents of Show"),
+ //already in schedule/add-show.js
+ //"The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"),
+ "Remove all content?" => _("Remove all content?"),
+ //showbuilder/builder.js
+ "Delete selected item(s)?" => _("Delete selected item(s)?"),
+ "Start" => _("Start"),
+ "End" => _("End"),
+ "Duration" => _("Duration"),
+ //already in library/library.js
+ //"Title" => _("Title"),
+ //"Creator" => _("Creator"),
+ //"Album" => _("Album"),
+ //"Mime" => _("Mime"),
+ "Cue In" => _("Cue In"),
+ "Cue Out" => _("Cue Out"),
+ "Fade In" => _("Fade In"),
+ "Fade Out" => _("Fade Out"),
+ "Show Empty" => _("Show Empty"),
+ "Recording From Line In" => _("Recording From Line In"),
+ "Track preview" => _("Track preview"),
+ //already in library/spl.js
+ //"Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore."
+ //=> _("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore."),
+ "Cannot schedule outside a show." => _("Cannot schedule outside a show."),
+ "Moving 1 Item" => _("Moving 1 Item"),
+ "Moving %s Items" => _("Moving %s Items"),
+ //already in library/library.js
+ //"Select" => _("Select"),
+ "Select all" => _("Select all"),
+ "Select none" => _("Select none"),
+ "Remove overbooked tracks" => _("Remove overbooked tracks"),
+ "Remove selected scheduled items" => _("Remove selected scheduled items"),
+ "Jump to the current playing track" => _("Jump to the current playing track"),
+ "Cancel current show" => _("Cancel current show"),
+ //already in schedule/schedule.js
+ //"Cancel Current Show?" => _("Cancel Current Show?"),
+ "Stop recording current show?" => _("Stop recording current show?"),
+ //showbuilder/main_builder.js
+ "Open library to add or remove content" => _("Open library to add or remove content"),
+ "Add / Remove Content" => _("Add / Remove Content"),
+ //status/status.js
+ "in use" => _("in use"),
+ "Disk" => _("Disk"),
+ //serverbrowse/serverbrowse.js
+ "Look in" => _("Look in"),
+ "Cancel" => _("Cancel"),
+ "Open" => _("Open"),
+ //user/user.js
+ "Admin" => _("Admin"),
+ "DJ" => _("DJ"),
+ "Program Manager" => _("Program Manager"),
+ "Guest" => _("Guest"),
+ //dataTables/ColVis.js
+ "Show / hide columns" => _("Show / hide columns"),
+ //datatables.columnFilter.js
+ "From {from} to {to}" => _("From {from} to {to}"),
+ "kbps" => _("kbps"),
+ "yyyy-mm-dd" => _("yyyy-mm-dd"),
+ "hh:mm:ss.t" => _("hh:mm:ss.t"),
+ "kHz" => _("kHz"),
+ //datepicker
+ //months are already in schedule/schedule.js
+ "Su" => _("Su"),
+ "Mo" => _("Mo"),
+ "Tu" => _("Tu"),
+ "We" => _("We"),
+ "Th" => _("Th"),
+ "Fr" => _("Fr"),
+ "Sa" => _("Sa"),
+ "Close" => _("Close"),
+ //timepicker
+ "Hour" => _("Hour"),
+ "Minute" => _("Minute"),
+ "Done" => _("Done")
+
+ );
+ $this->view->layout()->disableLayout();
+ $this->_helper->viewRenderer->setNoRender(true);
+ header("Content-type: text/javascript");
+ echo "var general_dict=".json_encode($translations);
+
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php
index d4d66bf50..76be05bf4 100644
--- a/airtime_mvc/application/controllers/LoginController.php
+++ b/airtime_mvc/application/controllers/LoginController.php
@@ -31,7 +31,7 @@ class LoginController extends Zend_Controller_Action
$form = new Application_Form_Login();
- $message = "Please enter your user name and password";
+ $message = _("Please enter your user name and password");
if ($request->isPost()) {
// if the post contains recaptcha field, which means form had recaptcha field.
@@ -70,7 +70,7 @@ class LoginController extends Zend_Controller_Action
$this->_redirect('Showbuilder');
} else {
- $message = "Wrong username or password provided. Please try again.";
+ $message = _("Wrong username or password provided. Please try again.");
Application_Model_Subjects::increaseLoginAttempts($username);
Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']);
$form = new Application_Form_Login();
@@ -132,10 +132,10 @@ class LoginController extends Zend_Controller_Action
if ($success) {
$this->_helper->redirector('password-restore-after', 'login');
} else {
- $form->email->addError($this->view->translate("Email could not be sent. Check your mail server settings and ensure it has been configured properly."));
+ $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly.")));
}
} else {
- $form->email->addError($this->view->translate("Given email not found."));
+ $form->email->addError($this->view->translate(_("Given email not found.")));
}
}
diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php
index 7283bba48..19c2756e7 100644
--- a/airtime_mvc/application/controllers/PlaylistController.php
+++ b/airtime_mvc/application/controllers/PlaylistController.php
@@ -42,7 +42,7 @@ class PlaylistController extends Zend_Controller_Action
$modified = $this->_getParam('modified', null);
if ($obj->getLastModified("U") !== $modified) {
$this->createFullResponse($obj);
- throw new PlaylistOutDatedException("You are viewing an older version of {$obj->getName()}");
+ throw new PlaylistOutDatedException(sprintf(_("You are viewing an older version of %s"), $obj->getName()));
}
}
@@ -117,14 +117,14 @@ class PlaylistController extends Zend_Controller_Action
private function blockDynamic($obj)
{
- $this->view->error = "You cannot add tracks to dynamic blocks.";
+ $this->view->error = _("You cannot add tracks to dynamic blocks.");
$this->createFullResponse($obj);
}
private function playlistNotFound($p_type, $p_isJson = false)
{
$p_type = ucfirst($p_type);
- $this->view->error = "{$p_type} not found";
+ $this->view->error = sprintf(_("%s not found"), $p_type);
Logging::info("{$p_type} not found");
Application_Model_Library::changePlaylist(null, $p_type);
@@ -138,26 +138,26 @@ class PlaylistController extends Zend_Controller_Action
private function playlistNoPermission($p_type)
{
- $this->view->error = "You don't have permission to delete selected {$p_type}(s).";
+ $this->view->error = sprintf(_("You don't have permission to delete selected %s(s)."), $p_type);
$this->changePlaylist(null, $p_type);
$this->createFullResponse(null);
}
private function playlistUnknownError($e)
{
- $this->view->error = "Something went wrong.";
+ $this->view->error = _("Something went wrong.");
Logging::info($e->getMessage());
}
private function wrongTypeToBlock($obj)
{
- $this->view->error = "You can only add tracks to smart block.";
+ $this->view->error = _("You can only add tracks to smart block.");
$this->createFullResponse($obj);
}
private function wrongTypeToPlaylist($obj)
{
- $this->view->error = "You can only add tracks, smart blocks, and webstreams to playlists.";
+ $this->view->error = _("You can only add tracks, smart blocks, and webstreams to playlists.");
$this->createFullResponse($obj);
}
@@ -169,9 +169,9 @@ class PlaylistController extends Zend_Controller_Action
$objInfo = Application_Model_Library::getObjInfo($type);
- $name = 'Untitled Playlist';
+ $name = _('Untitled Playlist');
if ($type == 'block') {
- $name = 'Untitled Smart Block';
+ $name = _('Untitled Smart Block');
}
$obj = new $objInfo['className']();
@@ -434,7 +434,7 @@ class PlaylistController extends Zend_Controller_Action
public function setPlaylistNameDescAction()
{
- $name = $this->_getParam('name', 'Unknown Playlist');
+ $name = $this->_getParam('name', _('Unknown Playlist'));
$description = $this->_getParam('description', "");
$type = $this->_getParam('type');
diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php
index 64de111d2..eddf9b47c 100644
--- a/airtime_mvc/application/controllers/PluploadController.php
+++ b/airtime_mvc/application/controllers/PluploadController.php
@@ -16,10 +16,12 @@ class PluploadController extends Zend_Controller_Action
global $CC_CONFIG;
$baseUrl = Application_Common_OsPath::getBaseDir();
+ $locale = Application_Model_Preference::GetLocale();
$this->view->headScript()->appendFile($baseUrl.'/js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/plupload.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/plupload/i18n/'.$locale.'.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/plupload.queue.css?'.$CC_CONFIG['airtime_version']);
}
diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php
index 5ed298d0f..6337c0edb 100644
--- a/airtime_mvc/application/controllers/PreferenceController.php
+++ b/airtime_mvc/application/controllers/PreferenceController.php
@@ -44,6 +44,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]);
Application_Model_Preference::SetAllow3rdPartyApi($values["thirdPartyApi"]);
+ Application_Model_Preference::SetLocale($values["locale"]);
Application_Model_Preference::SetTimezone($values["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
@@ -66,7 +67,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetSoundCloudTrackType($values["SoundCloudTrackType"]);
Application_Model_Preference::SetSoundCloudLicense($values["SoundCloudLicense"]);
- $this->view->statusMsg = "
Preferences updated.
";
+ $this->view->statusMsg = "". _("Preferences updated.")."
";
$this->view->form = $form;
die(json_encode(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml'))));
} else {
@@ -118,7 +119,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
}
- $this->view->statusMsg = "Support setting updated.
";
+ $this->view->statusMsg = ""._("Support setting updated.")."
";
}
}
$logo = Application_Model_Preference::GetStationLogo();
@@ -130,7 +131,7 @@ class PreferenceController extends Zend_Controller_Action
$privacyChecked = true;
}
$this->view->privacyChecked = $privacyChecked;
- $this->view->section_title = 'Support Feedback';
+ $this->view->section_title = _('Support Feedback');
$this->view->form = $form;
//$form->render($this->view);
}
@@ -301,7 +302,7 @@ class PreferenceController extends Zend_Controller_Action
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
$this->view->form = $form;
$this->view->num_stream = $num_of_stream;
- $this->view->statusMsg = "Stream Setting Updated.
";
+ $this->view->statusMsg = ""._("Stream Setting Updated.")."
";
die(json_encode(array("valid"=>"true", "html"=>$this->view->render('preference/stream-setting.phtml'))));
} else {
$live_stream_subform->updateVariables();
@@ -328,7 +329,7 @@ class PreferenceController extends Zend_Controller_Action
if (is_null($path)) {
$element = array();
- $element["name"] = "path should be specified";
+ $element["name"] = _("path should be specified");
$element["isFolder"] = false;
$element["isError"] = true;
$result[$path] = $element;
@@ -423,7 +424,7 @@ class PreferenceController extends Zend_Controller_Action
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
for ($i=1; $i<=$num_of_stream; $i++) {
$status = Application_Model_StreamSetting::getLiquidsoapError($i);
- $status = $status == NULL?"Problem with Liquidsoap...":$status;
+ $status = $status == NULL?_("Problem with Liquidsoap..."):$status;
if (!Application_Model_StreamSetting::getStreamEnabled($i)) {
$status = "N/A";
}
diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index c21b2d29a..93729ff1f 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -250,7 +250,7 @@ class ScheduleController extends Zend_Controller_Action
$file = $instance->getRecordedFile();
$fileId = $file->getId();
- $menu["view_recorded"] = array("name" => "View Recorded File Metadata", "icon" => "overview",
+ $menu["view_recorded"] = array("name" => _("View Recorded File Metadata"), "icon" => "overview",
"url" => $baseUrl."/library/edit-file-md/id/".$fileId);
}
@@ -259,17 +259,17 @@ class ScheduleController extends Zend_Controller_Action
&& !$instance->isRecorded()
&& !$instance->isRebroadcast()) {
- $menu["schedule"] = array("name"=> "Add / Remove Content", "icon" => "add-remove-content",
+ $menu["schedule"] = array("name"=> _("Add / Remove Content"), "icon" => "add-remove-content",
"url" => $baseUrl."/showbuilder/builder-dialog/");
- $menu["clear"] = array("name"=> "Remove All Content", "icon" => "remove-all-content",
+ $menu["clear"] = array("name"=> _("Remove All Content"), "icon" => "remove-all-content",
"url" => $baseUrl."/schedule/clear-show");
}
}
if (!$instance->isRecorded()) {
- $menu["content"] = array("name"=> "Show Content", "icon" => "overview", "url" => $baseUrl."/schedule/show-content-dialog");
+ $menu["content"] = array("name"=> _("Show Content"), "icon" => "overview", "url" => $baseUrl."/schedule/show-content-dialog");
}
if ($showEndLocalDT->getTimestamp() <= $epochNow
@@ -282,10 +282,10 @@ class ScheduleController extends Zend_Controller_Action
if ($scid > 0) {
$url = $file->getSoundCloudLinkToFile();
- $menu["soundcloud_view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
+ $menu["soundcloud_view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $url);
}
- $text = is_null($scid) ? 'Upload to SoundCloud' : 'Re-upload to SoundCloud';
+ $text = is_null($scid) ? _('Upload to SoundCloud') : _('Re-upload to SoundCloud');
$menu["soundcloud_upload"] = array("name"=> $text, "icon" => "soundcloud");
}
@@ -293,34 +293,34 @@ class ScheduleController extends Zend_Controller_Action
$epochNow < $showEndLocalDT->getTimestamp() && $isAdminOrPM) {
if ($instance->isRecorded()) {
- $menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
+ $menu["cancel_recorded"] = array("name"=> _("Cancel Current Show"), "icon" => "delete");
} else {
if (!$instance->isRebroadcast()) {
- $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => $baseUrl."/Schedule/populate-show-form");
+ $menu["edit"] = array("name"=> _("Edit Show"), "icon" => "edit", "_type"=>"all", "url" => $baseUrl."/Schedule/populate-show-form");
}
- $menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete");
+ $menu["cancel"] = array("name"=> _("Cancel Current Show"), "icon" => "delete");
}
}
if ($epochNow < $showStartLocalDT->getTimestamp()) {
if (!$instance->isRebroadcast() && $isAdminOrPM) {
- $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => $baseUrl."/Schedule/populate-show-form");
+ $menu["edit"] = array("name"=> _("Edit Show"), "icon" => "edit", "_type"=>"all", "url" => $baseUrl."/Schedule/populate-show-form");
}
if ($instance->getShow()->isRepeating() && $isAdminOrPM) {
//create delete sub menu.
- $menu["del"] = array("name"=> "Delete", "icon" => "delete", "items" => array());
+ $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "items" => array());
- $menu["del"]["items"]["single"] = array("name"=> "Delete This Instance", "icon" => "delete", "url" => $baseUrl."/schedule/delete-show");
+ $menu["del"]["items"]["single"] = array("name"=> _("Delete This Instance"), "icon" => "delete", "url" => $baseUrl."/schedule/delete-show");
- $menu["del"]["items"]["following"] = array("name"=> "Delete This Instance and All Following", "icon" => "delete", "url" => $baseUrl."/schedule/cancel-show");
+ $menu["del"]["items"]["following"] = array("name"=> _("Delete This Instance and All Following"), "icon" => "delete", "url" => $baseUrl."/schedule/cancel-show");
} elseif ($isAdminOrPM) {
- $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/schedule/delete-show");
+ $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/schedule/delete-show");
}
}
@@ -443,8 +443,10 @@ class ScheduleController extends Zend_Controller_Action
$originalDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
//$timestamp = Application_Common_DateHelper::ConvertToLocalDateTimeString($originalDateTime->format("Y-m-d H:i:s"));
$this->view->additionalShowInfo =
- "Rebroadcast of show \"$originalShowName\" from "
- .$originalDateTime->format("l, F jS")." at ".$originalDateTime->format("G:i");
+ sprintf(_("Rebroadcast of show %s from %s at %s"),
+ $originalShowName,
+ $originalDateTime->format("l, F jS"),
+ $originalDateTime->format("G:i"));
}
$this->view->showLength = $show->getShowLength();
$this->view->timeFilled = $show->getTimeScheduled();
@@ -895,7 +897,7 @@ class ScheduleController extends Zend_Controller_Action
$baseUrl = $this->getRequest()->getBaseUrl();
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
- 'title' => 'Download');
+ 'title' => _('Download'));
//returns format jjmenu is looking for.
die(json_encode($menu));
diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php
index 8080bc536..7760f8f07 100644
--- a/airtime_mvc/application/controllers/ShowbuilderController.php
+++ b/airtime_mvc/application/controllers/ShowbuilderController.php
@@ -187,15 +187,15 @@ class ShowbuilderController extends Zend_Controller_Action
$item = CcScheduleQuery::create()->findPK($id);
$instance = $item->getCcShowInstances();
- $menu["preview"] = array("name"=> "Preview", "icon" => "play");
+ $menu["preview"] = array("name"=> _("Preview"), "icon" => "play");
//select the cursor
- $menu["selCurs"] = array("name"=> "Select cursor","icon" => "select-cursor");
- $menu["delCurs"] = array("name"=> "Remove cursor","icon" => "select-cursor");
+ $menu["selCurs"] = array("name"=> _("Select cursor"),"icon" => "select-cursor");
+ $menu["delCurs"] = array("name"=> _("Remove cursor"),"icon" => "select-cursor");
if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) {
//remove/truncate the item from the schedule
- $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/showbuilder/schedule-remove");
+ $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/showbuilder/schedule-remove");
}
$this->view->items = $menu;
@@ -209,7 +209,7 @@ class ShowbuilderController extends Zend_Controller_Action
$instance = CcShowInstancesQuery::create()->findPK($id);
if (is_null($instance)) {
- $this->view->error = "show does not exist";
+ $this->view->error = _("show does not exist");
return;
}
diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php
index a9418ea12..b04a6e98b 100644
--- a/airtime_mvc/application/controllers/UserController.php
+++ b/airtime_mvc/application/controllers/UserController.php
@@ -51,7 +51,7 @@ class UserController extends Zend_Controller_Action
&& $formData['login'] == 'admin'
&& $formData['user_id'] != 0) {
$this->view->form = $form;
- $this->view->successMessage = "Specific action is not allowed in demo version!
";
+ $this->view->successMessage = ""._("Specific action is not allowed in demo version!")."
";
die(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
} elseif ($form->validateLogin($formData)) {
$user = new Application_Model_User($formData['user_id']);
@@ -75,9 +75,9 @@ class UserController extends Zend_Controller_Action
$this->view->form = $form;
if (strlen($formData['user_id']) == 0) {
- $this->view->successMessage = "User added successfully!
";
+ $this->view->successMessage = ""._("User added successfully!")."
";
} else {
- $this->view->successMessage = "User updated successfully!
";
+ $this->view->successMessage = ""._("User updated successfully!")."
";
}
die(json_encode(array("valid"=>"true", "html"=>$this->view->render('user/add-user.phtml'))));
diff --git a/airtime_mvc/application/controllers/WebstreamController.php b/airtime_mvc/application/controllers/WebstreamController.php
index ebb5acbf6..8eb9a2ac5 100644
--- a/airtime_mvc/application/controllers/WebstreamController.php
+++ b/airtime_mvc/application/controllers/WebstreamController.php
@@ -26,11 +26,11 @@ class WebstreamController extends Zend_Controller_Action
//we're not saving this primary key in the DB so it's OK to be -1
$webstream->setDbId(-1);
- $webstream->setDbName("Untitled Webstream");
+ $webstream->setDbName(_("Untitled Webstream"));
$webstream->setDbDescription("");
$webstream->setDbUrl("http://");
$webstream->setDbLength("00:30:00");
- $webstream->setDbName("Untitled Webstream");
+ $webstream->setDbName(_("Untitled Webstream"));
$webstream->setDbCreatorId($userInfo->id);
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
@@ -135,7 +135,7 @@ class WebstreamController extends Zend_Controller_Action
Application_Model_Library::changePlaylist($streamId, "stream");
- $this->view->statusMessage = "Webstream saved.
";
+ $this->view->statusMessage = ""._("Webstream saved.")."
";
$this->view->streamId = $streamId;
$this->view->length = $di->format("%Hh %Im");
} else {
@@ -143,7 +143,7 @@ class WebstreamController extends Zend_Controller_Action
}
} catch (Exception $e) {
Logging::debug($e->getMessage());
- $this->view->statusMessage = "Invalid form values.
";
+ $this->view->statusMessage = ""._("Invalid form values.")."
";
$this->view->streamId = -1;
$this->view->analysis = $analysis;
}
diff --git a/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php b/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php
index 8bfa71b2f..a2f5b5cf3 100644
--- a/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php
+++ b/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php
@@ -23,7 +23,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
$text->setAttrib('class', 'input_text');
$text->addFilter('StringTrim');
$text->addValidator('date', false, array('HH:mm'));
- $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'));
+ $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')));
$text->setRequired(false);
$text->setDecorators(array('ViewHelper'));
$this->addElement($text);
@@ -55,12 +55,12 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
}
if (trim($day) == "") {
- $this->getElement('add_show_rebroadcast_date_absolute_'.$i)->setErrors(array("Day must be specified"));
+ $this->getElement('add_show_rebroadcast_date_absolute_'.$i)->setErrors(array(_("Day must be specified")));
$valid = false;
}
if (trim($time) == "") {
- $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Time must be specified"));
+ $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array(_("Time must be specified")));
$valid = false;
}
@@ -83,7 +83,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
$rebroad_start = new DateTime($rebroad_start);
if ($rebroad_start < $show_end) {
- $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
+ $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array(_("Must wait at least 1 hour to rebroadcast")));
$valid = false;
$noError = false;
}
diff --git a/airtime_mvc/application/forms/AddShowLiveStream.php b/airtime_mvc/application/forms/AddShowLiveStream.php
index b241a54f0..b34aab2e5 100644
--- a/airtime_mvc/application/forms/AddShowLiveStream.php
+++ b/airtime_mvc/application/forms/AddShowLiveStream.php
@@ -7,13 +7,13 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
public function init()
{
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
- $cb_airtime_auth->setLabel("Use Airtime Authentication:")
+ $cb_airtime_auth->setLabel(_("Use Airtime Authentication:"))
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_airtime_auth);
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
- $cb_custom_auth ->setLabel("Use Custom Authentication:")
+ $cb_custom_auth ->setLabel(_("Use Custom Authentication:"))
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_custom_auth);
@@ -23,7 +23,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
$custom_username->setAttrib('class', 'input_text')
->setAttrib('autocomplete', 'off')
->setAllowEmpty(true)
- ->setLabel('Custom Username')
+ ->setLabel(_('Custom Username'))
->setFilters(array('StringTrim'))
->setValidators(array(
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
@@ -36,7 +36,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
->setAttrib('autocomplete', 'off')
->setAttrib('renderPassword','true')
->setAllowEmpty(true)
- ->setLabel('Custom Password')
+ ->setLabel(_('Custom Password'))
->setFilters(array('StringTrim'))
->setValidators(array(
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
@@ -60,12 +60,12 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
if ($data['cb_custom_auth'] == 1) {
if (trim($data['custom_username']) == '') {
$element = $this->getElement("custom_username");
- $element->addError("Username field cannot be empty.");
+ $element->addError(_("Username field cannot be empty."));
$isValid = false;
}
if (trim($data['custom_password']) == '') {
$element = $this->getElement("custom_password");
- $element->addError("Password field cannot be empty.");
+ $element->addError(_("Password field cannot be empty."));
$isValid = false;
}
}
diff --git a/airtime_mvc/application/forms/AddShowRR.php b/airtime_mvc/application/forms/AddShowRR.php
index 5c33723b6..f1fc4fcfd 100644
--- a/airtime_mvc/application/forms/AddShowRR.php
+++ b/airtime_mvc/application/forms/AddShowRR.php
@@ -7,13 +7,13 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
{
// Add record element
$this->addElement('checkbox', 'add_show_record', array(
- 'label' => 'Record from Line In?',
+ 'label' => _('Record from Line In?'),
'required' => false,
));
// Add record element
$this->addElement('checkbox', 'add_show_rebroadcast', array(
- 'label' => 'Rebroadcast?',
+ 'label' => _('Rebroadcast?'),
'required' => false,
));
}
diff --git a/airtime_mvc/application/forms/AddShowRebroadcastDates.php b/airtime_mvc/application/forms/AddShowRebroadcastDates.php
index 7bf0ea3a4..74725c98c 100644
--- a/airtime_mvc/application/forms/AddShowRebroadcastDates.php
+++ b/airtime_mvc/application/forms/AddShowRebroadcastDates.php
@@ -12,7 +12,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
$relativeDates = array();
$relativeDates[""] = "";
for ($i=0; $i<=30; $i++) {
- $relativeDates["$i days"] = "+$i days";
+ $relativeDates["$i days"] = "+$i "._("days");
}
for ($i=1; $i<=10; $i++) {
@@ -28,7 +28,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
$text->setAttrib('class', 'input_text');
$text->addFilter('StringTrim');
$text->addValidator('date', false, array('HH:mm'));
- $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'));
+ $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')));
$text->setRequired(false);
$text->setDecorators(array('ViewHelper'));
$this->addElement($text);
@@ -60,12 +60,12 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
}
if (trim($days) == "") {
- $this->getElement('add_show_rebroadcast_date_'.$i)->setErrors(array("Day must be specified"));
+ $this->getElement('add_show_rebroadcast_date_'.$i)->setErrors(array(_("Day must be specified")));
$valid = false;
}
if (trim($time) == "") {
- $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Time must be specified"));
+ $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array(_("Time must be specified")));
$valid = false;
}
@@ -92,7 +92,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
$rebroad_start->add(new DateInterval("P".$day."D"));
if ($rebroad_start < $show_end) {
- $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
+ $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array(_("Must wait at least 1 hour to rebroadcast")));
$valid = false;
$noError = false;
}
diff --git a/airtime_mvc/application/forms/AddShowRepeats.php b/airtime_mvc/application/forms/AddShowRepeats.php
index 85bb7cb44..f0c2609e2 100644
--- a/airtime_mvc/application/forms/AddShowRepeats.php
+++ b/airtime_mvc/application/forms/AddShowRepeats.php
@@ -8,12 +8,12 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
//Add type select
$this->addElement('select', 'add_show_repeat_type', array(
'required' => true,
- 'label' => 'Repeat Type:',
+ 'label' => _('Repeat Type:'),
'class' => ' input_select',
'multiOptions' => array(
- "0" => "weekly",
- "1" => "bi-weekly",
- "2" => "monthly"
+ "0" => _("weekly"),
+ "1" => _("bi-weekly"),
+ "2" => _("monthly")
),
));
@@ -22,22 +22,22 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
'multiCheckbox',
'add_show_day_check',
array(
- 'label' => 'Select Days:',
+ 'label' => _('Select Days:'),
'required' => false,
'multiOptions' => array(
- "0" => "Sun",
- "1" => "Mon",
- "2" => "Tue",
- "3" => "Wed",
- "4" => "Thu",
- "5" => "Fri",
- "6" => "Sat",
+ "0" => _("Sun"),
+ "1" => _("Mon"),
+ "2" => _("Tue"),
+ "3" => _("Wed"),
+ "4" => _("Thu"),
+ "5" => _("Fri"),
+ "6" => _("Sat"),
),
));
// Add end date element
$this->addElement('text', 'add_show_end_date', array(
- 'label' => 'Date End:',
+ 'label' => _('Date End:'),
'class' => 'input_text',
'value' => date("Y-m-d"),
'required' => false,
@@ -50,7 +50,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
// Add no end element
$this->addElement('checkbox', 'add_show_no_end', array(
- 'label' => 'No End?',
+ 'label' => _('No End?'),
'required' => false,
'checked' => true,
));
@@ -76,7 +76,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
$end_epoch = strtotime($end_timestamp);
if ($end_epoch < $start_epoch) {
- $this->getElement('add_show_end_date')->setErrors(array('End date must be after start date'));
+ $this->getElement('add_show_end_date')->setErrors(array(_('End date must be after start date')));
return false;
}
diff --git a/airtime_mvc/application/forms/AddShowStyle.php b/airtime_mvc/application/forms/AddShowStyle.php
index 6ea301874..5f897f6ea 100644
--- a/airtime_mvc/application/forms/AddShowStyle.php
+++ b/airtime_mvc/application/forms/AddShowStyle.php
@@ -7,7 +7,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
{
// Add show background-color input
$this->addElement('text', 'add_show_background_color', array(
- 'label' => 'Background Colour:',
+ 'label' => _('Background Colour:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
@@ -26,7 +26,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
// Add show color input
$this->addElement('text', 'add_show_color', array(
- 'label' => 'Text Colour:',
+ 'label' => _('Text Colour:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
diff --git a/airtime_mvc/application/forms/AddShowWhat.php b/airtime_mvc/application/forms/AddShowWhat.php
index 7a092f4b5..20aeb6ef5 100644
--- a/airtime_mvc/application/forms/AddShowWhat.php
+++ b/airtime_mvc/application/forms/AddShowWhat.php
@@ -4,6 +4,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
{
public function init()
{
+ $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
// retrieves the length limit for each char field
// and store to assoc array
$maxLens = Application_Model_Show::getMaxLengths();
@@ -22,27 +23,26 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
// Add name element
$this->addElement('text', 'add_show_name', array(
- 'label' => 'Name:',
+ 'label' => _('Name:'),
'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
- 'validators' => array('NotEmpty'),
- 'value' => 'Untitled Show',
- 'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
+ 'value' => _('Untitled Show'),
+ 'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['name'])))
));
// Add URL element
$this->addElement('text', 'add_show_url', array(
- 'label' => 'URL:',
+ 'label' => _('URL:'),
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim'),
- 'validators' => array('NotEmpty', array('StringLength', false, array(0, $maxLens['url'])))
+ 'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['url'])))
));
// Add genre element
$this->addElement('text', 'add_show_genre', array(
- 'label' => 'Genre:',
+ 'label' => _('Genre:'),
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim'),
@@ -51,7 +51,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
// Add the description element
$this->addElement('textarea', 'add_show_description', array(
- 'label' => 'Description:',
+ 'label' => _('Description:'),
'required' => false,
'class' => 'input_text_area',
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php
index e6d164022..92873f153 100644
--- a/airtime_mvc/application/forms/AddShowWhen.php
+++ b/airtime_mvc/application/forms/AddShowWhen.php
@@ -9,16 +9,22 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
array('ViewScript', array('viewScript' => 'form/add-show-when.phtml'))
));
+ $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
+ $dateValidator = Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD");
+ $regexValidator = Application_Form_Helper_ValidationTypes::overrideRegexValidator(
+ "/^[0-2]?[0-9]:[0-5][0-9]$/",
+ _("'%value%' does not fit the time format 'HH:mm'"));
+
// Add start date element
$startDate = new Zend_Form_Element_Text('add_show_start_date');
$startDate->class = 'input_text';
$startDate->setRequired(true)
- ->setLabel('Date/Time Start:')
+ ->setLabel(_('Date/Time Start:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
- 'NotEmpty',
- array('date', false, array('YYYY-MM-DD'))))
+ $notEmptyValidator,
+ $dateValidator))
->setDecorators(array('ViewHelper'));
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);
@@ -30,9 +36,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
->setValue('00:00')
->setFilters(array('StringTrim'))
->setValidators(array(
- 'NotEmpty',
- array('date', false, array('HH:mm')),
- array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Time format should be HH:mm'))
+ $notEmptyValidator,
+ $regexValidator
))->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@@ -41,12 +46,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$endDate = new Zend_Form_Element_Text('add_show_end_date_no_repeat');
$endDate->class = 'input_text';
$endDate->setRequired(true)
- ->setLabel('Date/Time End:')
+ ->setLabel(_('Date/Time End:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
- 'NotEmpty',
- array('date', false, array('YYYY-MM-DD'))))
+ $notEmptyValidator,
+ $dateValidator))
->setDecorators(array('ViewHelper'));
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);
@@ -58,16 +63,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
->setValue('01:00')
->setFilters(array('StringTrim'))
->setValidators(array(
- 'NotEmpty',
- array('date', false, array('HH:mm')),
- array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Time format should be HH:mm'))))
+ $notEmptyValidator,
+ $regexValidator))
->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
// Add duration element
$this->addElement('text', 'add_show_duration', array(
- 'label' => 'Duration:',
+ 'label' => _('Duration:'),
'class' => 'input_text',
'value' => '01h 00m',
'readonly' => true,
@@ -76,7 +80,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// Add repeats element
$this->addElement('checkbox', 'add_show_repeats', array(
- 'label' => 'Repeats?',
+ 'label' => _('Repeats?'),
'required' => false,
'decorators' => array('ViewHelper')
));
@@ -96,7 +100,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$showEndDateTime = new DateTime($end_time);
if ($validateStartDate) {
if ($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
- $this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
+ $this->getElement('add_show_start_time')->setErrors(array(_('Cannot create show in the past')));
$valid = false;
}
// if edit action, check if original show start time is in the past. CC-3864
@@ -104,7 +108,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
if ($originalStartDate->getTimestamp() < $nowDateTime->getTimestamp()) {
$this->getElement('add_show_start_time')->setValue($originalStartDate->format("H:i"));
$this->getElement('add_show_start_date')->setValue($originalStartDate->format("Y-m-d"));
- $this->getElement('add_show_start_time')->setErrors(array('Cannot modify start date/time of the show that is already started'));
+ $this->getElement('add_show_start_time')->setErrors(array(_('Cannot modify start date/time of the show that is already started')));
$this->disableStartDateAndTime();
$valid = false;
}
@@ -113,7 +117,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// if end time is in the past, return error
if ($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
- $this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past'));
+ $this->getElement('add_show_end_time')->setErrors(array(_('End date/time cannot be in the past')));
$valid = false;
}
@@ -123,15 +127,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$hours = $matches[1];
$minutes = $matches[2];
if ($formData["add_show_duration"] == "00h 00m") {
- $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m'));
+ $this->getElement('add_show_duration')->setErrors(array(_('Cannot have duration 00h 00m')));
$valid = false;
} elseif (strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) {
if ($hours > 24 || ($hours == 24 && $minutes > 0)) {
- $this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h'));
+ $this->getElement('add_show_duration')->setErrors(array(_('Cannot have duration greater than 24h')));
$valid = false;
}
} elseif ( strstr($formData["add_show_duration"], '-') ) {
- $this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m'));
+ $this->getElement('add_show_duration')->setErrors(array(_('Cannot have duration < 0m')));
$valid = false;
}
} else {
@@ -247,7 +251,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
if ($overlapping) {
$valid = false;
- $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
+ $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
break 1;
} else {
$repeatShowStart->setTimezone($localTimezone);
@@ -261,7 +265,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
}
} else {
$valid = false;
- $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
+ $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
}
} elseif ($formData["add_show_rebroadcast"]) {
/* Check first show
@@ -284,18 +288,18 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$overlapping = Application_Model_Schedule::checkOverlappingShows($rebroadcastShowStart, $rebroadcastShowEnd, $update, $instanceId);
if ($overlapping) {
$valid = false;
- $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
+ $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
break;
}
}
} else {
$valid = false;
- $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
+ $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
}
} else {
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
if ($overlapping) {
- $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
+ $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
$valid = false;
}
}
diff --git a/airtime_mvc/application/forms/AddShowWho.php b/airtime_mvc/application/forms/AddShowWho.php
index 71d9f9fcc..aba16e110 100644
--- a/airtime_mvc/application/forms/AddShowWho.php
+++ b/airtime_mvc/application/forms/AddShowWho.php
@@ -7,7 +7,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
{
// Add hosts autocomplete
$this->addElement('text', 'add_show_hosts_autocomplete', array(
- 'label' => 'Search Users:',
+ 'label' => _('Search Users:'),
'class' => 'input_text ui-autocomplete-input',
'required' => false
));
@@ -21,7 +21,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
//Add hosts selection
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
- $hosts->setLabel('DJs:')
+ $hosts->setLabel(_('DJs:'))
->setMultiOptions($options);
$this->addElement($hosts);
diff --git a/airtime_mvc/application/forms/AddUser.php b/airtime_mvc/application/forms/AddUser.php
index 080c41bff..e94ea09ed 100644
--- a/airtime_mvc/application/forms/AddUser.php
+++ b/airtime_mvc/application/forms/AddUser.php
@@ -10,6 +10,8 @@ class Application_Form_AddUser extends Zend_Form
'../application/validate',
'validate');
* */
+ $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
+ $emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
$this->setAttrib('id', 'user_form');
@@ -18,71 +20,73 @@ class Application_Form_AddUser extends Zend_Form
$this->addElement($hidden);
$login = new Zend_Form_Element_Text('login');
- $login->setLabel('Username:');
+ $login->setLabel(_('Username:'));
$login->setAttrib('class', 'input_text');
$login->setRequired(true);
+ $login->addValidator($notEmptyValidator);
$login->addFilter('StringTrim');
//$login->addValidator('UserNameValidate');
$this->addElement($login);
$password = new Zend_Form_Element_Password('password');
- $password->setLabel('Password:');
+ $password->setLabel(_('Password:'));
$password->setAttrib('class', 'input_text');
$password->setRequired(true);
$password->addFilter('StringTrim');
- $password->addValidator('NotEmpty');
+ $password->addValidator($notEmptyValidator);
$this->addElement($password);
$firstName = new Zend_Form_Element_Text('first_name');
- $firstName->setLabel('Firstname:');
+ $firstName->setLabel(_('Firstname:'));
$firstName->setAttrib('class', 'input_text');
$firstName->addFilter('StringTrim');
- $firstName->addValidator('NotEmpty');
+ $firstName->addValidator($notEmptyValidator);
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('last_name');
- $lastName->setLabel('Lastname:');
+ $lastName->setLabel(_('Lastname:'));
$lastName->setAttrib('class', 'input_text');
$lastName->addFilter('StringTrim');
- $lastName->addValidator('NotEmpty');
+ $lastName->addValidator($notEmptyValidator);
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('email');
- $email->setLabel('Email:');
+ $email->setLabel(_('Email:'));
$email->setAttrib('class', 'input_text');
$email->addFilter('StringTrim');
$email->setRequired(true);
- $email->addValidator('EmailAddress');
+ $email->addValidator($notEmptyValidator);
+ $email->addValidator($emailValidator);
$this->addElement($email);
$cellPhone = new Zend_Form_Element_Text('cell_phone');
- $cellPhone->setLabel('Mobile Phone:');
+ $cellPhone->setLabel(_('Mobile Phone:'));
$cellPhone->setAttrib('class', 'input_text');
$cellPhone->addFilter('StringTrim');
$this->addElement($cellPhone);
$skype = new Zend_Form_Element_Text('skype');
- $skype->setLabel('Skype:');
+ $skype->setLabel(_('Skype:'));
$skype->setAttrib('class', 'input_text');
$skype->addFilter('StringTrim');
$this->addElement($skype);
$jabber = new Zend_Form_Element_Text('jabber');
- $jabber->setLabel('Jabber:');
+ $jabber->setLabel(_('Jabber:'));
$jabber->setAttrib('class', 'input_text');
$jabber->addFilter('StringTrim');
- $jabber->addValidator('EmailAddress');
+ $jabber->addValidator($emailValidator);
$this->addElement($jabber);
$select = new Zend_Form_Element_Select('type');
- $select->setLabel('User Type:');
+ $select->setLabel(_('User Type:'));
$select->setAttrib('class', 'input_select');
$select->setAttrib('style', 'width: 40%');
$select->setMultiOptions(array(
- "G" => "Guest",
- "H" => "DJ",
- "P" => "Program Manager",
- "A" => "Admin"
+ "G" => _("Guest"),
+ "H" => _("DJ"),
+ "P" => _("Program Manager"),
+ "A" => _("Admin")
));
$select->setRequired(true);
$this->addElement($select);
@@ -90,7 +94,7 @@ class Application_Form_AddUser extends Zend_Form
$saveBtn = new Zend_Form_Element_Button('save_user');
$saveBtn->setAttrib('class', 'btn btn-small right-floated');
$saveBtn->setIgnore(true);
- $saveBtn->setLabel('Save');
+ $saveBtn->setLabel(_('Save'));
$this->addElement($saveBtn);
}
@@ -100,7 +104,7 @@ class Application_Form_AddUser extends Zend_Form
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
if ($count != 0) {
- $this->getElement('login')->setErrors(array("Login name is not unique."));
+ $this->getElement('login')->setErrors(array(_("Login name is not unique.")));
return false;
}
diff --git a/airtime_mvc/application/forms/DateRange.php b/airtime_mvc/application/forms/DateRange.php
index 5d04696ed..4d8dd3570 100644
--- a/airtime_mvc/application/forms/DateRange.php
+++ b/airtime_mvc/application/forms/DateRange.php
@@ -13,7 +13,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm
$startDate = new Zend_Form_Element_Text('his_date_start');
$startDate->class = 'input_text';
$startDate->setRequired(true)
- ->setLabel('Date Start:')
+ ->setLabel(_('Date Start:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
@@ -32,7 +32,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
- array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@@ -41,7 +41,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm
$endDate = new Zend_Form_Element_Text('his_date_end');
$endDate->class = 'input_text';
$endDate->setRequired(true)
- ->setLabel('Date End:')
+ ->setLabel(_('Date End:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
@@ -60,7 +60,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
- array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
diff --git a/airtime_mvc/application/forms/EditAudioMD.php b/airtime_mvc/application/forms/EditAudioMD.php
index 219742b3f..913efd43c 100644
--- a/airtime_mvc/application/forms/EditAudioMD.php
+++ b/airtime_mvc/application/forms/EditAudioMD.php
@@ -10,75 +10,75 @@ class Application_Form_EditAudioMD extends Zend_Form
// Add title field
$this->addElement('text', 'track_title', array(
- 'label' => 'Title:',
+ 'label' => _('Title:'),
'class' => 'input_text',
'filters' => array('StringTrim'),
));
// Add artist field
$this->addElement('text', 'artist_name', array(
- 'label' => 'Creator:',
+ 'label' => _('Creator:'),
'class' => 'input_text',
'filters' => array('StringTrim'),
));
// Add album field
$this->addElement('text', 'album_title', array(
- 'label' => 'Album:',
+ 'label' => _('Album:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add track number field
$this->addElement('text', 'track_number', array(
- 'label' => 'Track:',
+ 'label' => _('Track:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add genre field
$this->addElement('text', 'genre', array(
- 'label' => 'Genre:',
+ 'label' => _('Genre:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add year field
$this->addElement('text', 'year', array(
- 'label' => 'Year:',
+ 'label' => _('Year:'),
'class' => 'input_text',
'filters' => array('StringTrim'),
'validators' => array(
- array('date', false, array('YYYY-MM-DD')),
- array('date', false, array('YYYY-MM')),
- array('date', false, array('YYYY'))
+ Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD"),
+ Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM"),
+ Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY")
)
));
// Add label field
$this->addElement('text', 'label', array(
- 'label' => 'Label:',
+ 'label' => _('Label:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add composer field
$this->addElement('text', 'composer', array(
- 'label' => 'Composer:',
+ 'label' => _('Composer:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add conductor field
$this->addElement('text', 'conductor', array(
- 'label' => 'Conductor:',
+ 'label' => _('Conductor:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add mood field
$this->addElement('text', 'mood', array(
- 'label' => 'Mood:',
+ 'label' => _('Mood:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
@@ -86,7 +86,7 @@ class Application_Form_EditAudioMD extends Zend_Form
// Add bmp field
$bpm = new Zend_Form_Element_Text('bpm');
$bpm->class = 'input_text';
- $bpm->setLabel('BPM:')
+ $bpm->setLabel(_('BPM:'))
->setFilters(array('StringTrim'))
->setValidators(array(
new Zend_Validate_StringLength(array('min'=>0,'max' => 8)),
@@ -95,28 +95,28 @@ class Application_Form_EditAudioMD extends Zend_Form
// Add copyright field
$this->addElement('text', 'copyright', array(
- 'label' => 'Copyright:',
+ 'label' => _('Copyright:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add isrc number field
$this->addElement('text', 'isrc_number', array(
- 'label' => 'ISRC Number:',
+ 'label' => _('ISRC Number:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add website field
$this->addElement('text', 'info_url', array(
- 'label' => 'Website:',
+ 'label' => _('Website:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add language field
$this->addElement('text', 'language', array(
- 'label' => 'Language:',
+ 'label' => _('Language:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
@@ -125,7 +125,7 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->addElement('submit', 'submit', array(
'ignore' => true,
'class' => 'btn',
- 'label' => 'Save',
+ 'label' => _('Save'),
'decorators' => array(
'ViewHelper'
)
@@ -135,7 +135,7 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->addElement('button', 'cancel', array(
'ignore' => true,
'class' => 'btn md-cancel',
- 'label' => 'Cancel',
+ 'label' => _('Cancel'),
'onclick' => 'javascript:document.location.href="'.$baseUrl.'/Library"',
'decorators' => array(
'ViewHelper'
diff --git a/airtime_mvc/application/forms/EmailServerPreferences.php b/airtime_mvc/application/forms/EmailServerPreferences.php
index 03c73dae9..4bf390390 100644
--- a/airtime_mvc/application/forms/EmailServerPreferences.php
+++ b/airtime_mvc/application/forms/EmailServerPreferences.php
@@ -14,7 +14,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
// Enable system emails
$this->addElement('checkbox', 'enableSystemEmail', array(
- 'label' => 'Enable System Emails (Password Reset)',
+ 'label' => _('Enable System Emails (Password Reset)'),
'required' => false,
'value' => Application_Model_Preference::GetEnableSystemEmail(),
'decorators' => array(
@@ -24,14 +24,14 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$this->addElement('text', 'systemEmail', array(
'class' => 'input_text',
- 'label' => 'Reset Password \'From\' Email',
+ 'label' => _("Reset Password 'From' Email"),
'value' => Application_Model_Preference::GetSystemEmail(),
'readonly' => true,
'decorators' => array('viewHelper')
));
$this->addElement('checkbox', 'configureMailServer', array(
- 'label' => 'Configure Mail Server',
+ 'label' => _('Configure Mail Server'),
'required' => false,
'value' => Application_Model_Preference::GetMailServerConfigured(),
'decorators' => array (
@@ -40,7 +40,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
));
$this->addElement('checkbox', 'msRequiresAuth', array(
- 'label' => 'Requires Authentication',
+ 'label' => _('Requires Authentication'),
'required' => false,
'value' => Application_Model_Preference::GetMailServerRequiresAuth(),
'decorators' => array(
@@ -50,7 +50,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$this->addElement('text', 'mailServer', array(
'class' => 'input_text',
- 'label' => 'Mail Server',
+ 'label' => _('Mail Server'),
'value' => Application_Model_Preference::GetMailServer(),
'readonly' => true,
'decorators' => array('viewHelper'),
@@ -64,7 +64,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$this->addElement('text', 'email', array(
'class' => 'input_text',
- 'label' => 'Email Address',
+ 'label' => _('Email Address'),
'value' => Application_Model_Preference::GetMailServerEmailAddress(),
'readonly' => true,
'decorators' => array('viewHelper'),
@@ -79,7 +79,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$this->addElement('password', 'ms_password', array(
'class' => 'input_text',
- 'label' => 'Password',
+ 'label' => _('Password'),
'value' => Application_Model_Preference::GetMailServerPassword(),
'readonly' => true,
'decorators' => array('viewHelper'),
@@ -97,7 +97,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$port->class = 'input_text';
$port->setRequired(false)
->setValue(Application_Model_Preference::GetMailServerPort())
- ->setLabel('Port')
+ ->setLabel(_('Port'))
->setAttrib('readonly', true)
->setDecorators(array('viewHelper'));
diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php
index 815d46779..0244c983d 100644
--- a/airtime_mvc/application/forms/GeneralPreferences.php
+++ b/airtime_mvc/application/forms/GeneralPreferences.php
@@ -6,6 +6,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
public function init()
{
+ $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))
));
@@ -18,7 +19,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
//Station name
$this->addElement('text', 'stationName', array(
'class' => 'input_text',
- 'label' => 'Station Name',
+ 'label' => _('Station Name'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetStationName(),
@@ -30,12 +31,12 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
//Default station fade
$this->addElement('text', 'stationDefaultFade', array(
'class' => 'input_text',
- 'label' => 'Default Fade (s):',
- 'required' => false,
+ 'label' => _('Default Fade (s):'),
+ 'required' => true,
'filters' => array('StringTrim'),
- 'validators' => array(array('regex', false,
+ 'validators' => array(array($notEmptyValidator, 'regex', false,
array('/^[0-9]{1,2}(\.\d{1})?$/',
- 'messages' => 'enter a time in seconds 0{.0}'))),
+ 'messages' => _('enter a time in seconds 0{.0}')))),
'value' => $defaultFade,
'decorators' => array(
'ViewHelper'
@@ -43,16 +44,24 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
));
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
- $third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?
(Enable this to make front-end widgets work.)');
- $third_party_api->setMultiOptions(array("Disabled",
- "Enabled"));
+ $third_party_api->setLabel(
+ sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '
'));
+ $third_party_api->setMultiOptions(array(_("Disabled"),
+ _("Enabled")));
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper'));
$this->addElement($third_party_api);
+
+ $locale = new Zend_Form_Element_Select("locale");
+ $locale->setLabel(_("Language"));
+ $locale->setMultiOptions(Application_Model_Locale::getLocales());
+ $locale->setValue(Application_Model_Preference::GetLocale());
+ $locale->setDecorators(array('ViewHelper'));
+ $this->addElement($locale);
/* Form Element for setting the Timezone */
$timezone = new Zend_Form_Element_Select("timezone");
- $timezone->setLabel("Timezone");
+ $timezone->setLabel(_("Timezone"));
$timezone->setMultiOptions($this->getTimezones());
$timezone->setValue(Application_Model_Preference::GetTimezone());
$timezone->setDecorators(array('ViewHelper'));
@@ -60,7 +69,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
/* Form Element for setting which day is the start of the week */
$week_start_day = new Zend_Form_Element_Select("weekStartDay");
- $week_start_day->setLabel("Week Starts On");
+ $week_start_day->setLabel(_("Week Starts On"));
$week_start_day->setMultiOptions($this->getWeekStartDays());
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
$week_start_day->setDecorators(array('ViewHelper'));
@@ -97,13 +106,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
private function getWeekStartDays()
{
$days = array(
- 'Sunday',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday'
+ _('Sunday'),
+ _('Monday'),
+ _('Tuesday'),
+ _('Wednesday'),
+ _('Thursday'),
+ _('Friday'),
+ _('Saturday')
);
return $days;
diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php
index 6bef2be12..975ee3516 100644
--- a/airtime_mvc/application/forms/LiveStreamingPreferences.php
+++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php
@@ -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,46 +75,47 @@ 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);
//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")
+ $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.')))
+ ->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);
$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.')))
+ ->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);
$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 +150,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 +161,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 +179,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);
diff --git a/airtime_mvc/application/forms/Login.php b/airtime_mvc/application/forms/Login.php
index 3761ff939..bd1deb806 100644
--- a/airtime_mvc/application/forms/Login.php
+++ b/airtime_mvc/application/forms/Login.php
@@ -16,7 +16,7 @@ class Application_Form_Login extends Zend_Form
// Add username element
$this->addElement('text', 'username', array(
- 'label' => 'Username:',
+ 'label' => _('Username:'),
'class' => 'input_text',
'required' => true,
'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'',
@@ -31,7 +31,7 @@ class Application_Form_Login extends Zend_Form
// Add password element
$this->addElement('password', 'password', array(
- 'label' => 'Password:',
+ 'label' => _('Password:'),
'class' => 'input_text',
'required' => true,
'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'',
@@ -56,7 +56,7 @@ class Application_Form_Login extends Zend_Form
// Add the submit button
$this->addElement('submit', 'submit', array(
'ignore' => true,
- 'label' => 'Login',
+ 'label' => _('Login'),
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
'decorators' => array(
'ViewHelper'
@@ -74,7 +74,7 @@ class Application_Form_Login extends Zend_Form
$captcha = new Zend_Form_Element_Captcha('captcha',
array(
- 'label' => 'Type the characters you see in the picture below.',
+ 'label' => _('Type the characters you see in the picture below.'),
'captcha' => 'ReCaptcha',
'captchaOptions' => array(
'captcha' => 'ReCaptcha',
diff --git a/airtime_mvc/application/forms/PasswordChange.php b/airtime_mvc/application/forms/PasswordChange.php
index 48efae5ff..1b93911b0 100644
--- a/airtime_mvc/application/forms/PasswordChange.php
+++ b/airtime_mvc/application/forms/PasswordChange.php
@@ -9,21 +9,23 @@ class Application_Form_PasswordChange extends Zend_Form
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/password-change.phtml'))
));
+
+ $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
+ $stringLengthValidator = Application_Form_Helper_ValidationTypes::overrideStringLengthValidator(6, 80);
$this->addElement('password', 'password', array(
- 'label' => 'Password',
+ 'label' => _('Password'),
'required' => true,
'filters' => array('stringTrim'),
- 'validators' => array(
- array('stringLength', false, array(6, 80)),
- ),
+ 'validators' => array($notEmptyValidator,
+ $stringLengthValidator),
'decorators' => array(
'ViewHelper'
)
));
$this->addElement('password', 'password_confirm', array(
- 'label' => 'Confirm new password',
+ 'label' => _('Confirm new password'),
'required' => true,
'filters' => array('stringTrim'),
'validators' => array(
@@ -31,14 +33,14 @@ class Application_Form_PasswordChange extends Zend_Form
return $value == $context['password'];
}),
),
- 'errorMessages' => array("Password confirmation does not match your password."),
+ 'errorMessages' => array(_("Password confirmation does not match your password.")),
'decorators' => array(
'ViewHelper'
)
));
$this->addElement('submit', 'submit', array(
- 'label' => 'Get new password',
+ 'label' => _('Get new password'),
'ignore' => true,
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
'decorators' => array(
diff --git a/airtime_mvc/application/forms/PasswordRestore.php b/airtime_mvc/application/forms/PasswordRestore.php
index 584e767ad..0e8f4ad9c 100644
--- a/airtime_mvc/application/forms/PasswordRestore.php
+++ b/airtime_mvc/application/forms/PasswordRestore.php
@@ -11,7 +11,7 @@ class Application_Form_PasswordRestore extends Zend_Form
));
$this->addElement('text', 'email', array(
- 'label' => 'E-mail',
+ 'label' => _('E-mail'),
'required' => true,
'filters' => array(
'stringTrim',
@@ -22,7 +22,7 @@ class Application_Form_PasswordRestore extends Zend_Form
));
$this->addElement('text', 'username', array(
- 'label' => 'Username',
+ 'label' => _('Username'),
'required' => false,
'filters' => array(
'stringTrim',
@@ -33,7 +33,7 @@ class Application_Form_PasswordRestore extends Zend_Form
));
$this->addElement('submit', 'submit', array(
- 'label' => 'Restore password',
+ 'label' => _('Restore password'),
'ignore' => true,
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
'decorators' => array(
@@ -43,7 +43,7 @@ class Application_Form_PasswordRestore extends Zend_Form
$cancel = new Zend_Form_Element_Button("cancel");
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
- $cancel->setLabel("Cancel")
+ $cancel->setLabel(_("Cancel"))
->setIgnore(True)
->setAttrib('onclick', 'redirectToLogin();')
->setDecorators(array('ViewHelper'));
diff --git a/airtime_mvc/application/forms/RegisterAirtime.php b/airtime_mvc/application/forms/RegisterAirtime.php
index 9ffd853e1..8c4af94c6 100644
--- a/airtime_mvc/application/forms/RegisterAirtime.php
+++ b/airtime_mvc/application/forms/RegisterAirtime.php
@@ -27,7 +27,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station Name
$stnName = new Zend_Form_Element_Text("stnName");
- $stnName->setLabel("Station Name")
+ $stnName->setLabel(_("Station Name"))
->setRequired(true)
->setValue(Application_Model_Preference::GetStationName())
->setDecorators(array('ViewHelper'));
@@ -36,7 +36,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Phone number
$this->addElement('text', 'Phone', array(
'class' => 'input_text',
- 'label' => 'Phone:',
+ 'label' => _('Phone:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetPhone(),
@@ -48,7 +48,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
//Email
$this->addElement('text', 'Email', array(
'class' => 'input_text',
- 'label' => 'Email:',
+ 'label' => _('Email:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetEmail(),
@@ -59,7 +59,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station Web Site
$this->addElement('text', 'StationWebSite', array(
- 'label' => 'Station Web Site:',
+ 'label' => _('Station Web Site:'),
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationWebSite(),
@@ -70,7 +70,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// county list dropdown
$this->addElement('select', 'Country', array(
- 'label' => 'Country:',
+ 'label' => _('Country:'),
'required' => false,
'value' => Application_Model_Preference::GetStationCountry(),
'multiOptions' => $country_list,
@@ -81,7 +81,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station city
$this->addElement('text', 'City', array(
- 'label' => 'City:',
+ 'label' => _('City:'),
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationCity(),
@@ -93,7 +93,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station Description
$description = new Zend_Form_Element_Textarea('Description');
$description->class = 'input_text_area';
- $description->setLabel('Station Description:')
+ $description->setLabel(_('Station Description:'))
->setRequired(false)
->setValue(Application_Model_Preference::GetStationDescription())
->setDecorators(array('ViewHelper'))
@@ -103,7 +103,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station Logo
$upload = new Zend_Form_Element_File('Logo');
- $upload->setLabel('Station Logo:')
+ $upload->setLabel(_('Station Logo:'))
->setRequired(false)
->setDecorators(array('File'))
->addValidator('Count', false, 1)
@@ -113,7 +113,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
- 'label' => 'Send support feedback',
+ 'label' => _('Send support feedback'),
'required' => false,
'value' => 1,
'decorators' => array(
@@ -123,7 +123,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
- $checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
+ $checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org'))
->setRequired(false)
->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise());
@@ -145,7 +145,10 @@ class Application_Form_RegisterAirtime extends Zend_Form
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
- $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's privacy policy.")
+ $checkboxPrivacy->setLabel(
+ sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."),
+ "",
+ ""))
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
}
@@ -160,7 +163,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
if (isset($data["Privacy"])) {
$checkPrivacy = $this->getElement('Privacy');
if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {
- $checkPrivacy->addError("You have to agree to privacy policy.");
+ $checkPrivacy->addError(_("You have to agree to privacy policy."));
$isValid = false;
}
}
diff --git a/airtime_mvc/application/forms/ShowBuilder.php b/airtime_mvc/application/forms/ShowBuilder.php
index 465d2dd71..291caccc2 100644
--- a/airtime_mvc/application/forms/ShowBuilder.php
+++ b/airtime_mvc/application/forms/ShowBuilder.php
@@ -15,7 +15,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
$startDate = new Zend_Form_Element_Text('sb_date_start');
$startDate->class = 'input_text';
$startDate->setRequired(true)
- ->setLabel('Date Start:')
+ ->setLabel(_('Date Start:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
@@ -34,7 +34,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
- array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@@ -43,7 +43,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
$endDate = new Zend_Form_Element_Text('sb_date_end');
$endDate->class = 'input_text';
$endDate->setRequired(true)
- ->setLabel('Date End:')
+ ->setLabel(_('Date End:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
@@ -62,14 +62,14 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
- array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
// add a select to choose a show.
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
- $showSelect->setLabel("Show:");
+ $showSelect->setLabel(_("Show:"));
$showSelect->setMultiOptions($this->getShowNames());
$showSelect->setValue(null);
$showSelect->setDecorators(array('ViewHelper'));
@@ -77,7 +77,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
if ($user->getType() === 'H') {
$myShows = new Zend_Form_Element_Checkbox('sb_my_shows');
- $myShows->setLabel('All My Shows:')
+ $myShows->setLabel(_('All My Shows:'))
->setDecorators(array('ViewHelper'));
$this->addElement($myShows);
}
diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php
index e48fc7590..f47117b63 100644
--- a/airtime_mvc/application/forms/SmartBlockCriteria.php
+++ b/airtime_mvc/application/forms/SmartBlockCriteria.php
@@ -1,88 +1,119 @@
"Select criteria",
- "album_title" => "Album",
- "bit_rate" => "Bit Rate (Kbps)",
- "bpm" => "BPM",
- "composer" => "Composer",
- "conductor" => "Conductor",
- "copyright" => "Copyright",
- "artist_name" => "Creator",
- "encoded_by" => "Encoded By",
- "genre" => "Genre",
- "isrc_number" => "ISRC",
- "label" => "Label",
- "language" => "Language",
- "mtime" => "Last Modified",
- "lptime" => "Last Played",
- "length" => "Length",
- "mime" => "Mime",
- "mood" => "Mood",
- "owner_id" => "Owner",
- "replay_gain" => "Replay Gain",
- "sample_rate" => "Sample Rate (kHz)",
- "track_title" => "Title",
- "track_number" => "Track Number",
- "utime" => "Uploaded",
- "info_url" => "Website",
- "year" => "Year"
- );
-
+ private $criteriaOptions;
+ private $stringCriteriaOptions;
+ private $numericCriteriaOptions;
+ private $limitOptions;
private $criteriaTypes = array(
- 0 => "",
- "album_title" => "s",
- "bit_rate" => "n",
- "bpm" => "n",
- "composer" => "s",
- "conductor" => "s",
- "copyright" => "s",
- "artist_name" => "s",
- "encoded_by" => "s",
- "utime" => "n",
- "mtime" => "n",
- "lptime" => "n",
- "genre" => "s",
- "isrc_number" => "s",
- "label" => "s",
- "language" => "s",
- "length" => "n",
- "mime" => "s",
- "mood" => "s",
- "owner_id" => "s",
- "replay_gain" => "n",
- "sample_rate" => "n",
- "track_title" => "s",
- "track_number" => "n",
- "info_url" => "s",
- "year" => "n"
+ 0 => "",
+ "album_title" => "s",
+ "bit_rate" => "n",
+ "bpm" => "n",
+ "composer" => "s",
+ "conductor" => "s",
+ "copyright" => "s",
+ "artist_name" => "s",
+ "encoded_by" => "s",
+ "utime" => "n",
+ "mtime" => "n",
+ "lptime" => "n",
+ "genre" => "s",
+ "isrc_number" => "s",
+ "label" => "s",
+ "language" => "s",
+ "length" => "n",
+ "mime" => "s",
+ "mood" => "s",
+ "owner_id" => "s",
+ "replay_gain" => "n",
+ "sample_rate" => "n",
+ "track_title" => "s",
+ "track_number" => "n",
+ "info_url" => "s",
+ "year" => "n"
);
+
+ private function getCriteriaOptions($option = null)
+ {
+ if (!isset($this->criteriaOptions)) {
+ $this->criteriaOptions = array(
+ 0 => _("Select criteria"),
+ "album_title" => _("Album"),
+ "bit_rate" => _("Bit Rate (Kbps)"),
+ "bpm" => _("BPM"),
+ "composer" => _("Composer"),
+ "conductor" => _("Conductor"),
+ "copyright" => _("Copyright"),
+ "artist_name" => _("Creator"),
+ "encoded_by" => _("Encoded By"),
+ "genre" => _("Genre"),
+ "isrc_number" => _("ISRC"),
+ "label" => _("Label"),
+ "language" => _("Language"),
+ "mtime" => _("Last Modified"),
+ "lptime" => _("Last Played"),
+ "length" => _("Length"),
+ "mime" => _("Mime"),
+ "mood" => _("Mood"),
+ "owner_id" => _("Owner"),
+ "replay_gain" => _("Replay Gain"),
+ "sample_rate" => _("Sample Rate (kHz)"),
+ "track_title" => _("Title"),
+ "track_number" => _("Track Number"),
+ "utime" => _("Uploaded"),
+ "info_url" => _("Website"),
+ "year" => _("Year")
+ );
+ }
+
+ if (is_null($option)) return $this->criteriaOptions;
+ else return $this->criteriaOptions[$option];
+ }
- private $stringCriteriaOptions = array(
- "0" => "Select modifier",
- "contains" => "contains",
- "does not contain" => "does not contain",
- "is" => "is",
- "is not" => "is not",
- "starts with" => "starts with",
- "ends with" => "ends with"
- );
+ private function getStringCriteriaOptions()
+ {
+ if (!isset($this->stringCriteriaOptions)) {
+ $this->stringCriteriaOptions = array(
+ "0" => _("Select modifier"),
+ "contains" => _("contains"),
+ "does not contain" => _("does not contain"),
+ "is" => _("is"),
+ "is not" => _("is not"),
+ "starts with" => _("starts with"),
+ "ends with" => _("ends with")
+ );
+ }
+ return $this->stringCriteriaOptions;
+ }
- private $numericCriteriaOptions = array(
- "0" => "Select modifier",
- "is" => "is",
- "is not" => "is not",
- "is greater than" => "is greater than",
- "is less than" => "is less than",
- "is in the range" => "is in the range"
- );
+ private function getNumericCriteriaOptions()
+ {
+ if (!isset($this->numericCriteriaOptions)) {
+ $this->numericCriteriaOptions = array(
+ "0" => _("Select modifier"),
+ "is" => _("is"),
+ "is not" => _("is not"),
+ "is greater than" => _("is greater than"),
+ "is less than" => _("is less than"),
+ "is in the range" => _("is in the range")
+ );
+ }
+ return $this->numericCriteriaOptions;
+ }
- private $limitOptions = array(
- "hours" => "hours",
- "minutes" => "minutes",
- "items" => "items"
- );
+ private function getLimitOptions()
+ {
+ if (!isset($this->limitOptions)) {
+ $this->limitOptions = array(
+ "hours" => _("hours"),
+ "minutes" => _("minutes"),
+ "items" => _("items")
+ );
+ }
+ return $this->limitOptions;
+ }
+
public function init()
{
@@ -99,11 +130,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
$spType = new Zend_Form_Element_Radio('sp_type');
- $spType->setLabel('Set smart block type:')
+ $spType->setLabel(_('Set smart block type:'))
->setDecorators(array('viewHelper'))
->setMultiOptions(array(
- 'static' => 'Static',
- 'dynamic' => 'Dynamic'
+ 'static' => _('Static'),
+ 'dynamic' => _('Dynamic')
))
->setValue($blockType);
$this->addElement($spType);
@@ -126,7 +157,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if (isset($storedCrit["crit"])) {
$criteriaKeys = array_keys($storedCrit["crit"]);
}
- $numElements = count($this->criteriaOptions);
+ $numElements = count($this->getCriteriaOptions());
for ($i = 0; $i < $numElements; $i++) {
$criteriaType = "";
@@ -153,7 +184,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$criteria->setAttrib('class', 'input_select sp_input_select'.$invisible)
->setValue('Select criteria')
->setDecorators(array('viewHelper'))
- ->setMultiOptions($this->criteriaOptions);
+ ->setMultiOptions($this->getCriteriaOptions());
if ($i != 0 && !isset($criteriaKeys[$i])) {
$criteria->setAttrib('disabled', 'disabled');
}
@@ -174,13 +205,13 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
if (isset($criteriaKeys[$i])) {
if ($criteriaType == "s") {
- $criteriaModifers->setMultiOptions($this->stringCriteriaOptions);
+ $criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
} else {
- $criteriaModifers->setMultiOptions($this->numericCriteriaOptions);
+ $criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
}
$criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]);
} else {
- $criteriaModifers->setMultiOptions(array('0' => 'Select modifier'));
+ $criteriaModifers->setMultiOptions(array('0' => _('Select modifier')));
}
$this->addElement($criteriaModifers);
@@ -214,7 +245,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks');
$repeatTracks->setDecorators(array('viewHelper'))
- ->setLabel('Allow Repeat Tracks:');
+ ->setLabel(_('Allow Repeat Tracks:'));
if (isset($storedCrit["repeat_tracks"])) {
$repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false);
}
@@ -223,7 +254,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$limit = new Zend_Form_Element_Select('sp_limit_options');
$limit->setAttrib('class', 'sp_input_select')
->setDecorators(array('viewHelper'))
- ->setMultiOptions($this->limitOptions);
+ ->setMultiOptions($this->getLimitOptions());
if (isset($storedCrit["limit"])) {
$limit->setValue($storedCrit["limit"]["modifier"]);
}
@@ -231,7 +262,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$limitValue = new Zend_Form_Element_Text('sp_limit_value');
$limitValue->setAttrib('class', 'sp_input_text_limit')
- ->setLabel('Limit to')
+ ->setLabel(_('Limit to'))
->setDecorators(array('viewHelper'));
$this->addElement($limitValue);
if (isset($storedCrit["limit"])) {
@@ -253,23 +284,23 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$generate = new Zend_Form_Element_Button('generate_button');
$generate->setAttrib('class', 'btn btn-small');
- $generate->setAttrib('title', 'Generate playlist content and save criteria');
+ $generate->setAttrib('title', _('Generate playlist content and save criteria'));
$generate->setIgnore(true);
- $generate->setLabel('Generate');
+ $generate->setLabel(_('Generate'));
$generate->setDecorators(array('viewHelper'));
$this->addElement($generate);
$shuffle = new Zend_Form_Element_Button('shuffle_button');
$shuffle->setAttrib('class', 'btn btn-small');
- $shuffle->setAttrib('title', 'Shuffle playlist content');
+ $shuffle->setAttrib('title', _('Shuffle playlist content'));
$shuffle->setIgnore(true);
- $shuffle->setLabel('Shuffle');
+ $shuffle->setLabel(_('Shuffle'));
$shuffle->setDecorators(array('viewHelper'));
$this->addElement($shuffle);
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/smart-block-criteria.phtml', "openOption"=> $openSmartBlockOption,
- 'criteriasLength' => count($this->criteriaOptions), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap,
+ 'criteriasLength' => count($this->getCriteriaOptions()), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap,
'showPoolCount' => $showPoolCount))
));
}
@@ -278,24 +309,24 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
{
$data = Application_Model_Block::organizeSmartPlyalistCriteria($params['data']);
// add elelments that needs to be added
- // set multioption for modifier according to creiteria_field
+ // set multioption for modifier according to criteria_field
$modRowMap = array();
foreach ($data['criteria'] as $critKey=>$d) {
$count = 1;
foreach ($d as $modKey=>$modInfo) {
if ($modKey == 0) {
$eleCrit = $this->getElement("sp_criteria_field_".$critKey."_".$modKey);
- $eleCrit->setValue($this->criteriaOptions[$modInfo['sp_criteria_field']]);
+ $eleCrit->setValue($this->getCriteriaOptions($modInfo['sp_criteria_field']));
$eleCrit->setAttrib("disabled", null);
$eleMod = $this->getElement("sp_criteria_modifier_".$critKey."_".$modKey);
$criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']];
if ($criteriaType == "s") {
- $eleMod->setMultiOptions($this->stringCriteriaOptions);
+ $eleMod->setMultiOptions($this->getStringCriteriaOptions());
} elseif ($criteriaType == "n") {
- $eleMod->setMultiOptions($this->numericCriteriaOptions);
+ $eleMod->setMultiOptions($this->getNumericCriteriaOptions());
} else {
- $eleMod->setMultiOptions(array('0' => 'Select modifier'));
+ $eleMod->setMultiOptions(array('0' => _('Select modifier')));
}
$eleMod->setValue($modInfo['sp_criteria_modifier']);
$eleMod->setAttrib("disabled", null);
@@ -316,10 +347,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$criteria->setAttrib('class', 'input_select sp_input_select sp-invisible')
->setValue('Select criteria')
->setDecorators(array('viewHelper'))
- ->setMultiOptions($this->criteriaOptions);
+ ->setMultiOptions($this->getCriteriaOptions());
$criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']];
- $criteria->setValue($this->criteriaOptions[$modInfo['sp_criteria_field']]);
+ $criteria->setValue($this->getCriteriaOptions($modInfo['sp_criteria_field']));
$this->addElement($criteria);
/****************** MODIFIER ***********/
@@ -329,11 +360,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
->setDecorators(array('viewHelper'));
if ($criteriaType == "s") {
- $criteriaModifers->setMultiOptions($this->stringCriteriaOptions);
+ $criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
} elseif ($criteriaType == "n") {
- $criteriaModifers->setMultiOptions($this->numericCriteriaOptions);
+ $criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
} else {
- $criteriaModifers->setMultiOptions(array('0' => 'Select modifier'));
+ $criteriaModifers->setMultiOptions(array('0' => _('Select modifier')));
}
$criteriaModifers->setValue($modInfo['sp_criteria_modifier']);
$this->addElement($criteriaModifers);
@@ -427,25 +458,25 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if ($data['etc']['sp_limit_options'] == 'hours' || $data['etc']['sp_limit_options'] == 'mins') {
$element = $this->getElement("sp_limit_value");
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
- $element->addError("Limit cannot be empty or smaller than 0");
+ $element->addError(_("Limit cannot be empty or smaller than 0"));
$isValid = false;
} else {
$mins = floatval($data['etc']['sp_limit_value']) * $multiplier;
if ($mins > 1440) {
- $element->addError("Limit cannot be more than 24 hrs");
+ $element->addError(_("Limit cannot be more than 24 hrs"));
$isValid = false;
}
}
} else {
$element = $this->getElement("sp_limit_value");
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
- $element->addError("Limit cannot be empty or smaller than 0");
+ $element->addError(_("Limit cannot be empty or smaller than 0"));
$isValid = false;
} elseif (!ctype_digit($data['etc']['sp_limit_value'])) {
- $element->addError("The value should be an integer");
+ $element->addError(_("The value should be an integer"));
$isValid = false;
} elseif (intval($data['etc']['sp_limit_value']) > 500) {
- $element->addError("500 is the max item limit value you can set");
+ $element->addError(_("500 is the max item limit value you can set"));
$isValid = false;
}
}
@@ -456,19 +487,19 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$element = $this->getElement("sp_criteria_field_".$rowKey."_".$key);
// check for not selected select box
if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0") {
- $element->addError("You must select Criteria and Modifier");
+ $element->addError(_("You must select Criteria and Modifier"));
$isValid = false;
} else {
$column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]);
// validation on type of column
if ($d['sp_criteria_field'] == 'length') {
if (!preg_match("/^(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
- $element->addError("'Length' should be in '00:00:00' format");
+ $element->addError(_("'Length' should be in '00:00:00' format"));
$isValid = false;
}
} elseif ($column->getType() == PropelColumnTypes::TIMESTAMP) {
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
- $element->addError("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00");
+ $element->addError(_("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00)"));
$isValid = false;
} else {
$result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value']);
@@ -481,7 +512,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if (isset($d['sp_criteria_extra'])) {
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) {
- $element->addError("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00");
+ $element->addError(_("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00)"));
$isValid = false;
} else {
$result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra']);
@@ -495,24 +526,24 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
} elseif ($column->getType() == PropelColumnTypes::INTEGER &&
$d['sp_criteria_field'] != 'owner_id') {
if (!is_numeric($d['sp_criteria_value'])) {
- $element->addError("The value has to be numeric");
+ $element->addError(_("The value has to be numeric"));
$isValid = false;
}
// length check
if (intval($d['sp_criteria_value']) >= pow(2,31)) {
- $element->addError("The value should be less then 2147483648");
+ $element->addError(_("The value should be less then 2147483648"));
$isValid = false;
}
} elseif ($column->getType() == PropelColumnTypes::VARCHAR) {
if (strlen($d['sp_criteria_value']) > $column->getSize()) {
- $element->addError("The value should be less ".$column->getSize()." characters");
+ $element->addError(sprintf(_("The value should be less than %s characters"), $column->getSize()));
$isValid = false;
}
}
}
if ($d['sp_criteria_value'] == "") {
- $element->addError("Value cannot be empty");
+ $element->addError(_("Value cannot be empty"));
$isValid = false;
}
}//end foreach
diff --git a/airtime_mvc/application/forms/SoundcloudPreferences.php b/airtime_mvc/application/forms/SoundcloudPreferences.php
index d3840cbbf..30e1702c9 100644
--- a/airtime_mvc/application/forms/SoundcloudPreferences.php
+++ b/airtime_mvc/application/forms/SoundcloudPreferences.php
@@ -13,7 +13,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//enable soundcloud uploads
$this->addElement('checkbox', 'UseSoundCloud', array(
- 'label' => 'Automatically Upload Recorded Shows',
+ 'label' => _('Automatically Upload Recorded Shows'),
'required' => false,
'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(),
'decorators' => array(
@@ -23,7 +23,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//enable soundcloud uploads option
$this->addElement('checkbox', 'UploadToSoundcloudOption', array(
- 'label' => 'Enable SoundCloud Upload',
+ 'label' => _('Enable SoundCloud Upload'),
'required' => false,
'value' => Application_Model_Preference::GetUploadToSoundcloudOption(),
'decorators' => array(
@@ -33,7 +33,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//enable downloadable for soundcloud
$this->addElement('checkbox', 'SoundCloudDownloadbleOption', array(
- 'label' => 'Automatically Mark Files "Downloadable" on SoundCloud',
+ 'label' => _('Automatically Mark Files "Downloadable" on SoundCloud'),
'required' => false,
'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(),
'decorators' => array(
@@ -44,7 +44,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//SoundCloud Username
$this->addElement('text', 'SoundCloudUser', array(
'class' => 'input_text',
- 'label' => 'SoundCloud Email',
+ 'label' => _('SoundCloud Email'),
'filters' => array('StringTrim'),
'autocomplete' => 'off',
'value' => Application_Model_Preference::GetSoundCloudUser(),
@@ -64,7 +64,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//SoundCloud Password
$this->addElement('password', 'SoundCloudPassword', array(
'class' => 'input_text',
- 'label' => 'SoundCloud Password',
+ 'label' => _('SoundCloud Password'),
'filters' => array('StringTrim'),
'autocomplete' => 'off',
'value' => Application_Model_Preference::GetSoundCloudPassword(),
@@ -84,7 +84,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
// Add the description element
$this->addElement('textarea', 'SoundCloudTags', array(
- 'label' => 'SoundCloud Tags: (separate tags with spaces)',
+ 'label' => _('SoundCloud Tags: (separate tags with spaces)'),
'required' => false,
'class' => 'input_text_area',
'value' => Application_Model_Preference::GetSoundCloudTags(),
@@ -96,7 +96,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//SoundCloud default genre
$this->addElement('text', 'SoundCloudGenre', array(
'class' => 'input_text',
- 'label' => 'Default Genre:',
+ 'label' => _('Default Genre:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetSoundCloudGenre(),
@@ -106,23 +106,23 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
));
$select = new Zend_Form_Element_Select('SoundCloudTrackType');
- $select->setLabel('Default Track Type:');
+ $select->setLabel(_('Default Track Type:'));
$select->setAttrib('class', 'input_select');
$select->setMultiOptions(array(
"" => "",
- "original" => "Original",
- "remix" => "Remix",
- "live" => "Live",
- "recording" => "Recording",
- "spoken" => "Spoken",
- "podcast" => "Podcast",
- "demo" => "Demo",
- "in progress" => "Work in progress",
- "stem" => "Stem",
- "loop" => "Loop",
- "sound effect" => "Sound Effect",
- "sample" => "One Shot Sample",
- "other" => "Other"
+ "original" => _("Original"),
+ "remix" => _("Remix"),
+ "live" => _("Live"),
+ "recording" => _("Recording"),
+ "spoken" => _("Spoken"),
+ "podcast" => _("Podcast"),
+ "demo" => _("Demo"),
+ "in progress" => _("Work in progress"),
+ "stem" => _("Stem"),
+ "loop" => _("Loop"),
+ "sound effect" => _("Sound Effect"),
+ "sample" => _("One Shot Sample"),
+ "other" => _("Other")
));
$select->setRequired(false);
$select->setValue(Application_Model_Preference::GetSoundCloudTrackType());
@@ -130,18 +130,18 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
$this->addElement($select);
$select = new Zend_Form_Element_Select('SoundCloudLicense');
- $select->setLabel('Default License:');
+ $select->setLabel(_('Default License:'));
$select->setAttrib('class', 'input_select');
$select->setMultiOptions(array(
"" => "",
- "no-rights-reserved" => "The work is in the public domain",
- "all-rights-reserved" => "All rights are reserved",
- "cc-by" => "Creative Commons Attribution",
- "cc-by-nc" => "Creative Commons Attribution Noncommercial",
- "cc-by-nd" => "Creative Commons Attribution No Derivative Works",
- "cc-by-sa" => "Creative Commons Attribution Share Alike",
- "cc-by-nc-nd" => "Creative Commons Attribution Noncommercial Non Derivate Works",
- "cc-by-nc-sa" => "Creative Commons Attribution Noncommercial Share Alike"
+ "no-rights-reserved" => _("The work is in the public domain"),
+ "all-rights-reserved" => _("All rights are reserved"),
+ "cc-by" => _("Creative Commons Attribution"),
+ "cc-by-nc" => _("Creative Commons Attribution Noncommercial"),
+ "cc-by-nd" => _("Creative Commons Attribution No Derivative Works"),
+ "cc-by-sa" => _("Creative Commons Attribution Share Alike"),
+ "cc-by-nc-nd" => _("Creative Commons Attribution Noncommercial Non Derivate Works"),
+ "cc-by-nc-sa" => _("Creative Commons Attribution Noncommercial Share Alike")
));
$select->setRequired(false);
$select->setValue(Application_Model_Preference::GetSoundCloudLicense());
diff --git a/airtime_mvc/application/forms/StreamSetting.php b/airtime_mvc/application/forms/StreamSetting.php
index c3443a3e0..1663cf127 100644
--- a/airtime_mvc/application/forms/StreamSetting.php
+++ b/airtime_mvc/application/forms/StreamSetting.php
@@ -19,7 +19,7 @@ class Application_Form_StreamSetting extends Zend_Form
$setting = $this->setting;
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
- $output_sound_device->setLabel('Hardware Audio Output')
+ $output_sound_device->setLabel(_('Hardware Audio Output'))
->setRequired(false)
->setValue(($setting['output_sound_device'] == "true")?1:0)
->setDecorators(array('ViewHelper'));
@@ -30,7 +30,7 @@ class Application_Form_StreamSetting extends Zend_Form
$output_types = array("ALSA"=>"ALSA", "AO"=>"AO", "OSS"=>"OSS", "Portaudio"=>"Portaudio", "Pulseaudio"=>"Pulseaudio");
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
- $output_type->setLabel("Output Type")
+ $output_type->setLabel(_("Output Type"))
->setMultiOptions($output_types)
->setValue($setting['output_sound_device_type'])
->setDecorators(array('ViewHelper'));
@@ -41,7 +41,7 @@ class Application_Form_StreamSetting extends Zend_Form
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
- $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
+ $icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))
->setRequired(false)
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
->setDecorators(array('ViewHelper'));
@@ -51,10 +51,10 @@ class Application_Form_StreamSetting extends Zend_Form
$this->addElement($icecast_vorbis_metadata);
$stream_format = new Zend_Form_Element_Radio('streamFormat');
- $stream_format->setLabel('Stream Label:');
- $stream_format->setMultiOptions(array("Artist - Title",
- "Show - Artist - Title",
- "Station name - Show name"));
+ $stream_format->setLabel(_('Stream Label:'));
+ $stream_format->setMultiOptions(array(_("Artist - Title"),
+ _("Show - Artist - Title"),
+ _("Station name - Show name")));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
diff --git a/airtime_mvc/application/forms/StreamSettingSubForm.php b/airtime_mvc/application/forms/StreamSettingSubForm.php
index 6a243d12f..c5d8a19b2 100644
--- a/airtime_mvc/application/forms/StreamSettingSubForm.php
+++ b/airtime_mvc/application/forms/StreamSettingSubForm.php
@@ -45,7 +45,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$disable_all = Application_Model_Preference::GetEnableStreamConf() == "false";
$enable = new Zend_Form_Element_Checkbox('enable');
- $enable->setLabel('Enabled:')
+ $enable->setLabel(_('Enabled:'))
->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0)
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@@ -54,7 +54,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($enable);
$type = new Zend_Form_Element_Select('type');
- $type->setLabel("Stream Type:")
+ $type->setLabel(_("Stream Type:"))
->setMultiOptions($stream_types)
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
->setDecorators(array('ViewHelper'));
@@ -64,7 +64,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($type);
$bitrate = new Zend_Form_Element_Select('bitrate');
- $bitrate->setLabel("Bit Rate:")
+ $bitrate->setLabel(_("Bit Rate:"))
->setMultiOptions($stream_bitrates)
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
->setDecorators(array('ViewHelper'));
@@ -74,7 +74,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($bitrate);
$output = new Zend_Form_Element_Select('output');
- $output->setLabel("Service Type:")
+ $output->setLabel(_("Service Type:"))
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"SHOUTcast"))
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
->setDecorators(array('ViewHelper'));
@@ -84,8 +84,8 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($output);
$channels = new Zend_Form_Element_Select('channels');
- $channels->setLabel("Channels:")
- ->setMultiOptions(array("mono"=>"1 - Mono", "stereo"=>"2 - Stereo"))
+ $channels->setLabel(_("Channels:"))
+ ->setMultiOptions(array("mono"=>_("1 - Mono"), "stereo"=>_("2 - Stereo")))
->setValue(isset($setting[$prefix.'_channels']) ? $setting[$prefix.'_channels'] : "stereo")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@@ -94,10 +94,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($channels);
$host = new Zend_Form_Element_Text('host');
- $host->setLabel("Server")
+ $host->setLabel(_("Server"))
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
->setValidators(array(
- array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$host->setAttrib("disabled", "disabled");
@@ -106,10 +106,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($host);
$port = new Zend_Form_Element_Text('port');
- $port->setLabel("Port")
+ $port->setLabel(_("Port"))
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
->setValidators(array(new Zend_Validate_Between(array('min'=>0, 'max'=>99999))))
- ->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'));
if ($disable_all) {
$port->setAttrib("disabled", "disabled");
@@ -117,10 +117,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($port);
$pass = new Zend_Form_Element_Text('pass');
- $pass->setLabel("Password")
+ $pass->setLabel(_("Password"))
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
->setValidators(array(
- array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$pass->setAttrib("disabled", "disabled");
@@ -129,7 +129,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($pass);
$genre = new Zend_Form_Element_Text('genre');
- $genre->setLabel("Genre")
+ $genre->setLabel(_("Genre"))
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@@ -138,10 +138,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($genre);
$url = new Zend_Form_Element_Text('url');
- $url->setLabel("URL")
+ $url->setLabel(_("URL"))
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
->setValidators(array(
- array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$url->setAttrib("disabled", "disabled");
@@ -150,7 +150,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($url);
$name = new Zend_Form_Element_Text('name');
- $name->setLabel("Name")
+ $name->setLabel(_("Name"))
->setValue(isset($setting[$prefix.'_name'])?$setting[$prefix.'_name']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@@ -159,7 +159,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($name);
$description = new Zend_Form_Element_Text('description');
- $description->setLabel("Description")
+ $description->setLabel(_("Description"))
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@@ -168,10 +168,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($description);
$mount = new Zend_Form_Element_Text('mount');
- $mount->setLabel("Mount Point")
+ $mount->setLabel(_("Mount Point"))
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
->setValidators(array(
- array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$mount->setAttrib("disabled", "disabled");
@@ -180,10 +180,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($mount);
$user = new Zend_Form_Element_Text('user');
- $user->setLabel("Username")
+ $user->setLabel(_("Username"))
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
->setValidators(array(
- array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
+ array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$user->setAttrib("disabled", "disabled");
@@ -191,7 +191,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$user->setAttrib('alt', 'regular_text');
$this->addElement($user);
- $liquidsopa_error_msg = 'Getting information from the server...
';
+ $liquidsopa_error_msg = ''._('Getting information from the server...').'
';
$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))
@@ -205,18 +205,18 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
if ($f_data['enable'] == 1) {
if ($f_data['host'] == '') {
$element = $this->getElement("host");
- $element->addError("Server cannot be empty.");
+ $element->addError(_("Server cannot be empty."));
$isValid = false;
}
if ($f_data['port'] == '') {
$element = $this->getElement("port");
- $element->addError("Port cannot be empty.");
+ $element->addError(_("Port cannot be empty."));
$isValid = false;
}
if ($f_data['output'] == 'icecast') {
if ($f_data['mount'] == '') {
$element = $this->getElement("mount");
- $element->addError("Mount cannot be empty with Icecast server.");
+ $element->addError(_("Mount cannot be empty with Icecast server."));
$isValid = false;
}
}
diff --git a/airtime_mvc/application/forms/SupportSettings.php b/airtime_mvc/application/forms/SupportSettings.php
index 99aae55ad..4662a08ae 100644
--- a/airtime_mvc/application/forms/SupportSettings.php
+++ b/airtime_mvc/application/forms/SupportSettings.php
@@ -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')),
@@ -17,10 +18,10 @@ class Application_Form_SupportSettings extends Zend_Form
//Station name
$this->addElement('text', 'stationName', array(
'class' => 'input_text',
- 'label' => 'Station Name',
+ 'label' => _('Station Name'),
'required' => true,
'filters' => array('StringTrim'),
- 'validator' => array('NotEmpty'),
+ 'validators' => array($notEmptyValidator),
'value' => Application_Model_Preference::GetStationName(),
'decorators' => array(
'ViewHelper'
@@ -30,7 +31,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Phone number
$this->addElement('text', 'Phone', array(
'class' => 'input_text',
- 'label' => 'Phone:',
+ 'label' => _('Phone:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetPhone(),
@@ -42,7 +43,7 @@ class Application_Form_SupportSettings extends Zend_Form
//Email
$this->addElement('text', 'Email', array(
'class' => 'input_text',
- 'label' => 'Email:',
+ 'label' => _('Email:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetEmail(),
@@ -53,7 +54,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Station Web Site
$this->addElement('text', 'StationWebSite', array(
- 'label' => 'Station Web Site:',
+ 'label' => _('Station Web Site:'),
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationWebSite(),
@@ -64,7 +65,7 @@ class Application_Form_SupportSettings extends Zend_Form
// county list dropdown
$this->addElement('select', 'Country', array(
- 'label' => 'Country:',
+ 'label' => _('Country:'),
'required' => false,
'value' => Application_Model_Preference::GetStationCountry(),
'multiOptions' => $country_list,
@@ -75,7 +76,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Station city
$this->addElement('text', 'City', array(
- 'label' => 'City:',
+ 'label' => _('City:'),
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationCity(),
@@ -87,7 +88,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Station Description
$description = new Zend_Form_Element_Textarea('Description');
$description->class = 'input_text_area';
- $description->setLabel('Station Description:')
+ $description->setLabel(_('Station Description:'))
->setRequired(false)
->setValue(Application_Model_Preference::GetStationDescription())
->setDecorators(array('ViewHelper'))
@@ -97,7 +98,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Station Logo
$upload = new Zend_Form_Element_File('Logo');
- $upload->setLabel('Station Logo:')
+ $upload->setLabel(_('Station Logo:'))
->setRequired(false)
->setDecorators(array('File'))
->addValidator('Count', false, 1)
@@ -108,7 +109,7 @@ class Application_Form_SupportSettings extends Zend_Form
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
- 'label' => 'Send support feedback',
+ 'label' => _('Send support feedback'),
'required' => false,
'value' => Application_Model_Preference::GetSupportFeedback(),
'decorators' => array(
@@ -118,7 +119,7 @@ class Application_Form_SupportSettings extends Zend_Form
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
- $checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
+ $checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org'))
->setRequired(false)
->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise());
@@ -143,7 +144,10 @@ class Application_Form_SupportSettings extends Zend_Form
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
- $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's privacy policy.")
+ $checkboxPrivacy->setLabel(
+ sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."),
+ "",
+ ""))
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
@@ -151,7 +155,7 @@ class Application_Form_SupportSettings extends Zend_Form
$submit = new Zend_Form_Element_Submit("submit");
$submit->class = 'ui-button ui-state-default right-floated';
$submit->setIgnore(true)
- ->setLabel("Save")
+ ->setLabel(_("Save"))
->setDecorators(array('ViewHelper'));
$this->addElement($submit);
}
@@ -166,7 +170,7 @@ class Application_Form_SupportSettings extends Zend_Form
if (isset($data["Privacy"])) {
$checkPrivacy = $this->getElement('Privacy');
if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {
- $checkPrivacy->addError("You have to agree to privacy policy.");
+ $checkPrivacy->addError(_("You have to agree to privacy policy."));
$isValid = false;
}
}
diff --git a/airtime_mvc/application/forms/WatchedDirPreferences.php b/airtime_mvc/application/forms/WatchedDirPreferences.php
index 7fcf00893..7c4fca1c8 100644
--- a/airtime_mvc/application/forms/WatchedDirPreferences.php
+++ b/airtime_mvc/application/forms/WatchedDirPreferences.php
@@ -11,7 +11,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
$this->addElement('text', 'storageFolder', array(
'class' => 'input_text',
- 'label' => 'Import Folder:',
+ 'label' => _('Import Folder:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => '',
@@ -22,7 +22,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
$this->addElement('text', 'watchedFolder', array(
'class' => 'input_text',
- 'label' => 'Watched Folders:',
+ 'label' => _('Watched Folders:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => '',
@@ -37,7 +37,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
$element = $this->getElement($p_form_element_id);
if (!is_dir($element->getValue())) {
- $element->setErrors(array('Not a valid Directory'));
+ $element->setErrors(array(_('Not a valid Directory')));
return false;
} else {
diff --git a/airtime_mvc/application/forms/customvalidators/ConditionalNotEmpty.php b/airtime_mvc/application/forms/customvalidators/ConditionalNotEmpty.php
index bd3ae5723..d0d1992fc 100644
--- a/airtime_mvc/application/forms/customvalidators/ConditionalNotEmpty.php
+++ b/airtime_mvc/application/forms/customvalidators/ConditionalNotEmpty.php
@@ -7,9 +7,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract
{
const KEY_IS_EMPTY = 'keyIsEmpty';
- protected $_messageTemplates = array(
- self::KEY_IS_EMPTY => 'Value is required and can\'t be empty'
- );
+ protected $_messageTemplates;
protected $_fieldValues;
@@ -24,6 +22,9 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract
public function __construct($fieldValues)
{
$this->_fieldValues = $fieldValues;
+ $this->_messageTemplates = array(
+ self::KEY_IS_EMPTY => _("Value is required and can't be empty")
+ );
}
/**
diff --git a/airtime_mvc/application/forms/helpers/ValidationTypes.php b/airtime_mvc/application/forms/helpers/ValidationTypes.php
new file mode 100644
index 000000000..6211a14b5
--- /dev/null
+++ b/airtime_mvc/application/forms/helpers/ValidationTypes.php
@@ -0,0 +1,83 @@
+setMessage(
+ _("Value is required and can't be empty"),
+ Zend_Validate_NotEmpty::IS_EMPTY
+ );
+
+ return $validator;
+ }
+
+ public static function overrideEmailAddressValidator()
+ {
+ $validator = new Zend_Validate_EmailAddress();
+ $validator->setMessage(
+ _("'%value%' is no valid email address in the basic format local-part@hostname"),
+ Zend_Validate_EmailAddress::INVALID_FORMAT
+ );
+
+ return $validator;
+ }
+
+ public static function overrrideDateValidator($p_format)
+ {
+ $validator = new Zend_Validate_Date();
+
+ $validator->setFormat($p_format);
+
+ $validator->setMessage(
+ _("'%value%' does not fit the date format '%format%'"),
+ Zend_Validate_Date::FALSEFORMAT
+ );
+
+ return $validator;
+ }
+
+ public static function overrideRegexValidator($p_pattern, $p_msg)
+ {
+ $validator = new Zend_Validate_Regex($p_pattern);
+
+ $validator->setMessage(
+ $p_msg,
+ Zend_Validate_Regex::NOT_MATCH
+ );
+
+ return $validator;
+ }
+
+ public static function overrideStringLengthValidator($p_min, $p_max)
+ {
+ $validator = new Zend_Validate_StringLength();
+ $validator->setMin($p_min);
+ $validator->setMax($p_max);
+
+ $validator->setMessage(
+ _("'%value%' is less than %min% characters long"),
+ Zend_Validate_StringLength::TOO_SHORT
+ );
+
+ $validator->setMessage(
+ _("'%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;
+ }
+
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/layouts/scripts/audio-player.phtml b/airtime_mvc/application/layouts/scripts/audio-player.phtml
index 85f5a7166..cb7f97740 100644
--- a/airtime_mvc/application/layouts/scripts/audio-player.phtml
+++ b/airtime_mvc/application/layouts/scripts/audio-player.phtml
@@ -2,7 +2,7 @@
- Audio Player
+
headScript() ?>
headLink() ?>
google_analytics)?$this->google_analytics:"" ?>
diff --git a/airtime_mvc/application/layouts/scripts/bare.phtml b/airtime_mvc/application/layouts/scripts/bare.phtml
index b89443505..0f4a1b4ee 100644
--- a/airtime_mvc/application/layouts/scripts/bare.phtml
+++ b/airtime_mvc/application/layouts/scripts/bare.phtml
@@ -2,7 +2,7 @@
- Live stream
+
headScript() ?>
headLink() ?>
google_analytics)?$this->google_analytics:"" ?>
diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml
index b25b8c9cf..80951b748 100644
--- a/airtime_mvc/application/layouts/scripts/layout.phtml
+++ b/airtime_mvc/application/layouts/scripts/layout.phtml
@@ -23,7 +23,7 @@
$this->navigation()->menu()->setPartial($partial); ?>
- - loggedInAs()?> | >Logout
+ - loggedInAs()?> | >
diff --git a/airtime_mvc/application/layouts/scripts/login.phtml b/airtime_mvc/application/layouts/scripts/login.phtml
index 42389f11a..966226700 100644
--- a/airtime_mvc/application/layouts/scripts/login.phtml
+++ b/airtime_mvc/application/layouts/scripts/login.phtml
@@ -13,8 +13,9 @@
layout()->content ?>
diff --git a/airtime_mvc/application/models/Auth.php b/airtime_mvc/application/models/Auth.php
index 2aef1ce81..104ee8050 100644
--- a/airtime_mvc/application/models/Auth.php
+++ b/airtime_mvc/application/models/Auth.php
@@ -30,10 +30,10 @@ class Application_Model_Auth
$e_link_port = $_SERVER['SERVER_PORT'];
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
- $message = "Hi {$user->getDbLogin()}, \n\nClick this link to reset your password: ";
+ $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}";
- $success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
+ $success = Application_Model_Email::send(_('Airtime Password Reset'), $message, $user->getDbEmail());
return $success;
}
diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php
index 9341cf881..46e857e49 100644
--- a/airtime_mvc/application/models/Block.php
+++ b/airtime_mvc/application/models/Block.php
@@ -756,7 +756,7 @@ SQL;
try {
if (is_null($cueIn) && is_null($cueOut)) {
- $errArray["error"] = "Cue in and cue out are null.";
+ $errArray["error"] = _("Cue in and cue out are null.");
return $errArray;
}
@@ -791,7 +791,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
- $errArray["error"] = "Can't set cue out to be greater than file length.";
+ $errArray["error"] = _("Can't set cue out to be greater than file length.");
return $errArray;
}
@@ -802,7 +802,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
- $errArray["error"] = "Can't set cue in to be larger than cue out.";
+ $errArray["error"] = _("Can't set cue in to be larger than cue out.");
return $errArray;
}
@@ -823,7 +823,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
- $errArray["error"] = "Can't set cue in to be larger than cue out.";
+ $errArray["error"] = _("Can't set cue in to be larger than cue out.");
return $errArray;
}
@@ -847,7 +847,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
- $errArray["error"] = "Can't set cue out to be greater than file length.";
+ $errArray["error"] = _("Can't set cue out to be greater than file length.");
return $errArray;
}
@@ -858,7 +858,7 @@ SQL;
);
$result = Application_Common_Database::prepareAndExecute($sql, $params, 'column');
if ($result) {
- $errArray["error"] = "Can't set cue out to be smaller than cue in.";
+ $errArray["error"] = _("Can't set cue out to be smaller than cue in.");
return $errArray;
}
@@ -1206,32 +1206,32 @@ SQL;
public function getCriteria()
{
$criteriaOptions = array(
- 0 => "Select criteria",
- "album_title" => "Album",
- "bit_rate" => "Bit Rate (Kbps)",
- "bpm" => "BPM",
- "composer" => "Composer",
- "conductor" => "Conductor",
- "copyright" => "Copyright",
- "artist_name" => "Creator",
- "encoded_by" => "Encoded By",
- "genre" => "Genre",
- "isrc_number" => "ISRC",
- "label" => "Label",
- "language" => "Language",
- "mtime" => "Last Modified",
- "lptime" => "Last Played",
- "length" => "Length",
- "mime" => "Mime",
- "mood" => "Mood",
- "owner_id" => "Owner",
- "replay_gain" => "Replay Gain",
- "sample_rate" => "Sample Rate (kHz)",
- "track_title" => "Title",
- "track_number" => "Track Number",
- "utime" => "Uploaded",
- "info_url" => "Website",
- "year" => "Year"
+ 0 => _("Select criteria"),
+ "album_title" => _("Album"),
+ "bit_rate" => _("Bit Rate (Kbps)"),
+ "bpm" => _("BPM"),
+ "composer" => _("Composer"),
+ "conductor" => _("Conductor"),
+ "copyright" => _("Copyright"),
+ "artist_name" => _("Creator"),
+ "encoded_by" => _("Encoded By"),
+ "genre" => _("Genre"),
+ "isrc_number" => _("ISRC"),
+ "label" => _("Label"),
+ "language" => _("Language"),
+ "mtime" => _("Last Modified"),
+ "lptime" => _("Last Played"),
+ "length" => _("Length"),
+ "mime" => _("Mime"),
+ "mood" => _("Mood"),
+ "owner_id" => _("Owner"),
+ "replay_gain" => _("Replay Gain"),
+ "sample_rate" => _("Sample Rate (kHz)"),
+ "track_title" => _("Title"),
+ "track_number" => _("Track Number"),
+ "utime" => _("Uploaded"),
+ "info_url" => _("Website"),
+ "year" => _("Year")
);
// Load criteria from db
diff --git a/airtime_mvc/application/models/Locale.php b/airtime_mvc/application/models/Locale.php
new file mode 100644
index 000000000..e1568e3fe
--- /dev/null
+++ b/airtime_mvc/application/models/Locale.php
@@ -0,0 +1,17 @@
+query($sql)->fetchAll();
+ $out = array();
+ foreach ($res as $r) {
+ $out[$r["locale_code"]] = $r["locale_lang"];
+ }
+
+ return $out;
+ }
+}
diff --git a/airtime_mvc/application/models/MusicDir.php b/airtime_mvc/application/models/MusicDir.php
index 3607efd4d..117d06f40 100644
--- a/airtime_mvc/application/models/MusicDir.php
+++ b/airtime_mvc/application/models/MusicDir.php
@@ -157,15 +157,15 @@ SQL;
$diff = strlen($dir) - strlen($p_path);
if ($diff == 0) {
if ($dir == $p_path) {
- throw new NestedDirectoryException("'$p_path' is already watched.");
+ throw new NestedDirectoryException(sprintf(_("%s is already watched."), $p_path));
}
} elseif ($diff > 0) {
if (self::isAncestorDir($p_path, $dir)) {
- throw new NestedDirectoryException("'$p_path' contains nested watched directory: '$dir'");
+ throw new NestedDirectoryException(sprintf(_("%s contains nested watched directory: %s"), $p_path, $dir));
}
} else { /* diff < 0*/
if (self::isAncestorDir($dir, $p_path)) {
- throw new NestedDirectoryException("'$p_path' is nested within existing watched directory: '$dir'");
+ throw new NestedDirectoryException(sprintf(_("%s is nested within existing watched directory: %s"), $p_path, $dir));
}
}
}
@@ -186,7 +186,7 @@ SQL;
public static function addDir($p_path, $p_type, $userAddedWatchedDir=true, $nestedWatch=false)
{
if (!is_dir($p_path)) {
- return array("code"=>2, "error"=>"'$p_path' is not a valid directory.");
+ return array("code"=>2, "error"=>sprintf(_("%s is not a valid directory."), $p_path));
}
$real_path = Application_Common_OsPath::normpath($p_path)."/";
if ($real_path != "/") {
@@ -227,7 +227,8 @@ SQL;
return array("code"=>1, "error"=>"$msg");
} catch (Exception $e) {
- return array("code"=>1, "error"=>"'$p_path' is already set as the current storage dir or in the watched folders list");
+ return array("code"=>1,
+ "error"=>sprintf(_("%s is already set as the current storage dir or in the watched folders list"), $p_path));
}
}
@@ -359,7 +360,7 @@ SQL;
// path should always ends with trailing '/'
$p_dir = Application_Common_OsPath::normpath($p_dir)."/";
if (!is_dir($p_dir)) {
- return array("code"=>2, "error"=>"'$p_dir' is not a valid directory.");
+ return array("code"=>2, "error"=>sprintf(_("%s is not a valid directory."), $p_dir));
} elseif (Application_Model_Preference::GetImportTimestamp()+10 > time()) {
return array("code"=>3, "error"=>"Airtime is currently importing files. Please wait until this is complete before changing the storage directory.");
}
@@ -376,7 +377,8 @@ SQL;
return array("code"=>0);
} else {
- return array("code"=>1, "error"=>"'$p_dir' is already set as the current storage dir or in the watched folders list.");
+ return array("code"=>1,
+ "error"=>sprintf(_("%s is already set as the current storage dir or in the watched folders list."), $p_dir));
}
}
@@ -419,7 +421,7 @@ SQL;
}
$dir = Application_Model_MusicDir::getDirByPath($p_dir);
if (is_null($dir)) {
- return array("code"=>1, "error"=>"'$p_dir' doesn't exist in the watched list.");
+ return array("code"=>1, "error"=>sprintf(_("%s doesn't exist in the watched list."), $p_dir));
} else {
$dir->remove($userAddedWatchedDir);
$data = array();
diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php
index 4e9562c72..fc1099837 100644
--- a/airtime_mvc/application/models/Playlist.php
+++ b/airtime_mvc/application/models/Playlist.php
@@ -721,7 +721,7 @@ SQL;
try {
if (is_null($cueIn) && is_null($cueOut)) {
- $errArray["error"] = "Cue in and cue out are null.";
+ $errArray["error"] = _("Cue in and cue out are null.");
return $errArray;
}
@@ -751,14 +751,14 @@ SQL;
$sql = "SELECT :cueIn::INTERVAL > :cueOut::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':cueOut'=>$cueOut), 'column')) {
- $errArray["error"] = "Can't set cue in to be larger than cue out.";
+ $errArray["error"] = _("Can't set cue in to be larger than cue out.");
return $errArray;
}
$sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) {
- $errArray["error"] = "Can't set cue out to be greater than file length.";
+ $errArray["error"] = _("Can't set cue out to be greater than file length.");
return $errArray;
}
@@ -774,7 +774,7 @@ SQL;
$sql = "SELECT :cueIn::INTERVAL > :oldCueOut::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut), 'column')) {
- $errArray["error"] = "Can't set cue in to be larger than cue out.";
+ $errArray["error"] = _("Can't set cue in to be larger than cue out.");
return $errArray;
}
@@ -792,14 +792,14 @@ SQL;
$sql = "SELECT :cueOut::INTERVAL < :oldCueIn::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn), 'column')) {
- $errArray["error"] = "Can't set cue out to be smaller than cue in.";
+ $errArray["error"] = _("Can't set cue out to be smaller than cue in.");
return $errArray;
}
$sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) {
- $errArray["error"] = "Can't set cue out to be greater than file length.";
+ $errArray["error"] = _("Can't set cue out to be greater than file length.");
return $errArray;
}
diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php
index cd9bd9bd8..916bc1deb 100644
--- a/airtime_mvc/application/models/Preference.php
+++ b/airtime_mvc/application/models/Preference.php
@@ -428,6 +428,16 @@ class Application_Model_Preference
{
return self::getValue("timezone");
}
+
+ public static function SetLocale($locale)
+ {
+ self::setValue("locale", $locale);
+ }
+
+ public static function GetLocale()
+ {
+ return self::getValue("locale");
+ }
public static function SetStationLogo($imagePath)
{
@@ -456,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"];
}
diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php
index b36fc2223..fb5c2ebc4 100644
--- a/airtime_mvc/application/models/Scheduler.php
+++ b/airtime_mvc/application/models/Scheduler.php
@@ -79,12 +79,12 @@ class Application_Model_Scheduler
//an item has been deleted
if (count($schedIds) !== count($schedItems)) {
- throw new OutDatedScheduleException("The schedule you're viewing is out of date! (sched mismatch)");
+ throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (sched mismatch)"));
}
//a show has been deleted
if (count($instanceIds) !== count($showInstances)) {
- throw new OutDatedScheduleException("The schedule you're viewing is out of date! (instance mismatch)");
+ throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (instance mismatch)"));
}
foreach ($schedItems as $schedItem) {
@@ -92,7 +92,7 @@ class Application_Model_Scheduler
$instance = $schedItem->getCcShowInstances($this->con);
if (intval($schedInfo[$id]) !== $instance->getDbId()) {
- throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
+ throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
}
}
@@ -102,24 +102,24 @@ class Application_Model_Scheduler
$show = $instance->getCcShow($this->con);
if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) {
- throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
+ throw new Exception(sprintf(_("You are not allowed to schedule show %s."), $show->getDbName()));
}
if ($instance->getDbRecord()) {
- throw new Exception("You cannot add files to recording shows.");
+ throw new Exception(_("You cannot add files to recording shows."));
}
$showEndEpoch = floatval($instance->getDbEnds("U.u"));
if ($showEndEpoch < $nowEpoch) {
- throw new OutDatedScheduleException("The show {$show->getDbName()} is over and cannot be scheduled.");
+ throw new OutDatedScheduleException(sprintf(_("The show %s is over and cannot be scheduled."), $show->getDbName()));
}
$ts = intval($instanceInfo[$id]);
$lastSchedTs = intval($instance->getDbLastScheduled("U")) ? : 0;
if ($ts < $lastSchedTs) {
Logging::info("ts {$ts} last sched {$lastSchedTs}");
- throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
+ throw new OutDatedScheduleException(sprintf(_("The show %s has been previously updated!"), $show->getDbName()));
}
}
}
@@ -138,7 +138,7 @@ class Application_Model_Scheduler
$file = CcFilesQuery::create()->findPK($id, $this->con);
if (is_null($file) || !$file->visible()) {
- throw new Exception("A selected File does not exist!");
+ throw new Exception(_("A selected File does not exist!"));
} else {
$data = $this->fileInfo;
$data["id"] = $id;
@@ -219,7 +219,7 @@ class Application_Model_Scheduler
$stream = CcWebstreamQuery::create()->findPK($id, $this->con);
if (is_null($stream) /* || !$file->visible() */) {
- throw new Exception("A selected File does not exist!");
+ throw new Exception(_("A selected File does not exist!"));
} else {
$data = $this->fileInfo;
$data["id"] = $id;
@@ -343,7 +343,7 @@ class Application_Model_Scheduler
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
if (is_null($instance)) {
- throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
+ throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
}
$itemStartDT = $instance->getDbStarts(null);
diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php
index 6f088046d..7f55e8c2a 100644
--- a/airtime_mvc/application/models/Show.php
+++ b/airtime_mvc/application/models/Show.php
@@ -177,7 +177,7 @@ SQL;
$con = Propel::getConnection();
if ($deltaDay > 0) {
- return "Shows can have a max length of 24 hours.";
+ return _("Shows can have a max length of 24 hours.");
}
$utc = new DateTimeZone("UTC");
@@ -208,7 +208,7 @@ SQL;
$newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin);
if ($newEndsDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
- return "End date/time cannot be in the past";
+ return _("End date/time cannot be in the past");
}
//convert our new starts/ends to UTC.
@@ -219,8 +219,8 @@ SQL;
$newStartsDateTime, $newEndsDateTime, true, $si->getDbId());
if ($overlapping) {
- return "Cannot schedule overlapping shows.\nNote: Resizing a repeating show ".
- "affects all of its repeats.";
+ return _("Cannot schedule overlapping shows.\nNote: Resizing a repeating show ".
+ "affects all of its repeats.");
}
}
diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php
index 175e61dfd..a04bb4c8a 100644
--- a/airtime_mvc/application/models/ShowBuilder.php
+++ b/airtime_mvc/application/models/ShowBuilder.php
@@ -195,7 +195,7 @@ class Application_Model_ShowBuilder
$dt->setTimezone(new DateTimeZone($this->timezone));
$time = $dt->format("Y-m-d H:i");
- $row["rebroadcast_title"] = "Rebroadcast of {$name} from {$time}";
+ $row["rebroadcast_title"] = sprintf(_("Rebroadcast of %s from %s"), $name, $time);
} elseif (intval($p_item["si_record"]) === 1) {
$row["record"] = true;
diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php
index e1cdbe5b6..9a5e8a7d4 100644
--- a/airtime_mvc/application/models/ShowInstance.php
+++ b/airtime_mvc/application/models/ShowInstance.php
@@ -242,7 +242,7 @@ SQL;
public function moveShow($deltaDay, $deltaMin)
{
if ($this->getShow()->isRepeating()) {
- return "Can't drag and drop repeating shows";
+ return _("Can't drag and drop repeating shows");
}
$today_timestamp = time();
@@ -250,7 +250,7 @@ SQL;
$endsDateTime = new DateTime($this->getShowInstanceEnd(), new DateTimeZone("UTC"));
if ($today_timestamp > $startsDateTime->getTimestamp()) {
- return "Can't move a past show";
+ return _("Can't move a past show");
}
//the user is moving the show on the calendar from the perspective of local time.
@@ -267,13 +267,13 @@ SQL;
$newEndsDateTime->setTimezone(new DateTimeZone("UTC"));
if ($today_timestamp > $newStartsDateTime->getTimestamp()) {
- return "Can't move show into past";
+ return _("Can't move show into past");
}
//check if show is overlapping
$overlapping = Application_Model_Schedule::checkOverlappingShows($newStartsDateTime, $newEndsDateTime, true, $this->getShowInstanceId());
if ($overlapping) {
- return "Cannot schedule overlapping shows";
+ return _("Cannot schedule overlapping shows");
}
if ($this->isRecorded()) {
@@ -287,7 +287,7 @@ SQL;
->find();
if (count($rebroadcasts) > 0) {
- return "Can't move a recorded show less than 1 hour before its rebroadcasts.";
+ return _("Can't move a recorded show less than 1 hour before its rebroadcasts.");
}
}
@@ -300,14 +300,14 @@ SQL;
catch (Exception $e) {
$this->_showInstance->delete();
- return "Show was deleted because recorded show does not exist!";
+ return _("Show was deleted because recorded show does not exist!");
}
$recordEndDateTime = new DateTime($recordedShow->getShowInstanceEnd(), new DateTimeZone("UTC"));
$newRecordEndDateTime = self::addDeltas($recordEndDateTime, 0, 60);
if ($newStartsDateTime->getTimestamp() < $newRecordEndDateTime->getTimestamp()) {
- return "Must wait 1 hour to rebroadcast.";
+ return _("Must wait 1 hour to rebroadcast.");
}
}
@@ -339,7 +339,7 @@ SQL;
$ends = $this->getShowInstanceEnd();
if (strtotime($today_timestamp) > strtotime($starts)) {
- return "can't resize a past show";
+ return _("can't resize a past show");
}
//$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
@@ -361,7 +361,7 @@ SQL;
if (count($overlap) > 0) {
// TODO : fix ghetto error handling -- RG
- return "Should not overlap shows";
+ return _("Should not overlap shows");
}
}
//with overbooking no longer need to check already scheduled content still fits.
diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php
index 074896269..4b13cfe9f 100644
--- a/airtime_mvc/application/models/StoredFile.php
+++ b/airtime_mvc/application/models/StoredFile.php
@@ -794,14 +794,14 @@ SQL;
// ugly
if ($type == "au") {
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
- $row['image'] = '
';
+ $row['image'] = '
';
} elseif ($type == "pl") {
- $row['image'] = '
';
+ $row['image'] = '
';
} elseif ($type == "st") {
$row['audioFile'] = $row['id'];
- $row['image'] = '
';
+ $row['image'] = '
';
} elseif ($type == "bl") {
- $row['image'] = '
';
+ $row['image'] = '
';
}
}
@@ -853,7 +853,7 @@ SQL;
closedir($dir);
} else
- die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
+ die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": _("Failed to open temp directory.")}, "id" : "id"}');
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
@@ -880,14 +880,14 @@ SQL;
while ($buff = fread($in, 4096))
fwrite($out, $buff);
} else
- die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
+ die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}');
fclose($out);
unlink($_FILES['file']['tmp_name']);
} else
- die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
+ die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": _("Failed to open output stream.")}, "id" : "id"}');
} else
- die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
+ die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": _("Failed to move uploaded file.")}, "id" : "id"}');
} else {
// Open temp file
$out = fopen($tempFilePath, $chunk == 0 ? "wb" : "ab");
@@ -899,11 +899,11 @@ SQL;
while ($buff = fread($in, 4096))
fwrite($out, $buff);
} else
- die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
+ die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}');
fclose($out);
} else
- die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
+ die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": _("Failed to open output stream.")}, "id" : "id"}');
}
return $tempFilePath;
@@ -934,7 +934,7 @@ SQL;
if (!mkdir($stor."/organize", 0777)) {
return array(
"code" => 109,
- "message" => "Failed to create 'organize' directory.");
+ "message" => _("Failed to create 'organize' directory."));
}
}
@@ -947,17 +947,17 @@ SQL;
$freeSpace = disk_free_space($stor);
return array("code" => 107,
- "message" => "The file was not uploaded, there is
- ".$freeSpace."MB of disk space left and the file you are
- uploading has a size of ".$fileSize."MB.");
+ "message" => sprintf(_("The file was not uploaded, there is "
+ ."%s MB of disk space left and the file you are "
+ ."uploading has a size of %s MB."), $freeSpace, $fileSize));
}
// Check if liquidsoap can play this file
if (!self::liquidsoapFilePlayabilityTest($audio_file)) {
return array(
"code" => 110,
- "message" => "This file appears to be corrupted and will not
- be added to media library.");
+ "message" => _("This file appears to be corrupted and will not "
+ ."be added to media library."));
}
// Did all the checks for real, now trying to copy
@@ -992,10 +992,9 @@ SQL;
return array(
"code" => 108,
- "message" => "
- The file was not uploaded, this error can occur if the computer
- hard drive does not have enough disk space or the stor
- directory does not have correct write permissions.");
+ "message" => _("The file was not uploaded, this error can occur if the computer "
+ ."hard drive does not have enough disk space or the stor "
+ ."directory does not have correct write permissions."));
}
// Now that we successfully added this file, we will add another tag
// file that will identify the user that owns it
diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php
index ad6ca7f76..18545af18 100644
--- a/airtime_mvc/application/models/Webstream.php
+++ b/airtime_mvc/application/models/Webstream.php
@@ -154,12 +154,12 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
if ($totalMinutes == 0) {
$valid['length'][0] = false;
- $valid['length'][1] = 'Length needs to be greater than 0 minutes';
+ $valid['length'][1] = _('Length needs to be greater than 0 minutes');
}
} else {
$valid['length'][0] = false;
- $valid['length'][1] = 'Length should be of form "00h 00m"';
+ $valid['length'][1] = _('Length should be of form "00h 00m"');
}
$url = $parameters["url"];
@@ -172,16 +172,16 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$mediaUrl = null;
if ($result == 0) {
$valid['url'][0] = false;
- $valid['url'][1] = 'URL should be of form "http://domain"';
+ $valid['url'][1] = _('URL should be of form "http://domain"');
} elseif (strlen($url) > 512) {
$valid['url'][0] = false;
- $valid['url'][1] = 'URL should be 512 characters or less';
+ $valid['url'][1] = _('URL should be 512 characters or less');
} else {
try {
list($mime, $content_length_found) = self::discoverStreamMime($url);
if (is_null($mime)) {
- throw new Exception("No MIME type found for webstream.");
+ throw new Exception(_("No MIME type found for webstream."));
}
$mediaUrl = self::getMediaUrl($url, $mime, $content_length_found);
@@ -197,7 +197,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$name = $parameters["name"];
if (strlen($name) == 0) {
$valid['name'][0] = false;
- $valid['name'][1] = 'Webstream name cannot be empty';
+ $valid['name'][1] = _('Webstream name cannot be empty');
}
$id = $parameters["id"];
@@ -266,7 +266,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
}
}
- throw new Exception("Could not parse XSPF playlist");
+ throw new Exception(_("Could not parse XSPF playlist"));
}
private static function getPlsUrl($url)
@@ -278,7 +278,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
return $ini["playlist"]["File1"];
}
- throw new Exception("Could not parse PLS playlist");
+ throw new Exception(_("Could not parse PLS playlist"));
}
private static function getM3uUrl($url)
@@ -297,7 +297,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
return $lines[0];
}
- throw new Exception("Could not parse M3U playlist");
+ throw new Exception(_("Could not parse M3U playlist"));
}
private static function getMediaUrl($url, $mime, $content_length_found)
@@ -311,11 +311,11 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$media_url = self::getPlsUrl($url);
} elseif (preg_match("/(mpeg|ogg)/", $mime)) {
if ($content_length_found) {
- throw new Exception("Invalid webstream - This appears to be a file download.");
+ throw new Exception(_("Invalid webstream - This appears to be a file download."));
}
$media_url = $url;
} else {
- throw new Exception("Unrecognized stream type: $mime");
+ throw new Exception(sprintf(_("Unrecognized stream type: %s"), $mime));
}
return $media_url;
diff --git a/airtime_mvc/application/models/airtime/CcLocale.php b/airtime_mvc/application/models/airtime/CcLocale.php
new file mode 100644
index 000000000..6953ae6b3
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/CcLocale.php
@@ -0,0 +1,18 @@
+setName('cc_locale');
+ $this->setPhpName('CcLocale');
+ $this->setClassname('CcLocale');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_locale_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('LOCALE_CODE', 'DbLocaleCode', 'VARCHAR', true, 16, null);
+ $this->addColumn('LOCALE_LANG', 'DbLocaleLang', 'VARCHAR', true, 128, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
+
+} // CcLocaleTableMap
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocale.php b/airtime_mvc/application/models/airtime/om/BaseCcLocale.php
new file mode 100644
index 000000000..fdd4d43d8
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLocale.php
@@ -0,0 +1,764 @@
+id;
+ }
+
+ /**
+ * Get the [locale_code] column value.
+ *
+ * @return string
+ */
+ public function getDbLocaleCode()
+ {
+ return $this->locale_code;
+ }
+
+ /**
+ * Get the [locale_lang] column value.
+ *
+ * @return string
+ */
+ public function getDbLocaleLang()
+ {
+ return $this->locale_lang;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcLocale The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcLocalePeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [locale_code] column.
+ *
+ * @param string $v new value
+ * @return CcLocale The current object (for fluent API support)
+ */
+ public function setDbLocaleCode($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale_code !== $v) {
+ $this->locale_code = $v;
+ $this->modifiedColumns[] = CcLocalePeer::LOCALE_CODE;
+ }
+
+ return $this;
+ } // setDbLocaleCode()
+
+ /**
+ * Set the value of [locale_lang] column.
+ *
+ * @param string $v new value
+ * @return CcLocale The current object (for fluent API support)
+ */
+ public function setDbLocaleLang($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale_lang !== $v) {
+ $this->locale_lang = $v;
+ $this->modifiedColumns[] = CcLocalePeer::LOCALE_LANG;
+ }
+
+ return $this;
+ } // setDbLocaleLang()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale_code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->locale_lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 3; // 3 = CcLocalePeer::NUM_COLUMNS - CcLocalePeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcLocale object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcLocalePeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcLocaleQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcLocalePeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcLocalePeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcLocalePeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLocalePeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows = 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows = CcLocalePeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcLocalePeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcLocalePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbLocaleCode();
+ break;
+ case 2:
+ return $this->getDbLocaleLang();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
+ {
+ $keys = CcLocalePeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbLocaleCode(),
+ $keys[2] => $this->getDbLocaleLang(),
+ );
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcLocalePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbLocaleCode($value);
+ break;
+ case 2:
+ $this->setDbLocaleLang($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcLocalePeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbLocaleCode($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbLocaleLang($arr[$keys[2]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcLocalePeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcLocalePeer::ID)) $criteria->add(CcLocalePeer::ID, $this->id);
+ if ($this->isColumnModified(CcLocalePeer::LOCALE_CODE)) $criteria->add(CcLocalePeer::LOCALE_CODE, $this->locale_code);
+ if ($this->isColumnModified(CcLocalePeer::LOCALE_LANG)) $criteria->add(CcLocalePeer::LOCALE_LANG, $this->locale_lang);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcLocalePeer::DATABASE_NAME);
+ $criteria->add(CcLocalePeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcLocale (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbLocaleCode($this->locale_code);
+ $copyObj->setDbLocaleLang($this->locale_lang);
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcLocale Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcLocalePeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcLocalePeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale_code = null;
+ $this->locale_lang = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcLocale
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php
new file mode 100644
index 000000000..eebb6a002
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php
@@ -0,0 +1,744 @@
+ array ('DbId', 'DbLocaleCode', 'DbLocaleLang', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLocaleCode', 'dbLocaleLang', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::LOCALE_CODE, self::LOCALE_LANG, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE_CODE', 'LOCALE_LANG', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale_code', 'locale_lang', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLocaleCode' => 1, 'DbLocaleLang' => 2, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLocaleCode' => 1, 'dbLocaleLang' => 2, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOCALE_CODE => 1, self::LOCALE_LANG => 2, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE_CODE' => 1, 'LOCALE_LANG' => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale_code' => 1, 'locale_lang' => 2, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcLocalePeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcLocalePeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcLocalePeer::ID);
+ $criteria->addSelectColumn(CcLocalePeer::LOCALE_CODE);
+ $criteria->addSelectColumn(CcLocalePeer::LOCALE_LANG);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE_CODE');
+ $criteria->addSelectColumn($alias . '.LOCALE_LANG');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcLocalePeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcLocalePeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcLocale
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcLocalePeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcLocalePeer::populateObjects(CcLocalePeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcLocalePeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcLocale $value A CcLocale object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcLocale $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcLocale object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcLocale) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcLocale object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcLocale Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_locale
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcLocalePeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcLocalePeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcLocalePeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcLocalePeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcLocale object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcLocalePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcLocalePeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcLocalePeer::NUM_COLUMNS;
+ } else {
+ $cls = CcLocalePeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcLocalePeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcLocalePeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcLocalePeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcLocaleTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcLocalePeer::CLASS_DEFAULT : CcLocalePeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcLocale or Criteria object.
+ *
+ * @param mixed $values Criteria or CcLocale object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcLocale object
+ }
+
+ if ($criteria->containsKey(CcLocalePeer::ID) && $criteria->keyContainsValue(CcLocalePeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLocalePeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcLocale or Criteria object.
+ *
+ * @param mixed $values Criteria or CcLocale object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcLocalePeer::ID);
+ $value = $criteria->remove(CcLocalePeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcLocalePeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcLocalePeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcLocale object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_locale table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcLocalePeer::TABLE_NAME, $con, CcLocalePeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcLocalePeer::clearInstancePool();
+ CcLocalePeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcLocale or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcLocale object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcLocalePeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcLocale) { // it's a model object
+ // invalidate the cache for this single object
+ CcLocalePeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcLocalePeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcLocalePeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcLocalePeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcLocale object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcLocale $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcLocale $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcLocalePeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcLocalePeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcLocalePeer::DATABASE_NAME, CcLocalePeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcLocale
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcLocalePeer::DATABASE_NAME);
+ $criteria->add(CcLocalePeer::ID, $pk);
+
+ $v = CcLocalePeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcLocalePeer::DATABASE_NAME);
+ $criteria->add(CcLocalePeer::ID, $pks, Criteria::IN);
+ $objs = CcLocalePeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcLocalePeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcLocalePeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php
new file mode 100644
index 000000000..e12a5971b
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php
@@ -0,0 +1,217 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcLocale|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcLocalePeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcLocalePeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId The value to use as filter.
+ * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcLocalePeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale_code column
+ *
+ * @param string $dbLocaleCode The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByDbLocaleCode($dbLocaleCode = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLocaleCode)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLocaleCode)) {
+ $dbLocaleCode = str_replace('*', '%', $dbLocaleCode);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcLocalePeer::LOCALE_CODE, $dbLocaleCode, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale_lang column
+ *
+ * @param string $dbLocaleLang The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByDbLocaleLang($dbLocaleLang = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLocaleLang)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLocaleLang)) {
+ $dbLocaleLang = str_replace('*', '%', $dbLocaleLang);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcLocalePeer::LOCALE_LANG, $dbLocaleLang, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcLocale $ccLocale Object to remove from the list of results
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function prune($ccLocale = null)
+ {
+ if ($ccLocale) {
+ $this->addUsingAlias(CcLocalePeer::ID, $ccLocale->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcLocaleQuery
diff --git a/airtime_mvc/application/views/scripts/airtime-recorder/index.phtml b/airtime_mvc/application/views/scripts/airtime-recorder/index.phtml
index 0a04fb79c..e69de29bb 100644
--- a/airtime_mvc/application/views/scripts/airtime-recorder/index.phtml
+++ b/airtime_mvc/application/views/scripts/airtime-recorder/index.phtml
@@ -1 +0,0 @@
-
View script for controller AirtimeRecorder and script/action name index
\ No newline at end of file
diff --git a/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml b/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml
index f76249b9f..e8196913f 100644
--- a/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml
+++ b/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml
@@ -19,19 +19,19 @@
-
- previous
+ echo _("previous") ?>
-
- play
+ echo _("play") ?>
-
- pause
+ echo _("pause") ?>
-
- next
+ echo _("next") ?>
-
- stop
+ echo _("stop") ?>
@@ -42,21 +42,21 @@
-type == "audioclip"): ?>
+type == "audioclip"): ?>
- mute
+ echo _("mute") ?>
- unmute
+ echo _("unmute") ?>
- max volume
+ echo _("max volume") ?>
@@ -66,8 +66,10 @@
-
Update Required
- To play the media you will need to either update your browser to a recent version or update your
Flash plugin.
+
echo _("Update Required") ?>
+ sprintf(_("To play the media you will need to either update your browser to a recent version or update your %sFlash plugin%s."),
+ "
",
+ "") ?>
diff --git a/airtime_mvc/application/views/scripts/dashboard/about.phtml b/airtime_mvc/application/views/scripts/dashboard/about.phtml
index b2ce0cb38..a844ec398 100644
--- a/airtime_mvc/application/views/scripts/dashboard/about.phtml
+++ b/airtime_mvc/application/views/scripts/dashboard/about.phtml
@@ -1,8 +1,21 @@
-
About
+
echo _("About") ?>
-Airtime airtime_version ?>, the open radio software for scheduling and remote station management.
-© 2012 Sourcefabric o.p.s. Airtime is distributed under the GNU GPL v.3
+",
+ "",
+ $this->airtime_version,
+ "
")
+?>
+
© 2012
+",
+ "",
+ "",
+ "")
+?>
diff --git a/airtime_mvc/application/views/scripts/dashboard/help.phtml b/airtime_mvc/application/views/scripts/dashboard/help.phtml
index 3e5d68553..66857c7cd 100644
--- a/airtime_mvc/application/views/scripts/dashboard/help.phtml
+++ b/airtime_mvc/application/views/scripts/dashboard/help.phtml
@@ -1,15 +1,17 @@
-
Welcome to Airtime!
-
Here's how you can get started using Airtime to automate your broadcasts:
+
+
- - 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.
- - Create a show by going to "Calendar" in the menu bar, and then clicking the "+ Show" icon. This can be either a one-time or repeating show. Only admins and program managers can add shows.
- - Add media to the show by going to your show in the Schedule calendar, left-clicking on it and selecting "Add / Remove Content".
- - Select your media from the left pane and drag them to your show in the right pane.
+
+
+ - .
+
-
Then you're good to go!
-For more detailed help, read the user manual.
+
+",
+ "") ?>
diff --git a/airtime_mvc/application/views/scripts/dashboard/index.phtml b/airtime_mvc/application/views/scripts/dashboard/index.phtml
index e5b885fc7..e69de29bb 100644
--- a/airtime_mvc/application/views/scripts/dashboard/index.phtml
+++ b/airtime_mvc/application/views/scripts/dashboard/index.phtml
@@ -1 +0,0 @@
-
View script for controller Dashboard and script/action name index
\ No newline at end of file
diff --git a/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml b/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml
index ce4faa068..3f6a46dec 100644
--- a/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml
+++ b/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml
@@ -1,5 +1,5 @@
-
Live stream
+
echo _("Live stream") ?>
-
Select stream:
+
echo _("Select stream:"); ?>