1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8function prefs_language_list($partial = false)
9{
10	$map = [];
11	$adminMap = [];
12
13	if (! $partial) {
14		$langLib = TikiLib::lib('language');
15		$languages = $langLib->list_languages(false, null, true);
16		foreach ($languages as $lang) {
17			$map[ $lang['value'] ] = $lang['name'];
18		}
19	}
20	$adminMap[''] = tr('Default language');
21	$adminMap = array_merge($adminMap, $map);
22
23	return [
24		'language' => [
25			'name' => tra('Default language'),
26			'description' => tra('The site language is used when no other language is specified by the user.'),
27			'filter' => 'lang',
28			'help' => 'I18n',
29			'type' => 'list',
30			'options' => $map,
31			'default' => 'en',
32			'tags' => ['basic'],
33		],
34		'language_admin' => [
35			'name' => tr('Default admin language'),
36			'description' => tr('The site language is used in admin section when no other language is specified by the user.'),
37			'filter' => 'lang',
38			'help' => 'I18n',
39			'type' => 'list',
40			'options' => $adminMap,
41			'default' => '',
42			'tags' => ['basic'],
43		],
44		'language_inclusion_threshold' => [
45			'name' => tra('Language inclusion threshold'),
46			'description' => tra('When the number of languages is restricted on the site, and is below this number, all languages will be added to the preferred language list, even if unspecified by the user. However, priority will be given to the specified languages.'),
47			'help' => 'Internationalization',
48			'type' => 'text',
49			'filter' => 'digits',
50			'units' => tra('languages'),
51			'size' => 2,
52			'dependencies' => ['restrict_language',],
53			'default' => 3,
54		],
55	];
56}
57