Elgg  Version 1.11
languages.php
Go to the documentation of this file.
1 <?php
6 $language = elgg_extract('language', $vars);
7 
8 if (empty($language)) {
9  // try to detect it
10  preg_match("/\/js\/languages\/(.*?).js+/", current_page_url(), $matches);
11 
12  if (!empty($matches) && isset($matches[1])) {
13  $language = $matches[1];
14  }
15 }
16 
17 if (empty($language)) {
18  // fallback to 'en'
19  $language = 'en';
20 }
21 
24 
25 if ($language != 'en' && !isset($all_translations[$language])) {
26  // try to reload missing translations
28  $all_translations = elgg_get_config('translations');
29 }
30 
31 if ($language != 'en' && isset($all_translations[$language])) {
32  $translations = array_merge($translations, $all_translations[$language]);
33 }
34 
35 ?>
36 define(<?php echo json_encode($translations); ?>);
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
current_page_url()
Returns the current page&#39;s complete URL.
Definition: input.php:65
$translations
Definition: languages.php:23
reload_all_translations()
Reload all translations from all registered paths.
Definition: languages.php:203
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1246
elgg echo
Translates a string.
Definition: languages.js:43
if(empty($language)) if(empty($language)) $all_translations
Definition: languages.php:22
$language
$vars[&#39;language&#39;]
Definition: languages.php:6
define(function(require){var $=require('jquery');var active=false;var SHOW_DELAY=20;$('body').append('< div class="elgg-spinner">< div class="elgg-ajax-loader"></div ></div >');return{start:function(){active=true;setTimeout(function(){if(active){$('body').addClass('elgg-spinner-active');}}, SHOW_DELAY);}, stop:function(){active=false;$('body').removeClass('elgg-spinner-active');}};})
if(file_exists($welcome)) $vars
Definition: upgrade.php:93