Added language files for spanish, default is english

This commit is contained in:
absurdo 2023-12-18 21:14:44 +01:00
parent 2f1d79ffc4
commit 9cd3ada7b4
9 changed files with 183 additions and 16 deletions

View file

@ -2,12 +2,16 @@ from settings import config
from flask import g, url_for
from paramecio2.modules.admin.models.admin import UserAdmin
from paramecio2.libraries.generate_admin_class import GenerateAdminClass
from paramecio2.libraries.i18n import I18n
from paramecio2.libraries.i18n import I18n, PGetText
from paramecio2.libraries.db.coreforms import SelectForm
from paramecio2.libraries.db.coreforms import HiddenForm
import copy
from paramecio2.modules.admin import admin_app, t as admin_t
pgettext=PGetText(__file__+'/../')
_=pgettext.gettext
t=copy.copy(admin_t)
@admin_app.route('/admin/ausers/', methods=['GET', 'POST'])
@ -29,15 +33,15 @@ def ausers():
user_admin.create_forms(['username', 'password', 'email', 'privileges', 'lang', 'dark_theme', 'disabled', 'double_auth', 'last_login'])
user_admin.forms['privileges'].arr_select={0: I18n.lang('admin', 'without_privileges', 'Without privileges'), 1: I18n.lang('admin', 'selected_privileges', 'Selected privileges'), 2: I18n.lang('admin', 'administrator', 'Administrator')}
user_admin.forms['privileges'].arr_select={0: _('Without privileges'), 1: _('Selected privileges'), 2: _('Administrator')}
user_admin.forms['disabled'].arr_select={0: I18n.lang('admin', 'user_enabled', 'User enabled'), 1: I18n.lang('admin', 'user_disabled', 'User disabled')}
user_admin.forms['disabled'].arr_select={0: _('User enabled'), 1: _('User disabled')}
user_admin.forms['double_auth'].arr_select={0: I18n.lang('admin', 'no', 'No'), 1: I18n.lang('admin', 'yes', 'Yes')}
user_admin.forms['double_auth'].arr_select={0: _('No'), 1: _('Yes')}
user_admin.fields['password'].protected=False
user_admin.forms['dark_theme'].arr_select={0: I18n.lang('admin', 'light_theme', 'Light theme'), 1: I18n.lang('admin', 'dark_theme', 'Dark theme')}
user_admin.forms['dark_theme'].arr_select={0: _('Light theme'), 1: _('Dark theme')}
user_admin.check_user=False
user_admin.check_email=False
@ -56,7 +60,7 @@ def ausers():
if type(form_admin).__name__=='str':
return t.load_template('content.phtml', title=I18n.lang('admin', 'users_edit', 'Users edit'), contents=form_admin, path_module='admin_app.ausers')
return t.load_template('content.phtml', title=_('Users edit'), contents=form_admin, path_module='admin_app.ausers')
else:
return form_admin