Login trouble when using french as user language

Hi,

when switching a user to french I am upable to login to desk and get this message:
grafik

It has this error

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py", line 85, in render_template
    return get_jenv().from_string(template).render(context)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 2, in top-level template code
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/sandbox.py", line 407, in getattr
    value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'desk_theme' is undefined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 49, in render
    data = render_page_by_language(path)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 178, in render_page_by_language
    return render_page(path)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 194, in render_page
    return build(path)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 201, in build
    return build_page(path)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 219, in build_page
    html = frappe.render_template(context.source, context)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py", line 87, in render_template
    throw(title="Jinja Template Error", msg="<pre>{template}</pre><pre>{tb}</pre>".format(template=template, tb=get_traceback()))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 433, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 412, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 366, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: <pre><!DOCTYPE html>
<html data-theme="{{ desk_theme.lower() }}">
	<head>
		<!-- Chrome, Firefox OS and Opera -->
		<meta name="theme-color" content="#0089FF">
		<!-- Windows Phone -->
		<meta name="msapplication-navbutton-color" content="#0089FF">
		<!-- iOS Safari -->
		<meta name="apple-mobile-web-app-status-bar-style" content="#0089FF">
		<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
		<meta content="utf-8" http-equiv="encoding">
		<meta name="author" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,
			maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="white">
		<meta name="mobile-web-app-capable" content="yes">
		<title>Frappe</title>
		<link rel="shortcut icon"
			href="{{ favicon or "/assets/frappe/images/frappe-favicon.svg" }}" type="image/x-icon">
		<link rel="icon"
			href="{{ favicon or "/assets/frappe/images/frappe-favicon.svg" }}" type="image/x-icon">
		{% for include in include_css -%}
		<link type="text/css" rel="stylesheet" href="{{ include }}?ver={{ build_version }}">
		{%- endfor -%}
	</head>
	<body>
		{% include "public/icons/timeless/symbol-defs.svg" %}
		<div class="centered splash">
			<img src="{{ splash_image or "/assets/frappe/images/frappe-framework-logo.png" }}"
				style="max-width: 100px; max-height: 100px;">
		</div>
		<div class="main-section">
			<header></header>
			<div id="body"></div>
			<footer></footer>
		</div>

		<script type="text/javascript" src="/assets/frappe/js/lib/jquery/jquery.min.js"></script>

		<script type="text/javascript">
		window._version_number = "{{ build_version }}";
		// browser support
		window.app = true;
		window.dev_server = {{ dev_server }};

		if(!window.frappe) window.frappe = {};

		frappe.boot = {{ boot }};

		frappe.csrf_token = "{{ csrf_token }}";

		</script>

		{% for include in include_js %}
		<script type="text/javascript" src="{{ include }}?ver={{ build_version }}"></script>
		{% endfor %}
		{% include "templates/includes/app_analytics/google_analytics.html" %}
		{% include "templates/includes/app_analytics/mixpanel_analytics.html" %}

		{% for sound in (sounds or []) %}
		<audio preload="auto" id="sound-{{ sound.name }}" volume={{ sound.volume or 1 }}>
			<source src="{{ sound.src }}"></source>
		</audio>
		{% endfor %}
	</body>
</html>
</pre><pre>Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py", line 85, in render_template
    return get_jenv().from_string(template).render(context)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 2, in top-level template code
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/sandbox.py", line 407, in getattr
    value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'desk_theme' is undefined
</pre>

Many Thanks.

i had the same issue when i switch arabic , i have translate the system and I think that’s what broke it ,
so words should not be translated so system doesn’t break .
i switched back to en from bench console

Could you tell us what command do you launch into bench console ? I can’t find any documentation on it

@ahmadRagheb thank you for the hint. I have checked my translations an saw that there were french translations were either the source or target translation or both was empty. I deleted all those entries and it seems to work since.

1 Like

Can you share this command?

Hi @Eric_Qin there is no command. Just go into the List view of Translation and try what I worte.

1 Like

Thanks for your reply, I think I found the place to adjust the language, it is done in My Settings -> Language