<commit_before>
<?php
/*
Checking if we need to change something and changing it is done
before loading the language in the file
inc.langLoad.php
called in inc.header.php
*/

/*
* Create up to date file if language was changed including the default English values
*/
if(
    isset($_POST['lang']) 
    && trim($_POST['lang']) != ""
    && trim($_POST['lang']) != "en-UK"
    ) {
    /*

    $filename = 'lang/lang-'.$_POST['lang'].'.php';
    
    $langPHP = "<?php \n    \$lang = array();\n";
    foreach($langDef as $langKey => $langVal) {
        //$langPHP .= "// ".$langKey." => ".$langVal."\n";
        if(isset($langCustom[$langKey])) {
            $langPHP .= "\$lang['".$langKey."'] = \"".$langCustom[$langKey]."\"\n";
        } else {
            $langPHP .= "\$lang['".$langKey."'] = \"".$langDef[$langKey]."\"\n";
            $messageLangfileNewItems = $lang['settingsMessageLangfileNewItems'];
        }
    }<commit_msg>lang switch: auto write non translated to language files in default lang<commit_after>
<?php
/*
Checking if we need to change something and changing it is done
before loading the language in the file
inc.langLoad.php
called in inc.header.php
*/

/*
* Create up to date file if language was changed including the default English values
*/
if(
    isset($_POST['lang']) 
    && trim($_POST['lang']) != ""
    && trim($_POST['lang']) != "en-UK"
    ) {
    /**/

    $filename = realpath('lang/lang-'.$_POST['lang'].'.php');
    
    $langPHP = "<?php\n\$lang = array();\n";
    foreach($langDef as $langKey => $langVal) {
        //$langPHP .= "// ".$langKey." => ".$langVal."\n";
        if(isset($langCustom[$langKey])) {
            $langPHP .= "\$lang['".$langKey."'] = \"".str_replace('"', '\"', $langCustom[$langKey])."\";\n";
        } else {
            $langPHP .= "\$lang['".$langKey."'] = \"".str_replace('"', '\"', $langDef[$langKey])."\";\n";
            $messageLangfileNewItems = $lang['settingsMessageLangfileNewItems'];
        }
    }
{'fraction_non_alphanumeric': 0.21925403225806453, 'fraction_numerical': 0.0, 'mean_word_length': 2.731203007518797, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '327964', 'n_tokens_mistral': 647, 'n_tokens_neox': 635, 'n_words': 147}