ldap-python-webui/libs/localization.py

97 lines
5.1 KiB
Python
Raw Normal View History

2022-09-11 19:28:52 +02:00
import os
2022-04-16 23:13:00 +02:00
import gettext
class LocalizeTo(object):
"""docstring for Session"""
def __init__(self, lang, conf):
super(LocalizeTo, self).__init__()
2022-09-10 16:04:55 +02:00
if not os.path.isdir(conf['locale']['dir'] + "/" + lang):
lang = conf['locale']['lang']
2022-04-16 23:13:00 +02:00
translate = gettext.translation('base', localedir=conf['locale']['dir'], languages=[lang])
translate.install()
_ = translate.gettext
#generic strings
str_00 = _("User")
str_01 = _("Username")
str_02 = _("Firstname")
str_03 = _("Surname")
str_04 = _("Password")
str_05 = _("Old password")
str_06 = _("New password")
str_07 = _("Confirm password")
str_08 = _("Email")
str_09 = _("edit")
str_10 = _("Login")
str_11 = _("Logout")
str_12 = _("Delete")
str_13 = _("Sign Up")
str_14 = _("Back")
str_15 = _("Update")
str_16 = _("Or Sign In")
str_17 = _("Or Sign Up")
str_18 = _("Invite code")
str_19 = _("Edit your fullname")
str_20 = _("Edit your email")
str_21 = _("Change your password")
str_22 = _("Delete your account")
str_23 = _("Welcome")
2023-04-07 15:21:44 +02:00
str_24 = _("Logs")
str_25 = _("Last login")
str_26 = _("Devices")
str_27 = _("show")
2023-11-24 20:06:38 +01:00
str_28 = _("Two factor authentication")
str_29 = _("Token")
str_30 = _("Disable")
str_31 = _("Enable")
2023-11-27 15:38:45 +01:00
str_32 = _("You must then use the key created by this QR code to log in. To get the key you must use a OTP or 2FA mobile app.")
str_33 = _("Two-step authentication is additional security. By enabling this you will be asked at the login, in addition to the user and password, a key you will need to create using QR code.")
2023-11-25 15:58:37 +01:00
str_34 = _("Code")
2022-04-16 23:13:00 +02:00
#messages
msg_00 = _("The session was closed.")
2022-04-25 17:20:59 +02:00
msg_01 = _("Welcome")
msg_02 = _("Username must be at least 3 characters long!")
msg_03 = _("Not allowed characters for the username field.")
msg_04 = _("Not allowed characters for the firstname field.")
msg_05 = _("Not allowed characters for the surname field.")
msg_06 = _("The code is invalid or has expired.")
2022-04-16 23:13:00 +02:00
msg_07 = _("Passwords do not match!")
2022-09-10 23:00:29 +02:00
msg_08 = _("The password must contain at least 8 characters, at least one number, a capital letter and a special character.")
2022-04-16 23:13:00 +02:00
msg_09 = _("Congratulations, your account has been created!")
msg_10 = _("Your first and last name have not been changed.")
msg_11 = _("Your firstname is a bit short, don't you think?")
msg_12 = _("Your surname is a bit short, don't you think?")
msg_13 = _("Your first and last name have been successfully updated.")
msg_14 = _("Invalid email address. Please try again.")
msg_15 = _("Email address has not been changed.")
msg_16 = _("Your email has been successfully updated.")
msg_17 = _("The password entered is the same as the current password.")
msg_18 = _("Password has been changed!")
msg_19 = _("Please, type your username for account deletion.")
msg_20 = _("Account successfully deleted!")
msg_21 = _("Username or password is incorrect!")
msg_22 = _("Unable to connect to the remote server.")
msg_23 = _("Encountered an unexpected error while communicating with the remote server.")
msg_24 = _("User already exists.")
msg_25 = _("Email already exists.")
msg_26 = _("Forgot your password? Please try again.")
msg_27 = _("The session has expired.")
2022-09-11 19:28:52 +02:00
msg_28 = _("Registration is currently closed. We apologize for the inconvenience.")
2023-11-24 23:31:01 +01:00
msg_29 = _("Two factor authentication has been impossible.")
msg_30 = _("Two factor authentication has been restored.")
msg_31 = _("Two factor authentication has been enabled.")
msg_32 = _("Two factor authentication has been disabled.")
msg_33 = _("Two factor authentication was already disabled.")
2023-04-07 15:21:44 +02:00
self.str = {'usr':str_00, 'usrn':str_01, 'fn':str_02, 'sn':str_03, 'pwd':str_04, 'old-pwd':str_05,
'new-pwd':str_06, 'conf-pwd':str_07, 'email':str_08, 'edit':str_09, 'login':str_10, 'log-out':str_11,
'del':str_12, 'sign-up':str_13, 'back':str_14, 'update':str_15, 'or-sign-in':str_16,
'or-sign-up':str_17, 'inv-code':str_18, 'edit-fn':str_19, 'edit-email':str_20, 'ch-pwd':str_21,
'del-account':str_22, 'welcome':str_23, 'logs':str_24, 'last-login':str_25, 'devices':str_26,
2023-11-24 20:06:38 +01:00
'show':str_27, '2fa-title':str_28, 'token':str_29, 'disable':str_30, 'enable':str_31, '2fa-info-1':str_32,
2023-11-25 15:58:37 +01:00
'2fa-info-2':str_33, 'code':str_34, 'pwd-pattern': msg_08}
2023-11-24 23:31:01 +01:00
self.msg = (msg_00, msg_01, msg_02, msg_03, msg_04, msg_05, msg_06, msg_07, msg_08, msg_09, msg_10, msg_11,
msg_12, msg_13, msg_14, msg_15, msg_16, msg_17, msg_18, msg_19, msg_20, msg_21, msg_22, msg_23,
msg_24, msg_25, msg_26, msg_27, msg_28, msg_29, msg_30, msg_31, msg_32, msg_33)