Default to Persian and use SVG language flags (#11)

Co-authored-by: Cursor <cursoragent@cursor.com>
Reviewed-on: #11
Co-authored-by: diaco <dyaco8464@yahoo.com>
Co-committed-by: diaco <dyaco8464@yahoo.com>
This commit was merged in pull request #11.
This commit is contained in:
2026-10-04 07:31:59 +00:00
committed by rhino
parent cb8fd593c0
commit bf5ce1bb3f
3 changed files with 39 additions and 11 deletions

View File

@@ -1,10 +1,10 @@
{% load static %}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Lithium | Print Label{% endblock %}</title>
<title>{% block title %}لیتیوم |‌ پرینت لیبل{% endblock %}</title>
<link rel="icon" href="{% static 'lithium.png' %}" type="image/png">
<link rel="apple-touch-icon" href="{% static 'lithium.png' %}">
<link rel="preconnect" href="https://fonts.googleapis.com">
@@ -15,6 +15,9 @@
(function () {
var t = localStorage.getItem('slip_theme') || 'light';
document.documentElement.setAttribute('data-theme', t);
var lang = localStorage.getItem('slip_lang') || 'fa';
document.documentElement.lang = lang;
document.documentElement.dir = lang === 'fa' ? 'rtl' : 'ltr';
})();
</script>
{% block extra_head %}{% endblock %}
@@ -24,19 +27,22 @@
<div class="nav-container">
<a href="{% url 'entry' %}" class="nav-logo">
<img class="logo-icon" src="{% static 'lithium.png' %}" alt="" width="32" height="32">
<span class="logo-text" data-i18n="app_title">Lithium | Print Label</span>
<span class="logo-text" data-i18n="app_title">لیتیوم |‌ پرینت لیبل</span>
</a>
<div class="nav-links">
<a href="{% url 'entry' %}" class="nav-link {% block nav_entry_active %}{% endblock %}" data-i18n="data_entry">Data Entry</a>
<a href="{% url 'print_queue' %}" class="nav-link {% block nav_print_active %}{% endblock %}" data-i18n="print_queue">Print Queue</a>
<a href="{% url 'calibrate' %}" class="nav-link" data-i18n="calibrate">Calibrate</a>
<a href="{% url 'entry' %}" class="nav-link {% block nav_entry_active %}{% endblock %}" data-i18n="data_entry">ثبت اطلاعات</a>
<a href="{% url 'print_queue' %}" class="nav-link {% block nav_print_active %}{% endblock %}" data-i18n="print_queue">صف چاپ</a>
<a href="{% url 'calibrate' %}" class="nav-link" data-i18n="calibrate">کالیبراسیون</a>
</div>
<div class="nav-actions">
<button id="theme-toggle" class="btn btn-ghost" type="button" onclick="toggleTheme()" aria-label="Toggle theme">
<span id="theme-label">🌙</span>
</button>
<button id="lang-toggle" class="btn btn-ghost" type="button" onclick="toggleLanguage()">
<span id="lang-label">🇬🇧 EN</span>
<button id="lang-toggle" class="btn btn-ghost" type="button" onclick="toggleLanguage()" aria-label="Toggle language">
<span id="lang-label" class="lang-label">
<svg class="lang-flag" viewBox="0 0 60 30" aria-hidden="true"><rect width="60" height="30" fill="#012169"/><path d="M0,0 60,30M60,0 0,30" stroke="#fff" stroke-width="6"/><path d="M0,0 60,30M60,0 0,30" stroke="#C8102E" stroke-width="2"/><path d="M30,0v30M0,15h60" stroke="#fff" stroke-width="10"/><path d="M30,0v30M0,15h60" stroke="#C8102E" stroke-width="6"/></svg>
EN
</span>
</button>
</div>
</div>