Fixes in lang
This commit is contained in:
parent
464754f5d3
commit
9be42a2a4b
9 changed files with 77 additions and 91 deletions
|
|
@ -68,9 +68,9 @@ def home_admin(session={}):
|
|||
|
||||
#s=get_session()
|
||||
|
||||
i18n=I18n('admin2')
|
||||
#i18n=I18n('admin2')
|
||||
|
||||
return t.load_template('layout.phtml', title=i18n.tlang('Admin'), module_selected='home_admin', session=session)
|
||||
return t.load_template('layout.phtml', title=_('Admin'), module_selected='home_admin', session=session)
|
||||
#return {}
|
||||
|
||||
|
||||
|
|
@ -103,9 +103,9 @@ def login_admin(session={}):
|
|||
|
||||
db.close()
|
||||
|
||||
i18n=I18n('admin2')
|
||||
#i18n=I18n('admin2')
|
||||
|
||||
return t.load_template('login.phtml', title=i18n.tlang('Login'))
|
||||
return t.load_template('login.phtml', title=_('Login'))
|
||||
|
||||
@admin_app.get('/signup', skip=[check_login], name='admin_app.signup_admin')
|
||||
def signup_admin(session={}):
|
||||
|
|
@ -120,20 +120,20 @@ def signup_admin(session={}):
|
|||
|
||||
db.close()
|
||||
|
||||
i18n=I18n('admin2')
|
||||
#i18n=I18n('admin2')
|
||||
|
||||
return t.load_template('signup.phtml', title=i18n.tlang('Signup'))
|
||||
return t.load_template('signup.phtml', title=_('Signup'))
|
||||
|
||||
@admin_app.post('/login', skip=[check_login], name='admin_app.check_login_admin')
|
||||
def check_login_admin(session={}):
|
||||
|
||||
db=WebModel.connection()
|
||||
|
||||
i18n=I18n('admin2')
|
||||
#i18n=I18n('admin2')
|
||||
|
||||
error=1
|
||||
|
||||
message=i18n.tlang('Invalid user and password')
|
||||
message=_('Invalid user and password')
|
||||
|
||||
no_login=check_login_tries(request, db)
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ def check_login_admin(session={}):
|
|||
|
||||
sendmail=SendMail(ssl=True)
|
||||
|
||||
sendmail.send(config.portal_email, [result['email']], i18n.tlang('Code for complete login'), i18n.tlang('We send to you a code for activate your account using double authentication:')+"\n"+token_auth, content_type='plain', attachments=[])
|
||||
sendmail.send(config.portal_email, [result['email']], _('Code for complete login'), _('We send to you a code for activate your account using double authentication:')+"\n"+token_auth, content_type='plain', attachments=[])
|
||||
|
||||
if result['privileges']==0:
|
||||
with db.query('select module from privilegesmodule2 WHERE user_id=%s', [result['id']]) as cursor:
|
||||
|
|
@ -221,7 +221,7 @@ def check_login_admin(session={}):
|
|||
@admin_app.post('/signup', skip=[check_login], name='admin_app.signup_insert_admin')
|
||||
def signup_insert_admin(session={}):
|
||||
|
||||
i18n=I18n('admin2')
|
||||
#i18n=I18n('admin2')
|
||||
|
||||
error=1
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ def signup_insert_admin(session={}):
|
|||
error=0
|
||||
message="User added!"
|
||||
else:
|
||||
message=i18n.tlang('Sorry, cannot create the new user')
|
||||
message=_('Sorry, cannot create the new user')
|
||||
|
||||
db.close()
|
||||
|
||||
|
|
@ -315,9 +315,9 @@ def change_theme(session={}):
|
|||
@admin_app.get('/need_auth', skip=[check_login], name='admin_app.need_auth')
|
||||
def need_auth(session={}):
|
||||
|
||||
i18n=I18n('admin2')
|
||||
#i18n=I18n('admin2')
|
||||
|
||||
return t.load_template('need_auth.phtml', title=i18n.tlang('Auth check'))
|
||||
return t.load_template('need_auth.phtml', title=_('Auth check'))
|
||||
|
||||
@admin_app.post('/auth_check', skip=[check_login], name='admin_app.auth_check')
|
||||
def auth_check(session={}):
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ env=env_theme(__file__)
|
|||
|
||||
t=PTemplate(env)
|
||||
|
||||
i18n=I18n('admin2')
|
||||
#i18n=I18n('admin2')
|
||||
|
||||
gtext=PGetText(__file__)
|
||||
|
||||
|
|
@ -59,11 +59,11 @@ def admin_users(session={}):
|
|||
|
||||
user_admin.create_forms(['username', 'password', 'email', 'privileges', 'lang', 'dark_theme', 'double_auth'])
|
||||
|
||||
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['dark_theme'].arr_select={0: i18n.tlang('Light theme'), 1: i18n.tlang('Dark theme')}
|
||||
user_admin.forms['dark_theme'].arr_select={0: _('Light theme'), 1: _('Dark theme')}
|
||||
|
||||
user_admin.forms['double_auth'].arr_select={0: i18n.tlang('No'), 1: i18n.tlang('Yes')}
|
||||
user_admin.forms['double_auth'].arr_select={0: _('No'), 1: _('Yes')}
|
||||
|
||||
user_admin.fields['password'].protected=False
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ def admin_users(session={}):
|
|||
|
||||
db.close()
|
||||
|
||||
return t.load_template('users.phtml', title=i18n.tlang('Admin users'), tlang=i18n.tlang, module_selected='admin_app.admin_users', slist=slist, session=session)
|
||||
return t.load_template('users.phtml', title=_('Admin users'), tlang=_, module_selected='admin_app.admin_users', slist=slist, session=session)
|
||||
|
||||
@admin_app.get('/ausers/permissions/<user_id:int>', name="admin_app.admin_permissions")
|
||||
@admin_app.post('/ausers/permissions/<user_id:int>', name="admin_app.admin_permissions")
|
||||
|
|
@ -129,18 +129,18 @@ def admin_permissions(user_id, session={}):
|
|||
privileges_admin=admin.show()
|
||||
|
||||
else:
|
||||
arr_user={'username': i18n.tlang('User not found')}
|
||||
arr_user={'username': _('User not found')}
|
||||
privileges_admin=''
|
||||
|
||||
db.close()
|
||||
|
||||
return t.load_template('access.phtml', title=i18n.tlang('Users permissions'), privileges_admin=privileges_admin, user=arr_user, module_selected='admin_app.admin_users')
|
||||
return t.load_template('access.phtml', title=_('Users permissions'), privileges_admin=privileges_admin, user=arr_user, module_selected='admin_app.admin_users')
|
||||
|
||||
def user_options(url, id, arr_row):
|
||||
|
||||
options=[]
|
||||
options.append('<a href="'+add_get_parameters(url, op_admin=1, id=id)+'">'+I18n.lang('common', 'edit', 'Edit')+'</a>')
|
||||
options.append('<a href="'+add_get_parameters(url, op_admin=1, id=id)+'">'+_('Edit')+'</a>')
|
||||
if not arr_row['privileges']:
|
||||
options.append(f'<a href="{app.get_url('admin_app.admin_permissions', user_id=id)}">'+i18n.tlang('User access')+'</a>')
|
||||
options.append('<a href="'+add_get_parameters(url, op_admin=3, id=id)+'">'+I18n.lang('common', 'delete', 'Delete')+'</a>')
|
||||
options.append(f'<a href="{app.get_url('admin_app.admin_permissions', user_id=id)}">'+_('User access')+'</a>')
|
||||
options.append('<a href="'+add_get_parameters(url, op_admin=3, id=id)+'">'+_('Delete')+'</a>')
|
||||
return options
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue