<commit_before><?php

/**
 * Edit the settings for a language, including
 *
 * - name
 * - code
 * - locale
 * - charset
 * - fallback
 */

$this->require_acl ('admin', 'translator');

$page->layout = 'admin';

$lang = $i18n->languages[$_GET['lang']];

$page->title = __ ('Language settings') . ': ' . $lang['name'];

$form = new Form ('post', $this);

$form->data = $i18n->languages[$_GET['lang']];

require_once ('apps/translator/lib/Functions.php');

echo $form->handle (function ($form) {
	// Update lang/languages.php

	$_POST['code'] = strtolower ($_POST['code']);
	$_POST['locale'] = strtolower ($_POST['locale']);

	if (! empty ($_POST['locale'])) {
		$lang = $_POST['code'] . '_' . $_POST['locale'];
	} else {
		$lang = $_POST['code'];
	}

	$i18n = $this->controller->i18n ();

	if ($lang !== $_GET['lang']) {
		// Language has changed ids<commit_msg>Fixed error in saving language settings<commit_after><?php

/**
 * Edit the settings for a language, including
 *
 * - name
 * - code
 * - locale
 * - charset
 * - fallback
 */

$this->require_acl ('admin', 'translator');

$page->layout = 'admin';

$lang = $i18n->languages[$_GET['lang']];

$page->title = __ ('Language settings') . ': ' . $lang['name'];

$form = new Form ('post', $this);

$form->data = $i18n->languages[$_GET['lang']];

require_once ('apps/translator/lib/Functions.php');

echo $form->handle (function ($form) {
	// Update lang/languages.php

	$_POST['code'] = strtolower ($_POST['code']);
	$_POST['locale'] = strtolower ($_POST['locale']);

	if (! empty ($_POST['locale'])) {
		$lang = $_POST['code'] . '_' . $_POST['locale'];
	} else {
		$lang = $_POST['code'];
	}

	$i18n = $form->controller->i18n ();

	if ($lang !== $_GET['lang']) {
		// Language has changed ids
{'fraction_non_alphanumeric': 0.23940435280641467, 'fraction_numerical': 0.009163802978235968, 'mean_word_length': 4.0491329479768785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6422554', 'n_tokens_mistral': 640, 'n_tokens_neox': 615, 'n_words': 130}