## Summary - Change Persian `mark_done` label from تایید چاپ to چاپ شد ## Test plan - [ ] Print Queue in FA shows چاپ شد on the done button Reviewed-on: #6 Co-authored-by: Diaco Soltanpour <dyaco8464@yahoo.com> Co-committed-by: Diaco Soltanpour <dyaco8464@yahoo.com>
131 lines
4.5 KiB
JavaScript
131 lines
4.5 KiB
JavaScript
const translations = {
|
|
'en': {
|
|
'app_title': 'Lithium Label Manager',
|
|
'data_entry': 'Data Entry',
|
|
'print_queue': 'Print Queue',
|
|
'calibrate': 'Calibrate',
|
|
'new_order': 'New Order',
|
|
'product': 'Product',
|
|
'add_product': '+ Add New Product',
|
|
'product_code': 'Product Code',
|
|
'description': 'Description',
|
|
'default_weight': 'Default Weight',
|
|
'save': 'Save',
|
|
'cancel': 'Cancel',
|
|
'batch_number': 'Batch #',
|
|
'date': 'Date',
|
|
'next_control': 'Next Control Date',
|
|
'net_weight': 'Net Weight (kg)',
|
|
'total_weight': 'Total Weight (kg)',
|
|
'canister_weight': 'Canister Weight (kg)',
|
|
'canisters_per_box': 'Canisters per Box',
|
|
'labels_preview': 'Labels Generated',
|
|
'canisters': 'Canisters',
|
|
'boxes': 'Boxes',
|
|
'canisters_unit': 'Canisters',
|
|
'boxes_unit': 'Boxes',
|
|
'pages_unit': 'Page(s)',
|
|
'pages_needed': 'Pages Needed',
|
|
'total_pages': 'Pages',
|
|
'status_pending': 'Pending',
|
|
'add_to_queue': 'Add to Print Queue',
|
|
'recent_orders': 'Recent Orders',
|
|
'status': 'Status',
|
|
'no_orders': 'No orders yet',
|
|
'no_pending_orders': 'No pending orders to print.',
|
|
'print': 'Print',
|
|
'mark_done': 'Mark Done',
|
|
'print_history': 'Print History',
|
|
'printed_at': 'Printed At',
|
|
'no_history': 'No print history'
|
|
},
|
|
'fa': {
|
|
'app_title': 'مدیریت برچسب لیتیوم',
|
|
'data_entry': 'ثبت اطلاعات',
|
|
'print_queue': 'صف چاپ',
|
|
'calibrate': 'کالیبراسیون',
|
|
'new_order': 'سفارش جدید',
|
|
'product': 'محصول',
|
|
'add_product': '+ افزودن محصول جدید',
|
|
'product_code': 'کد محصول',
|
|
'description': 'شرح',
|
|
'default_weight': 'وزن پیشفرض',
|
|
'save': 'ذخیره',
|
|
'cancel': 'لغو',
|
|
'batch_number': 'شماره بچ',
|
|
'date': 'تاریخ',
|
|
'next_control': 'تاریخ کنترل بعدی',
|
|
'net_weight': 'وزن خالص (کیلوگرم)',
|
|
'total_weight': 'وزن کل (کیلوگرم)',
|
|
'canister_weight': 'وزن گالن (کیلوگرم)',
|
|
'canisters_per_box': 'تعداد گالن در هر کارتن',
|
|
'labels_preview': 'برچسبهای تولیدی',
|
|
'canisters': 'تعداد گالن',
|
|
'boxes': 'تعداد کارتن',
|
|
'canisters_unit': 'گالن',
|
|
'boxes_unit': 'کارتن',
|
|
'pages_unit': 'صفحه',
|
|
'pages_needed': 'تعداد صفحات',
|
|
'total_pages': 'صفحات',
|
|
'status_pending': 'در انتظار',
|
|
'add_to_queue': 'افزودن به صف چاپ',
|
|
'recent_orders': 'سفارشات اخیر',
|
|
'status': 'وضعیت',
|
|
'no_orders': 'سفارشی ثبت نشده',
|
|
'no_pending_orders': 'سفارشی در انتظار چاپ نیست.',
|
|
'print': 'چاپ',
|
|
'mark_done': 'چاپ شد',
|
|
'print_history': 'سابقه چاپ',
|
|
'printed_at': 'زمان چاپ',
|
|
'no_history': 'سابقهای وجود ندارد'
|
|
}
|
|
};
|
|
|
|
let currentLang = localStorage.getItem('slip_lang') || 'en';
|
|
|
|
function applyLanguage(lang) {
|
|
document.documentElement.lang = lang;
|
|
|
|
document.querySelectorAll('[data-i18n]').forEach(el => {
|
|
const key = el.getAttribute('data-i18n');
|
|
if (translations[lang][key]) {
|
|
el.textContent = translations[lang][key];
|
|
}
|
|
});
|
|
|
|
const toggleBtn = document.getElementById('lang-label');
|
|
if (toggleBtn) {
|
|
toggleBtn.textContent = lang === 'en' ? '🇮🇷 FA' : '🇬🇧 EN';
|
|
}
|
|
|
|
// User requested Persian to be LTR, so we don't change the dir attribute
|
|
// document.documentElement.dir = lang === 'fa' ? 'rtl' : 'ltr';
|
|
}
|
|
|
|
function toggleLanguage() {
|
|
currentLang = currentLang === 'en' ? 'fa' : 'en';
|
|
localStorage.setItem('slip_lang', currentLang);
|
|
applyLanguage(currentLang);
|
|
}
|
|
|
|
// Common Toast notification
|
|
function showToast(message, isError = false) {
|
|
const toast = document.getElementById('toast');
|
|
if (!toast) return;
|
|
|
|
toast.textContent = message;
|
|
if (isError) {
|
|
toast.classList.add('error');
|
|
} else {
|
|
toast.classList.remove('error');
|
|
}
|
|
|
|
toast.classList.add('show');
|
|
setTimeout(() => toast.classList.remove('show'), 3000);
|
|
}
|
|
|
|
// Initialize on load
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
applyLanguage(currentLang);
|
|
});
|