diff --git a/framework/LoginDialog/LoginDialog.bbj b/framework/LoginDialog/LoginDialog.bbj index 38e509c4..d898ce32 100644 --- a/framework/LoginDialog/LoginDialog.bbj +++ b/framework/LoginDialog/LoginDialog.bbj @@ -1,8 +1,4 @@ use ::BBjWidget/BBjWidget.bbj::BBjWidget -use ::WebKit/util/DynamicLoader.bbj::DynamicLoader -use ::WebKit/util/ClientUtil.bbj::ClientUtil -use ::WebKit/widgets/InputField/InputField.bbj::InputField -use ::WebKit/framework/LoginDialog/SampleAuthProvider.bbj::SampleAuthProvider use ::AuthKit/profile/GoogleAccountProfile.bbj::GoogleAccountProfile use ::AuthKit/profile/MicrosoftAccountProfile.bbj::MicrosoftAccountProfile use ::AuthKit/profile/AccountProfile.bbj::AccountProfile @@ -10,19 +6,25 @@ use ::AuthKit/widgets/GoogleLoginWidget.bbj::GoogleLoginWidget use ::AuthKit/widgets/MicrosoftLoginWidget.bbj::MicrosoftLoginWidget use ::AuthKit/totp/TOTP.bbj::TOTP +use ::WebKit/util/DynamicLoader.bbj::DynamicLoader +use ::WebKit/util/ClientUtil.bbj::ClientUtil + +use ::WebKit/widgets/InputField/InputField.bbj::InputField use ::WebKit/widgets/InputField/IFieldReq.bbj::IFieldReq use ::WebKit/widgets/InputField/DefaultFieldReq.bbj::DefaultFieldReq +use ::WebKit/widgets/InputField/IValidator.bbj::IValidator + +use ::WebKit/framework/LoginDialog/SampleAuthProvider.bbj::SampleAuthProvider use ::WebKit/framework/LoginDialog/IAuthProvider.bbj::IAuthProvider use ::WebKit/framework/LoginDialog/IAuthRenewPwProvider.bbj::IAuthRenewPwProvider use ::WebKit/framework/LoginDialog/LoginDialogBuilder.bbj::LoginDialogBuilder use ::WebKit/framework/LoginDialog/LoginDialogWindow.bbj::LoginDialogWindow - -use ::WebKit/widgets/InputField/IValidator.bbj::IValidator use ::WebKit/framework/LoginDialog/LoginInputValidator.bbj::UsernameValidator use ::WebKit/framework/LoginDialog/LoginInputValidator.bbj::PasswordValidator use ::WebKit/framework/LoginDialog/LoginInputValidator.bbj::NewPasswordValidator use ::WebKit/framework/LoginDialog/LoginInputValidator.bbj::RepeatPasswordValidator +use ::WebKit/i18n/I18n.bbj::I18n class public LoginDialog @@ -53,8 +55,6 @@ class public LoginDialog field public BBjString User$ = "" field private BBjString logoURL$ - - rem |||||| CONSTRUCTORS |||||| method public LoginDialog(BBjString title$, IAuthProvider authProvider!) bbjutils! = new ::BBUtils.bbj::BBUtils() @@ -80,8 +80,6 @@ class public LoginDialog methodend - - rem |||||| GETTER & SETTER |||||| method public void setLogo(BBjString logo$) #logoURL$ = logo$ methodend @@ -112,7 +110,6 @@ class public LoginDialog #passwordValidator = passwordValidator methodend - rem |||||| DO MODAL |||||| method public Boolean doModal() if #AllowRemember! then @@ -172,7 +169,6 @@ class public LoginDialog return methodend - rem |||||| CONTENT BUILDERS |||||| method public void buildLoginContent(LoginDialogWindow wnd!) #buildLoginContent(wnd!,"") methodend @@ -190,16 +186,18 @@ class public LoginDialog if #usernameValidator! = null() then #usernameValidator! = new UsernameValidator() if #passwordValidator! = null() then #passwordValidator! = new PasswordValidator() - LoginDialogBuilder.addUsernameInput(wnd!, #usernameValidator! , user$) - LoginDialogBuilder.addPasswordInput(wnd!, #passwordValidator!, "Password", "Your password") + LoginDialogBuilder.addUsernameInput(wnd!, new UsernameValidator(), user$) + LoginDialogBuilder.addPasswordInput(wnd!, new PasswordValidator(), I18n.getTranslation("password-upper"), I18n.getTranslation("your-password")) else LoginDialogBuilder.addUsernameInput(wnd!, null(), user$) - LoginDialogBuilder.addPasswordInput(wnd!, null(), "Password", "Your password") + LoginDialogBuilder.addPasswordInput(wnd!, null(), I18n.getTranslation("password"), I18n.getTranslation("your-password")) fi - if #AllowRemember! = Boolean.TRUE then LoginDialogBuilder.addRememberMeBox(wnd!) - LoginDialogBuilder.addSubmitButton(wnd!, "Login", "login") - + if #AllowRemember! then + LoginDialogBuilder.addRememberMeBox(wnd!) + fi + LoginDialogBuilder.addSubmitButton(wnd!, I18n.getTranslation("login-upper"), I18n.getTranslation("login")) + if #getLoginWithGoogle() OR #getLoginWithMicrosoft() then LoginDialogBuilder.addSSOZone(wnd!) if #getLoginWithGoogle() then @@ -211,17 +209,19 @@ class public LoginDialog fi - if #AllowForgotPw! = Boolean.TRUE then LoginDialogBuilder.addRedirect(wnd!, "Forgot your Password?", "gotoForgotPassword") + if #AllowForgotPw! = Boolean.TRUE then + LoginDialogBuilder.addRedirect(wnd!, I18n.getTranslation("forgot-your-password"), "gotoForgotPassword") + fi methodend method public void buildForgotPwContent(LoginDialogWindow wnd!, BBjString user$) LoginDialogBuilder.addLogo(wnd!,#logoURL$) - LoginDialogBuilder.addPageTitle(wnd!,"Request a new password") + LoginDialogBuilder.addPageTitle(wnd!,I18n.getTranslation("request-a-new-password")) if #isValidationEnabled! = Boolean.TRUE then if #usernameValidator! = null() then #usernameValidator! = new UsernameValidator() LoginDialogBuilder.addUsernameInput(wnd!, #usernameValidator! , user$) - LoginDialogBuilder.addPasswordInput(wnd!, #passwordValidator!, "Password", "Your password") + LoginDialogBuilder.addPasswordInput(wnd!, #passwordValidator!, I18n.getTranslation("password"), I18n.getTranslation("your-password")) else LoginDialogBuilder.addUsernameInput(wnd!, null(), user$) fi @@ -235,27 +235,30 @@ class public LoginDialog LoginDialogBuilder.addPageTitle(wnd!,title$) LoginDialogBuilder.addTextField(wnd!, response$) if retry! then - LoginDialogBuilder.addSubmitButton(wnd!, "Retry", methodName$) + LoginDialogBuilder.addSubmitButton(wnd!, I18n.getTranslation("retry"), methodName$) else - LoginDialogBuilder.addSubmitButton(wnd!, "Return to Login", "gotoLogin") + LoginDialogBuilder.addSubmitButton(wnd!, I18n.getTranslation("return-to-login"), "gotoLogin") endif methodend method public void buildNewPwContent(LoginDialogWindow wnd!, BBjString token!) LoginDialogBuilder.addLogo(wnd!, #logoURL$) - LoginDialogBuilder.addPageTitle(wnd!, "Choose a new password") + LoginDialogBuilder.addPageTitle(wnd!, I18n.getTranslation("choose-a-new-password")) if #isValidationEnabled! = Boolean.TRUE then - if #passwordValidator! = null() then #passwordValidator! = new NewPasswordValidator() - LoginDialogBuilder.addPasswordInput(wnd!, #passwordValidator!, "New Password", "new password", Boolean.TRUE) + if #passwordValidator! = null() then + #passwordValidator! = new NewPasswordValidator() + newPasswordText! = I18n.getTranslation("new-password") + LoginDialogBuilder.addPasswordInput(wnd!, #passwordValidator!, newPasswordText!, newPasswordText!, Boolean.TRUE) + fi else LoginDialogBuilder.addPasswordInput(wnd!, null(), "New Password", "new password", Boolean.TRUE) - fi - LoginDialogBuilder.addRepeatPasswordInput(wnd!, new RepeatPasswordValidator(), "Repeat Password", "repeat password") - LoginDialogBuilder.addSubmitButton(wnd!, "Set Password", "setPasswordWithToken") + fi + repeatPasswordText! = I18n.getTranslation("repeat-password") + LoginDialogBuilder.addRepeatPasswordInput(wnd!, new RepeatPasswordValidator(), repeatPasswordText!, repeatPasswordText!) + LoginDialogBuilder.addSubmitButton(wnd!, I18n.getTranslation("set-password"), "setPasswordWithToken") methodend - rem |||||| REDIRECTS |||||| method public void gotoForgotPassword() if #authRenewPw! = null() then @@ -264,7 +267,7 @@ class public LoginDialog #loginWindow! = null() endif #responseWindow! = new LoginDialogWindow(#this!, #loginWrapper!) - #buildResponseContent(#responseWindow!, "", "Something went wrong" ,"It seems you cannot use this functionality.", Boolean.FALSE, "") + #buildResponseContent(#responseWindow!, "", I18n.getTranslation("something-went-wrong") , I18n.getTranslation("it-seems-you-cannot-use-this-functionality"), Boolean.FALSE, "") else declare BBjString user$ @@ -333,7 +336,7 @@ class public LoginDialog endif #responseWindow! = new LoginDialogWindow(#this!, #loginWrapper!) - #buildResponseContent(#responseWindow!, username$, "Password token sent" ,response$, Boolean.FALSE, "") + #buildResponseContent(#responseWindow!, username$, I18n.getTranslation("password-token-sent") ,response$, Boolean.FALSE, "") methodend method public void setPasswordWithToken(BBjString password$) @@ -347,10 +350,10 @@ class public LoginDialog if response! then #responseWindow! = new LoginDialogWindow(#this!, #loginWrapper!) - #buildResponseContent(#responseWindow!, username$, "Password been changed" , "You may now login with your new user credentials.", Boolean.FALSE, "") + #buildResponseContent(#responseWindow!, username$, I18n.getTranslation("password-been-changed"), I18n.getTranslation("you-may-now-login-with-your-new-user-credentials"), Boolean.FALSE, "") else #responseWindow! = new LoginDialogWindow(#this!, #loginWrapper!) - #buildResponseContent(#responseWindow!, username$, "Something went wrong" , "Password has not been reset. Please try again", Boolean.TRUE, "gotoNewPassword") + #buildResponseContent(#responseWindow!, username$, I18n.getTranslation("something-went-wrong"), I18n.getTranslation("password-has-not-been-reset-please-try-again") , Boolean.TRUE, "gotoNewPassword") endif methodend @@ -369,4 +372,4 @@ l!.setAllowRemember(Boolean.TRUE) if l!.doModal() then a=msgbox(l!.getUser(),0,"SUCCESS") -fi \ No newline at end of file +fi diff --git a/framework/LoginDialog/LoginDialogBuilder.bbj b/framework/LoginDialog/LoginDialogBuilder.bbj index 2ff9c35d..0092227d 100644 --- a/framework/LoginDialog/LoginDialogBuilder.bbj +++ b/framework/LoginDialog/LoginDialogBuilder.bbj @@ -1,10 +1,12 @@ rem use ::WebKit/framework/LoginDialog/LoginDialog.bbj::LoginDialog +use ::BBjWidget/BBjWidget.bbj::BBjWidget + use ::WebKit/framework/LoginDialog/LoginDialogWindow.bbj::LoginDialogWindow use ::WebKit/widgets/InputField/InputField.bbj::InputField use ::WebKit/widgets/InputField/extensions/PasswordField.bbj::PasswordField use ::WebKit/widgets/InputField/extensions/TextField.bbj::TextField -use ::BBjWidget/BBjWidget.bbj::BBjWidget use ::WebKit/widgets/common/Overlay/Overlay.bbj::Overlay + use ::WebKit/util/ClientUtil.bbj::ClientUtil use ::WebKit/widgets/InputField/IValidator.bbj::IValidator @@ -13,6 +15,8 @@ use ::WebKit/framework/LoginDialog/LoginInputValidator.bbj::PasswordValidator use ::WebKit/framework/LoginDialog/LoginInputValidator.bbj::NewPasswordValidator use ::WebKit/framework/LoginDialog/LoginInputValidator.bbj::RepeatPasswordValidator +use ::WebKit/i18n/I18n.bbj::I18n + use ::AuthKit/widgets/GoogleLoginWidget.bbj::GoogleLoginWidget use ::AuthKit/widgets/MicrosoftLoginWidget.bbj::MicrosoftLoginWidget @@ -49,9 +53,9 @@ class public LoginDialogBuilder extends BBjWidget dialog!.getUsername().setInput(user$) endif - dialog!.getUsername().setLabel("Username") - dialog!.getUsername().setPlaceHolder("name@company.com") - dialog!.getUsername().setSuffix("user") + dialog!.getUsername().setLabel(I18n.getTranslation("username-upper")) + dialog!.getUsername().setPlaceHolder(I18n.getTranslation("name-company-com")) + dialog!.getUsername().setSuffix(I18n.getTranslation("user")) rem dialog!.getUsername().getInputField().setCallback(BBjAPI.ON_EDIT_MODIFY, dialog!, "validateUsername") methodend @@ -83,7 +87,8 @@ class public LoginDialogBuilder extends BBjWidget methodend method public static void addRememberMeBox(LoginDialogWindow dialog!) - dialog!.setRememberMe(dialog!.getContent().addCheckBox(dialog!.getContent().getAvailableControlID(),0,0,0,0,"Keep me signed in")) + content! = dialog!.getContent() + dialog!.setRememberMe(content!.addCheckBox(content!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("keep-mesigned-in"))) dialog!.getRememberMe().setStyle("margin-top","20px") dialog!.getRememberMe().setStyle("margin-bottom","20px") diff --git a/framework/PortalFrame/PortalFrame.bbj b/framework/PortalFrame/PortalFrame.bbj index 8ea274af..7ad2992a 100644 --- a/framework/PortalFrame/PortalFrame.bbj +++ b/framework/PortalFrame/PortalFrame.bbj @@ -14,6 +14,8 @@ use ::WebKit/widgets/Drawer/Drawer.bbj::Drawer use ::WebKit/model/DrawerMenuTileEntry.bbj::DrawerMenuTileEntry use ::WebKit/widgets/TilesTextHeader/TilesTextHeader.bbj::TilesTextHeader use ::WebKit/model/DrawerModel.bbj::DrawerModel + +use ::WebKit/i8n/I18n.bbj::I18n use java.util.HashMap class public PortalFrame diff --git a/i18n/I18n.bbj b/i18n/I18n.bbj new file mode 100644 index 00000000..9c8cbd70 --- /dev/null +++ b/i18n/I18n.bbj @@ -0,0 +1,17 @@ +use ::translations/bbtranslator.bbj::BBTranslator + +class public I18n + + field public static Boolean SelfLearningTranslations! = Boolean.FALSE + field public static BBTranslator Translator! = BBTranslator.getInstance("webkit", STBL("!LOCALE"), "", "WebKit/i18n") + + method public static BBjString getTranslation(BBjString key$) + if #SelfLearningTranslations! then + #Translator!.clearCache() + methodret #Translator!.getTranslation(key$,key$,1) + else + methodret #Translator!.getTranslation(key$) + fi + methodend + +classend \ No newline at end of file diff --git a/i18n/webkit.properties b/i18n/webkit.properties new file mode 100644 index 00000000..ffe0675e --- /dev/null +++ b/i18n/webkit.properties @@ -0,0 +1,25 @@ +# +#Thu Dec 16 15:25:15 CET 2021 +choose-a-new-password=Choose a new password +forgot-your-password=Forgot your Password? +it-seems-you-cannot-use-this-functionality=It seems you cannot use this functionality. +keep-mesigned-in=Keep me signed in +login=login +login-upper=Login +name-company-com=name@company.com +new-password=New Password +password=password +password-been-changed=Password has been changed +password-token-sent=Password token sent +password-upper=Password +repeat-password=Repeat Password +request-a-new-password=Request a new password +retry=Retry +return-to-login=Return to Login +send-email=Send Email +set-password=Set Password +something-went-wrong=Something went wrong +user=user +username-upper=Username +you-may-now-login-with-your-new-user-credentials=You may now log in with your new user credentials. +your-password=your password diff --git a/i18n/webkit_de.properties b/i18n/webkit_de.properties new file mode 100644 index 00000000..05edf12e --- /dev/null +++ b/i18n/webkit_de.properties @@ -0,0 +1,25 @@ +# +#Thu Dec 16 15:25:15 CET 2021 +choose-a-new-password=W\u00E4hlen Sie ein neues Passwort +forgot-your-password=Passwort vergessen? +it-seems-you-cannot-use-this-functionality=Es scheint, dass Sie diese Funktion nicht nutzen k\u00F6nnen. +keep-mesigned-in=Angemeldet bleiben +login=anmelden +login-upper=Login +name-company-com=name@firma.com +new-password=Neues Password +password=Passwort +password-been-changed=Das Passwort wurde ge\u00E4ndert +password-token-sent=Das Passwort-Token wurde gesendet +password-upper=Passwort +repeat-password=Passwort wiederholen +request-a-new-password=Ein neues Passwort anfordern +retry=Erneut versuchen +return-to-login=Zur\u00C3\u00BCck zum Login +send-email=E-Mail senden +set-password=Passwort festlegen +something-went-wrong=Etwas ist schief gelaufen +user=Benutzer +username-upper=Benutzername +you-may-now-login-with-your-new-user-credentials=Sie k\u00F6nnen sich nun mit Ihren neuen Benutzerdaten anmelden. +your-password=dein Passwort diff --git a/i18n/webkit_en.properties b/i18n/webkit_en.properties new file mode 100644 index 00000000..ffe0675e --- /dev/null +++ b/i18n/webkit_en.properties @@ -0,0 +1,25 @@ +# +#Thu Dec 16 15:25:15 CET 2021 +choose-a-new-password=Choose a new password +forgot-your-password=Forgot your Password? +it-seems-you-cannot-use-this-functionality=It seems you cannot use this functionality. +keep-mesigned-in=Keep me signed in +login=login +login-upper=Login +name-company-com=name@company.com +new-password=New Password +password=password +password-been-changed=Password has been changed +password-token-sent=Password token sent +password-upper=Password +repeat-password=Repeat Password +request-a-new-password=Request a new password +retry=Retry +return-to-login=Return to Login +send-email=Send Email +set-password=Set Password +something-went-wrong=Something went wrong +user=user +username-upper=Username +you-may-now-login-with-your-new-user-credentials=You may now log in with your new user credentials. +your-password=your password