CC-1960: Internationalize Airtime / Support translations
-added language option in preferences
This commit is contained in:
parent
c344282e4d
commit
25ddd083bc
5 changed files with 45 additions and 1 deletions
|
@ -17,8 +17,9 @@ class LocaleController extends Zend_Controller_Action
|
||||||
header("Content-type: text/javascript");
|
header("Content-type: text/javascript");
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
$locale = Application_Model_Preference::GetLocale();
|
||||||
echo "var datatables_dict =" .
|
echo "var datatables_dict =" .
|
||||||
file_get_contents($_SERVER['DOCUMENT_ROOT'].$baseUrl.'/js/datatables/i18n/en_CA.txt');
|
file_get_contents($_SERVER['DOCUMENT_ROOT'].$baseUrl.'/js/datatables/i18n/'.$locale.'.txt');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generalTranslationTableAction()
|
public function generalTranslationTableAction()
|
||||||
|
|
|
@ -44,6 +44,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
||||||
Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]);
|
Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]);
|
||||||
Application_Model_Preference::SetAllow3rdPartyApi($values["thirdPartyApi"]);
|
Application_Model_Preference::SetAllow3rdPartyApi($values["thirdPartyApi"]);
|
||||||
|
Application_Model_Preference::SetLocale($values["locale"]);
|
||||||
Application_Model_Preference::SetTimezone($values["timezone"]);
|
Application_Model_Preference::SetTimezone($values["timezone"]);
|
||||||
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
|
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
|
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
|
||||||
$third_party_api->setDecorators(array('ViewHelper'));
|
$third_party_api->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($third_party_api);
|
$this->addElement($third_party_api);
|
||||||
|
|
||||||
|
$locale = new Zend_Form_Element_Select("locale");
|
||||||
|
$locale->setLabel(_("locale"));
|
||||||
|
$locale->setMultiOptions($this->getLocales());
|
||||||
|
$locale->setValue(Application_Model_Preference::GetLocale());
|
||||||
|
$locale->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($locale);
|
||||||
|
|
||||||
/* Form Element for setting the Timezone */
|
/* Form Element for setting the Timezone */
|
||||||
$timezone = new Zend_Form_Element_Select("timezone");
|
$timezone = new Zend_Form_Element_Select("timezone");
|
||||||
|
@ -109,4 +116,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
return $days;
|
return $days;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getLocales()
|
||||||
|
{
|
||||||
|
$locales = array(
|
||||||
|
'en_CA' => 'English'
|
||||||
|
);
|
||||||
|
|
||||||
|
return $locales;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,6 +428,16 @@ class Application_Model_Preference
|
||||||
{
|
{
|
||||||
return self::getValue("timezone");
|
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)
|
public static function SetStationLogo($imagePath)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,22 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt id="locale-label" class="block-display">
|
||||||
|
<label class="required" for="locale"><?php echo $this->element->getElement('locale')->getLabel() ?>:
|
||||||
|
</label>
|
||||||
|
</dt>
|
||||||
|
<dd id="locale-element" class="block-display">
|
||||||
|
<?php echo $this->element->getElement('locale') ?>
|
||||||
|
<?php if($this->element->getElement('locale')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('locale')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt id="timezone-label" class="block-display">
|
<dt id="timezone-label" class="block-display">
|
||||||
<label class="required" for="timezone"><?php echo $this->element->getElement('timezone')->getLabel() ?>
|
<label class="required" for="timezone"><?php echo $this->element->getElement('timezone')->getLabel() ?>
|
||||||
<span class="info-text-small">(Required)</span> :
|
<span class="info-text-small">(Required)</span> :
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue