closes #2963, closes #2957

v1.18.x
Barış Soner Uşaklı 10 years ago
parent 5fda8422c5
commit 0ed46c3bae

@ -2,7 +2,11 @@
/*global define*/ /*global define*/
define('admin/general/languages', ['admin/settings'], function(Settings) { define('admin/general/languages', ['admin/settings'], function(Settings) {
$(function() { var Languages = {}
Languages.init = function() {
Settings.prepare(); Settings.prepare();
}); };
return Languages;
}); });

@ -250,6 +250,12 @@ adminController.plugins.get = function(req, res, next) {
adminController.languages.get = function(req, res, next) { adminController.languages.get = function(req, res, next) {
languages.list(function(err, languages) { languages.list(function(err, languages) {
if (err) {
return next(err);
}
languages.forEach(function(language) {
language.selected = language.code === meta.config.defaultLang;
});
res.render('admin/general/languages', { res.render('admin/general/languages', {
languages: languages languages: languages
}); });

@ -14,7 +14,7 @@
<label for="defaultLang">Default Language</label> <label for="defaultLang">Default Language</label>
<select id="language" data-field="defaultLang" class="form-control"> <select id="language" data-field="defaultLang" class="form-control">
<!-- BEGIN languages --> <!-- BEGIN languages -->
<option value="{languages.code}">{languages.name} ({languages.code})</option> <option value="{languages.code}" <!-- IF languages.selected -->selected<!-- ENDIF languages.selected -->>{languages.name} ({languages.code})</option>
<!-- END languages --> <!-- END languages -->
</select> </select>
</div> </div>
@ -35,6 +35,4 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('#language').val(translator.getLanguage());
</script>

Loading…
Cancel
Save