Skip to content

Commit

Permalink
Setting up default language in settings.php
Browse files Browse the repository at this point in the history
  • Loading branch information
uprel committed May 4, 2017
1 parent b4f8a1d commit ad7b8f3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions admin/settings_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
* More information at https://github.com/uprel/gisapp
*/

//2 letter language code defining default language if not provided with url paramater lang
//language must be part of translated languages for EQWC
define('DEFAULT_LANG', 'en');

//true loads source javascript files, false loads single minified version for production
define('DEBUG', false);

Expand Down
4 changes: 4 additions & 0 deletions admin/settings_windows.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
* More information at https://github.com/uprel/gisapp
*/

//2 letter language code defining default language if not provided with url paramater lang
//language must be part of translated languages for EQWC
define('DEFAULT_LANG', 'en');

//true loads source javascript files, false loads single minified version for production
define('DEBUG', false);

Expand Down
8 changes: 4 additions & 4 deletions client/site/js/GetUrlParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ if (urlArray.length > 1) {
format = urlParams.format;
}
origFormat = format;
if (typeof lang == "undefined") {
//if lang is not defined in GlobalOptions.js we set it to "en"
lang = "en";
}
//if (typeof lang == "undefined") {
// //if lang is not defined in GlobalOptions.js we set it to "en"
// lang = "en";
//}
if (urlParams.lang) {
//check if language is available
if (availableLanguages[urlParams.lang]) {
Expand Down
4 changes: 2 additions & 2 deletions client/site/js/LoadAppProjectData.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ var Eqwc = {};
Eqwc.plugins = {};


var lang = "en";
var helpfile = "help_en.html";
var lang = projectData.lang;
//var helpfile = "help_en.html";

//Custom function to populate GetUrlParams variables
var customGetUrlParamsParser = null;
Expand Down
2 changes: 2 additions & 0 deletions client_common/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$settings = json_decode($_SESSION['settings']);
$gis_projects = json_decode($_SESSION['gis_projects']);
$qgs = json_decode($_SESSION['qgs']);
$lang = $_SESSION['lang'];

if (!property_exists($settings, "search")) {
$settings->search = null;
Expand Down Expand Up @@ -46,6 +47,7 @@
projectData.client_display_name = '<?php echo $data->client_display_name ?>';
projectData.client_url = '<?php echo $data->client_url ?>';
projectData.client_logo = '<?php echo $data->client_logo ?>';
projectData.lang = '<?php echo $lang ?>';

projectData.search = eval(<?php echo json_encode($settings->search) ?>);
projectData.layerSpecifics = eval(<?php echo json_encode($settings->layerSpecifics) ?>);
Expand Down
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ function goMobile($lang) {
if($def_lang>'') {
$lang_fn = filter_input(INPUT_SERVER,'DOCUMENT_ROOT',FILTER_SANITIZE_STRING) . GISAPPURL . 'admin/languages/' . $def_lang . '.js';
if(!(file_exists($lang_fn))) {
$def_lang = 'en';
$def_lang = defined('DEFAULT_LANG') ? DEFAULT_LANG : 'en';
}
}
else {
$def_lang = "en";
$def_lang = defined('DEFAULT_LANG') ? DEFAULT_LANG : 'en';
}

$_SESSION['lang'] = $def_lang;
Expand Down

0 comments on commit ad7b8f3

Please # to comment.