Permalink
Browse files

# [#29091] *Language issues during installation: E-Mail always in

English. Thanks Dennis
  • Loading branch information...
1 parent 1b8ed0d commit 35e552c5dedaba9ca850c50c179819a74a8e35b8 @Denitz Denitz committed with infograf768 Sep 18, 2012
View
3 installation/CHANGELOG
@@ -26,6 +26,9 @@ $ -> Language fix or change
- -> Removed
! -> Note
+18-Sep-2012 Jean-Marie Simonet
+ # [#29091] *Language issues during installation: E-Mail always in English. Thanks Dennis
+
17-Sep-2012 Mark Dexter
# [#29194] Add some alternatives to the Joomla Logo. Thanks Dianne Henning & Elin.
# [#29181] Make article info block semantic. Thanks Elin.
View
6 installation/controller.php
@@ -78,12 +78,6 @@ public function display($cachable = false, $urlparams = false)
}
$options = $model->getOptions();
- if (isset($options['language']))
- {
- $lang = JFactory::getLanguage();
- $lang->setLanguage($options['language']);
- $lang->load();
- }
if ($vName != $default_view && ($checkOptions && empty($options)))
{
View
20 installation/controllers/setup.json.php
@@ -86,6 +86,10 @@ public function setlanguage()
// Store the options in the session.
$vars = $model->storeOptions($return);
+ // Setup language
+ $language = JFactory::getLanguage();
+ $language->setLanguage($return['language']);
+
// Redirect to the page.
$r->view = $this->input->getWord('view', 'site');
$this->sendResponse($r);
@@ -704,21 +708,7 @@ function __construct($state)
$this->token = JSession::getFormToken(true);
// Get the language and send it's code along
- $lang = JFactory::getLanguage();
- $this->lang = $lang->getTag();
-
- // Use language active in session as active
- $session = JFactory::getSession();
- $options = $session->get('setup.options', array());
- if (isset($options['language']))
- {
- // Ensure that es-es language tags are returned as es-ES
- $parts = explode('-', $options['language']);
- if (count($parts) == 2)
- {
- $this->lang = $parts[0] . '-' . strtoupper($parts[1]);
- }
- }
+ $this->lang = JFactory::getLanguage()->getTag();
// Get the message queue
$messages = JFactory::getApplication()->getMessageQueue();
View
24 installation/includes/application.php
@@ -121,10 +121,12 @@ public function initialise($options = array())
// Check the session for the language.
if (empty($options['language']))
{
- $sessionLang = JFactory::getSession()->get('setup.language');
- if (!is_null($sessionLang))
+ $session = JFactory::getSession();
+
+ $setupOptions = $session->get('setup.options', array());
+ if (isset($setupOptions['language']) && $setupOptions['language'])
{
- $options['language'] = $sessionLang;
+ $options['language'] = $setupOptions['language'];
}
}
@@ -212,7 +214,6 @@ public static function debugLanguage()
$guesses[] = $key . '="' . $guess . '"';
}
- echo "\n\n# " . $file . "\n\n";
echo implode("\n", $guesses);
}
else
@@ -377,4 +378,19 @@ public function getLocaliseAdmin($db = false)
return $langfiles;
}
+
+ /**
+ * Overload parent method because we don't have menu
+ *
+ * @param string $name The name of the application/client.
+ * @param array $options An optional associative array of configuration settings.
+ *
+ * @return JMenu JMenu object.
+ *
+ * @since 11.1
+ */
+ public function getMenu($name = null, $options = array())
+ {
+ }
+
}
View
16 installation/models/database.php
@@ -84,13 +84,19 @@ public function initialise($options)
$options = JArrayHelper::toObject($options);
// Load the back-end language files so that the DB error messages work
- $lang = JFactory::getLanguage();
-
- // Pre-load en-GB in case the chosen language files do not exist
- $lang->load('joomla', JPATH_ADMINISTRATOR, 'en-GB', true);
+ $lang = JFactory::getLanguage();
+ $currentLang = $lang->getTag();
// Load the selected language
- $lang->load('joomla', JPATH_ADMINISTRATOR, $options->language, true);
+ if (JLanguage::exists($currentLang, JPATH_ADMINISTRATOR))
+ {
+ $lang->load('joomla', JPATH_ADMINISTRATOR, $currentLang, true);
+ }
+ // Pre-load en-GB in case the chosen language files do not exist
+ else
+ {
+ $lang->load('joomla', JPATH_ADMINISTRATOR, 'en-GB', true);
+ }
// Ensure a database type was selected.
if (empty($options->db_type))
View
22 installation/models/setup.php
@@ -28,16 +28,6 @@ public function getOptions()
$session = JFactory::getSession();
$options = $session->get('setup.options', array());
- // Ensure a valid language string format
- if (isset($options['language']))
- {
- $parts = explode('-', $options['language']);
- if (count($parts) == 2)
- {
- $options['language'] = $parts[0] . '-' . strtoupper($parts[1]);
- }
- }
-
return $options;
}
@@ -56,17 +46,15 @@ public function storeOptions($options)
$session = JFactory::getSession();
$old = $session->get('setup.options', array());
+ // Ensure that we have language
+ if (!isset($options['language']) || empty($options['language'])) {
+ $options['language'] = JFactory::getLanguage()->getTag();
+ }
+
// Merge the new setup options into the current ones and store in the session.
$options = array_merge($old, (array) $options);
$session->set('setup.options', $options);
- // If the setup language is set in the options, set it separately in the session and JLanguage.
- if (!empty($options['language']))
- {
- $session->set('setup.language', $options['language']);
- JFactory::getLanguage()->setLanguage($options['language']);
- }
-
return $options;
}
View
5 installation/template/index.php
@@ -31,7 +31,6 @@
// Load the JavaScript translated messages
JText::script('INSTL_PROCESS_BUSY');
-JText::script('INSTL_SITE_SAMPLE_LOADED');
JText::script('INSTL_FTP_SETTINGS_CORRECT');
?>
<!DOCTYPE html>
@@ -98,7 +97,7 @@ function initElements() {
label.closest('.btn-group').find("label").removeClass('active btn-success btn-danger btn-primary');
if(input.val()== '') {
label.addClass('active btn-primary');
- } else if(input.val()==0) {
+ } else if(input.val()==0 || input.val()=='remove') {
label.addClass('active btn-danger');
} else {
label.addClass('active btn-success');
@@ -109,7 +108,7 @@ function initElements() {
$(".btn-group input[checked=checked]").each(function() {
if($(this).val()== '') {
$("label[for=" + $(this).attr('id') + "]").addClass('active btn-primary');
- } else if($(this).val()==0) {
+ } else if($(this).val()==0 || $(this).val()=='remove') {
$("label[for=" + $(this).attr('id') + "]").addClass('active btn-danger');
} else {
$("label[for=" + $(this).attr('id') + "]").addClass('active btn-success');
View
111 installation/template/js/installation.js
@@ -7,7 +7,6 @@
var Installation = new Class({
initialize: function(container, base) {
- this.sampleDataLoaded = false;
this.busy = false;
this.container = container;
this.spinner = new Spinner(this.container);
@@ -31,13 +30,9 @@ var Installation = new Class({
return false;
}
- if (form.task.value == 'setup.site') {
- $('setlanguage').value = $$('html').getProperty('lang')[0];
- }
-
var req = new Request.JSON({
- method: 'post',
- url: this.baseUrl,
+ url: this.baseUrl + '?format=json',
+ data: form,
onRequest: function() {
this.spinner.show(true);
this.busy = true;
@@ -64,8 +59,7 @@ var Installation = new Class({
alert(r.message);
}
}.bind(this)
- });
- req.post(form.toQueryString()+'&task='+form.task.value+'&format=json');
+ }).send();
return false;
},
@@ -79,8 +73,8 @@ var Installation = new Class({
}
var req = new Request.JSON({
- method: 'post',
- url: this.baseUrl,
+ url: this.baseUrl + '?format=json',
+ data: form,
onRequest: function() {
this.spinner.show(true);
this.busy = true;
@@ -107,17 +101,15 @@ var Installation = new Class({
alert(r.message);
}
}.bind(this)
- });
- req.post(form.toQueryString()+'&task=setup.setlanguage&format=json');
+ }).send();
return false;
},
goToPage: function(page, fromSubmit) {
- var url = this.baseUrl+'?tmpl=body&view='+page;
var req = new Request.HTML({
method: 'get',
- url: url,
+ url: this.baseUrl + '?tmpl=body&view=' + page,
update: this.container,
onRequest: function() {
if (!fromSubmit) {
@@ -148,6 +140,7 @@ var Installation = new Class({
if (!tasks.length) {
progress.setStyle('width',(progress.getStyle('width').toFloat()+(step_width*3))+'%');
this.goToPage('complete');
+ return;
}
if (!step_width) {
@@ -157,17 +150,15 @@ var Installation = new Class({
var task = tasks.shift();
var form = document.id('adminForm');
var tr = document.id('install_'+task);
- var spinner = tr.getElement('div.spinner');
var req = new Request.JSON({
- method: 'post',
- url: 'index.php?'+form.toQueryString(),
- data: {'task':'setup.install_'+task, 'format':'json'},
+ url: this.baseUrl + '?task=setup.install_' + task + '&format=json',
+ data: form,
onRequest: function() {
progress.setStyle('width',(progress.getStyle('width').toFloat()+step_width)+'%');
tr.addClass('active');
- spinner.setStyle('visibility','visible');
- },
+ this.spinner.show(true);
+ }.bind(this),
onSuccess: function(r) {
Joomla.replaceTokens(r.token);
if (r.messages) {
@@ -176,13 +167,13 @@ var Installation = new Class({
} else {
progress.setStyle('width',(progress.getStyle('width').toFloat()+(step_width*10))+'%');
tr.removeClass('active');
- spinner.setStyle('visibility','hidden');
+ this.spinner.hide(true);
this.install(tasks, step_width);
}
}.bind(this),
onError: function(text, error) {
- Joomla.renderMessages([['',Joomla.JText._('JLIB_DATABASE_ERROR_DATABASE', 'A Database error occurred.')]]);
+ Joomla.renderMessages([['',Joomla.JText._('JLIB_DATABASE_ERROR_DATABASE_CONNECT', 'A Database error occurred.')]]);
Install.goToPage('summary');
}.bind(this),
onFailure: function(xhr) {
@@ -196,71 +187,13 @@ var Installation = new Class({
},
/**
- * Method to install sample data via AJAX request.
- */
- sampleData: function(el, filename) {
- this.busy = true;
- sample_data_spinner = new Spinner('collapseSample');
- sample_data_spinner.show(true);
- el = document.id(el);
- filename = document.id(filename);
- var req = new Request.JSON({
- method: 'get',
- url: 'index.php?'+document.id(el.form).toQueryString(),
- data: {'task':'setup.loadSampleData', 'format':'json'},
- onRequest: function() {
- el.set('disabled', 'disabled');
- filename.set('disabled', 'disabled');
- document.id('theDefaultError').setStyle('display','none');
- },
- onSuccess: function(r) {
- if (r) {
- Joomla.replaceTokens(r.token);
- this.sampleDataLoaded = r.data.sampleDataLoaded;
- if (r.error == false) {
- el.set('text', Joomla.JText._('INSTL_SITE_SAMPLE_LOADED', 'Sample Data Installed Successfully.'));
- el.set('onclick','');
- el.set('disabled', 'disabled');
- filename.set('disabled', 'disabled');
- } else {
- document.id('theDefaultError').setStyle('display','block');
- document.id('theDefaultErrorMessage').set('html', r.message);
- el.set('disabled', '');
- filename.set('disabled', '');
- }
- } else {
- document.id('theDefaultError').setStyle('display','block');
- document.id('theDefaultErrorMessage').set('html', response );
- el.set('disabled', 'disabled');
- filename.set('disabled', 'disabled');
- }
- this.busy = false;
- sample_data_spinner.hide(true);
- }.bind(this),
- onFailure: function(xhr) {
- var r = JSON.decode(xhr.responseText);
- if (r) {
- Joomla.replaceTokens(r.token);
- document.id('theDefaultError').setStyle('display','block');
- document.id('theDefaultErrorMessage').set('html', r.message);
- }
- el.set('disabled', '');
- filename.set('disabled', '');
- this.busy = false;
- sample_data_spinner.hide(true);
- }
- }).send();
- },
-
- /**
* Method to detect the FTP root via AJAX request.
*/
detectFtpRoot: function(el) {
el = document.id(el);
var req = new Request.JSON({
- method: 'get',
- url: 'index.php?'+document.id(el.form).toQueryString(),
- data: {'task':'setup.detectFtpRoot', 'format':'json'},
+ url: this.baseUrl + '?task=setup.detectFtpRoot&format=json',
+ data: document.id(el.form),
onRequest: function() {
el.set('disabled', 'disabled');
},
@@ -291,9 +224,8 @@ var Installation = new Class({
// make the ajax call
el = document.id(el);
var req = new Request.JSON({
- method: 'get',
- url: 'index.php?'+document.id(el.form).toQueryString(),
- data: {'task':'setup.verifyFtpSettings', 'format':'json'},
+ url: this.baseUrl + '?task=setup.verifyFtpSettings&format=json',
+ data: document.id(el.form),
onRequest: function() {
el.set('disabled', 'disabled'); },
onFailure: function(xhr) {
@@ -328,9 +260,8 @@ var Installation = new Class({
removeFolder: function(el) {
el = document.id(el);
var req = new Request.JSON({
- method: 'get',
- url: 'index.php?'+document.id(el.form).toQueryString(),
- data: {'task':'setup.removeFolder', 'format':'json'},
+ url: this.baseUrl + '?task=setup.removeFolder&format=json',
+ data: document.id(el.form),
onRequest: function() {
el.set('disabled', 'disabled');
document.id('theDefaultError').setStyle('display','none');
@@ -342,6 +273,8 @@ var Installation = new Class({
el.set('value', r.data.text);
el.set('onclick','');
el.set('disabled', 'disabled');
+ // Stop keep alive requests
+ window.keepAlive = function(){};
} else {
document.id('theDefaultError').setStyle('display','block');
document.id('theDefaultErrorMessage').set('html', r.message);
View
1 installation/views/complete/tmpl/default.php
@@ -75,6 +75,5 @@
</div>
<?php endif; ?>
- <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
View
1 installation/views/site/tmpl/default.php
@@ -105,7 +105,6 @@
</div>
</div>
- <input type="hidden" name="jform[language]" value="" id="setlanguage" />
<input type="hidden" name="task" value="setup.site" />
<?php echo JHtml::_('form.token'); ?>
</form>

0 comments on commit 35e552c

Please sign in to comment.