summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2018-10-08 18:29:04 +0100
committerGreg Roach <fisharebest@webtrees.net>2018-10-08 18:29:04 +0100
commite58a20ff6a8776678adb8f067c0874f8e2a916a1 (patch)
treefa8fd0e436c5efb373bc60f628f78ab1a3be5461 /index.php
parentdb501309c1442f84523f4ecef67a7b3c254ede36 (diff)
downloadwebtrees-e58a20ff6a8776678adb8f067c0874f8e2a916a1.tar.gz
webtrees-e58a20ff6a8776678adb8f067c0874f8e2a916a1.tar.bz2
webtrees-e58a20ff6a8776678adb8f067c0874f8e2a916a1.zip
Fix: search engines should see content in tree's default language
Diffstat (limited to 'index.php')
-rw-r--r--index.php12
1 files changed, 4 insertions, 8 deletions
diff --git a/index.php b/index.php
index 56fbf29df0..42cc9a9bfa 100644
--- a/index.php
+++ b/index.php
@@ -188,14 +188,6 @@ if ($max_execution_time !== '' && strpos(ini_get('disable_functions'), 'set_time
// Sessions
Session::start();
-DebugBar::startMeasure('init i18n');
-
-// With no parameters, init() looks to the environment to choose a language
-define('WT_LOCALE', I18N::init());
-Session::put('locale', WT_LOCALE);
-
-DebugBar::stopMeasure('init i18n');
-
// Note that the database/webservers may not be synchronised, so use DB time throughout.
define('WT_TIMESTAMP', (int) Database::prepare("SELECT UNIX_TIMESTAMP()")->fetchOne());
@@ -240,6 +232,10 @@ try {
$tree = $all_trees[Site::getPreference('DEFAULT_GEDCOM')] ?? array_values($all_trees)[0] ?? null;
}
+ // Select a locale
+ define('WT_LOCALE', I18N::init('', $tree));
+ Session::put('locale', WT_LOCALE);
+
// Most layouts will require a tree for the page header/footer
View::share('tree', $tree);