<commit_before>/**
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2016 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.web.internal;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.jsp.JspException;

import com.axelor.app.AppSettings;
import com.axelor.auth.AuthUtils;
import com.axelor.auth.db.Group;
import com.axelor.auth.db.User;
import com.axelor.common.StringUtils;
import com.axelor.common.VersionUtils;
import com.axelor.db.mapper.Mapper;
import com.axelor.db.mapper.Property;
import com.axelor.meta.db.MetaFile;
import com.axelor.script.GroovyScriptHelper;
import com.axelor.script.ScriptBindings;
import com.axelor.script.ScriptHelper;

public class AppInfo {

	private static final AppSettings SETTINGS = AppSettings.get();
	private static final String APP_THEME = SETTINGS.get("application.theme", null);

	public Map<String, Object> info(final ServletContext context) {

		final Map<String, Object> map = new HashMap<>();
		final User user = AuthUtils.getUser();

		if (user == null) {
			return map;
		}

		final Group group = user.getGroup();

		// if name field is overridden
		final Property nameField = Mapper.of(User.class).getNameField();
		final Object nameValue = nameField.get(user);

		map.put("user.id", user.getId());
		map.put("user.name", nameValue);
		map.put("user.login", user.getCode());
		map.put("user.nameField", nameField.getName());
		map.put("user.lang", user.getLanguage());
		map.put("user.action", user.getHomeAction());
		map.put("user.singleTab", user.getSingleTab());
		map.put("user.noHelp", user.getNoHelp() == Boolean.TRUE);

		if (user.getImage() != null) {
			map.put("user.image", getLink(user, null));
		} else {
			map.put("user.image", "img/user.png");
		}
<commit_msg>Respect user.lang app info : Use AppFilter.getLocale().<commit_after>/**
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2016 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.web.internal;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.jsp.JspException;

import com.axelor.app.AppSettings;
import com.axelor.app.internal.AppFilter;
import com.axelor.auth.AuthUtils;
import com.axelor.auth.db.Group;
import com.axelor.auth.db.User;
import com.axelor.common.StringUtils;
import com.axelor.common.VersionUtils;
import com.axelor.db.mapper.Mapper;
import com.axelor.db.mapper.Property;
import com.axelor.meta.db.MetaFile;
import com.axelor.script.GroovyScriptHelper;
import com.axelor.script.ScriptBindings;
import com.axelor.script.ScriptHelper;

public class AppInfo {

	private static final AppSettings SETTINGS = AppSettings.get();
	private static final String APP_THEME = SETTINGS.get("application.theme", null);

	public Map<String, Object> info(final ServletContext context) {

		final Map<String, Object> map = new HashMap<>();
		final User user = AuthUtils.getUser();

		if (user == null) {
			return map;
		}

		final Group group = user.getGroup();

		// if name field is overridden
		final Property nameField = Mapper.of(User.class).getNameField();
		final Object nameValue = nameField.get(user);

		map.put("user.id", user.getId());
		map.put("user.name", nameValue);
		map.put("user.login", user.getCode());
		map.put("user.nameField", nameField.getName());
		map.put("user.lang", AppFilter.getLocale().getLanguage());
		map.put("user.action", user.getHomeAction());
		map.put("user.singleTab", user.getSingleTab());
		map.put("user.noHelp", user.getNoHelp() == Boolean.TRUE);

		if (user.getImage() != null) {
			map.put("user.image", getLink(user, null));
		} else {
			map.put("user.image", "img/user.png");
		}

{'fraction_non_alphanumeric': 0.12805229763507017, 'fraction_numerical': 0.003460872909055951, 'mean_word_length': 4.504761904761905, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '826798', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1590, 'n_words': 455}