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])) {
33 }
34 
35 ?>
36 define(<?php echo json_encode($translations); ?>);
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
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
reload_all_translations()
Reload all translations from all registered paths.
Definition: languages.php:203
current_page_url()
Returns the current page's complete URL.
Definition: input.php:65
if(file_exists($welcome)) $vars
Definition: upgrade.php:93
$language
@uses $vars['language']
Definition: languages.php:6
if(empty($language)) if(empty($language)) $all_translations
Definition: languages.php:22
$translations
Definition: languages.php:23