Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/translations #171

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use ::WebKit/model/ListView/Cell.bbj::Cell
use ::WebKit/framework/ListOverviewPanel/ListOverviewPanel.bbj::ListOverviewPanel
use ::WebKit/framework/FormControlPanel/FormControlPanel.bbj::FormControlPanel
use ::WebKit/widgets/ListView/ListView.bbj::ListView
use ::WebKit/i18n/i18n.bbj::I18n

use java.util.HashMap
use com.basiscomponents.db.ResultSet
Expand Down Expand Up @@ -46,12 +47,12 @@ class public ChileCompanyDashboardPanel extends BBjWidget
addr_field! = new Field("BILL_ADDR1", "ADDRESS")
addr_field!.setCustomCssClass("listTitleField")


translator! = I18n.getTranslator("ChileCompany","WebKit/demo/ChileCompanyCustomerPortal/i18n")
firstColumnFields! = new BBjVector()
firstColumnFields!.add(displayName_field!)
firstColumnFields!.add(city_field!)
firstColumnCell! = new Cell(firstColumnFields!)
firstColumn! = new ListColumnModel("Your Reference", 1)
firstColumn! = new ListColumnModel(translator!.getTranslation("your_reference"), 1)
firstColumn!.setColumnWidth("50%")
firstColumn!.setCellStructure(firstColumnCell!)

Expand Down
24 changes: 13 additions & 11 deletions framework/AuthSecurityPanel/AuthSecurityPanel.bbj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use ::BBjWidget/BBjWidget.bbj::BBjWidget
use ::AuthKit/totp/TOTP.bbj::TOTP
use ::QRCodes/QRCodes.bbj::QRCodes

use ::WebKit/i18n/I18n.bbj::I18n


class public AuthSecurityPanel extends BBjWidget

Expand Down Expand Up @@ -45,19 +47,19 @@ class public AuthSecurityPanel extends BBjWidget
canvas!.setPanelStyle("padding","20px")
canvas!.setDockStyle("overflow","auto")

IconCtrl! = canvas!.addStaticText(canvas!.getAvailableControlID(),0,0,200,22,"security")
IconCtrl! = canvas!.addStaticText(canvas!.getAvailableControlID(),0,0,200,22,I18n.getTranslation("security"))
IconCtrl!.addStyle("material-icons")
IconCtrl!.setStyle("font-size","50px")
IconCtrl!.setStyle("padding-right","50px")
Headline! = canvas!.addStaticText(canvas!.getAvailableControlID(),0,0,0,0,"Security Settings")
Headline! = canvas!.addStaticText(canvas!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("security_settings"))
Headline!.addStyle("tilesheadline")

options_panel! = canvas!.addChildWindow(canvas!.getAvailableControlID(),0,0,200,80,"",$00100800$,BBjAPI().getSysGui().getAvailableContext())
options_panel!.setDockStyle("margin-top","10px")
options_panel!.setPanelStyle("display","grid")
options_panel!.setPanelStyle("gap","10px")

cb_totp! = options_panel!.addCheckBox(options_panel!.getAvailableControlID(),0,0,0,0,"Add MFA Authenticor App")
cb_totp! = options_panel!.addCheckBox(options_panel!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("add_authenticator_app"))
cb_totp!.setCallback(BBjAPI.ON_CHECK_ON,#this!,"showTOTPPanel")
cb_totp!.setCallback(BBjAPI.ON_CHECK_OFF,#this!,"hideTOTPPanel")

Expand All @@ -69,7 +71,7 @@ class public AuthSecurityPanel extends BBjWidget
#TOTPPanel!.setPanelStyle("border","1px dotted")
#TOTPPanel!.setPanelStyle("padding","10px")

#TOTPPanel!.addStaticText(#TOTPPanel!.getAvailableControlID(),0,0,0,0,"Scan the QR code with your authenticator app. Then enter the code it displays to activate MFA using your App.")
#TOTPPanel!.addStaticText(#TOTPPanel!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("scan_instructions"))

#TOTPSecret! = TOTP.generateSecretKey()
url$=TOTP.getAuthenticatorBarCode(#TOTPSecret!,#TOTPAppAccount!,#TOTPAppIssuer!)
Expand All @@ -78,7 +80,7 @@ class public AuthSecurityPanel extends BBjWidget
qrimg! = BBjAPI().getSysGui().getImageManager().loadImageFromBytes(bytes!)
#TOTPQRCode! = CAST(BBjImageCtrl,#TOTPPanel!.addImageCtrl(#TOTPPanel!.getAvailableControlID(),390,30,200,200,qrimg!))

st!=#TOTPPanel!.addStaticText(#TOTPPanel!.getAvailableControlID(),0,0,0,0,"After Scanning, enter the code shown in the app:")
st!=#TOTPPanel!.addStaticText(#TOTPPanel!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("after_scanning"))

sub! = #TOTPPanel!.addChildWindow(#TOTPPanel!.getAvailableControlID(),0,0,200,80,"",$00100800$,BBjAPI().getSysGui().getAvailableContext())
sub!.setPanelStyle("display","flex")
Expand All @@ -87,32 +89,32 @@ class public AuthSecurityPanel extends BBjWidget
#TOTPTestCode! = CAST(BBjInputE,sub!.addInputE(sub!.getAvailableControlID(),0,0,0,0,"","000000"))
#TOTPTestCode!.setStyle("margin","10px")

#TOTPActivateButton! = CAST(BBjButton,sub!.addButton(sub!.getAvailableControlID(),0,0,0,0,"Test and Activate"))
#TOTPActivateButton! = CAST(BBjButton,sub!.addButton(sub!.getAvailableControlID(),0,0,0,0, I18n.getTranslation("test_and_activate")))
#TOTPActivateButton!.setAttribute("theme","default")
#TOTPActivateButton!.setAttribute("expanse","l")
#TOTPActivateButton!.setStyle("margin","10px")
#TOTPActivateButton!.setCallback(BBjAPI.ON_BUTTON_PUSH,#this!,"TestAndActivateTOTP")

cb_sms! = options_panel!.addCheckBox(options_panel!.getAvailableControlID(),0,0,0,0,"Add SMS Verification")
cb_sms! = options_panel!.addCheckBox(options_panel!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("add_sms_verification"))
cb_sms!.setCallback(BBjAPI.ON_CHECK_ON,#this!,"showSMSPanel")
cb_sms!.setCallback(BBjAPI.ON_CHECK_OFF,#this!,"hideSMSPanel")

#SMSPanel! = CAST(BBjChildWindow,options_panel!.addChildWindow(options_panel!.getAvailableControlID(),0,0,200,80,"",$00100810$,BBjAPI().getSysGui().getAvailableContext()))
#SMSPanel!.setDockStyle("margin-top","10px")
#SMSPanel!.addPanelStyle("smsPanel")

#SMSPanel!.addStaticText(#SMSPanel!.getAvailableControlID(),0,0,0,0,"Enter your Cell Phone Number and hit 'Verify'. Then enter the code you receive to activate MFA using SMS:")
#SMSPanel!.addStaticText(#SMSPanel!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("enter_cellphone"))

sub! = #SMSPanel!.addChildWindow(#SMSPanel!.getAvailableControlID(),0,0,200,80,"",$00100800$,BBjAPI().getSysGui().getAvailableContext())
sub!.setPanelStyle("display","inline-grid")
sub!.setPanelStyle("grid-template-columns","1fr 1fr 1fr")

sub!.addStaticText(sub!.getAvailableControlID(),0,0,0,0,"Enter your Cell Number:")
sub!.addStaticText(sub!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("enter_cell_number"))

#SMSCellNumber! = CAST(BBjInputE,sub!.addInputE(sub!.getAvailableControlID(),0,0,0,0,"","+00000000000000"))
#SMSCellNumber!.setStyle("margin","10px")

#SMSSendButton! = CAST(BBjButton,sub!.addButton(sub!.getAvailableControlID(),0,0,0,0,"Send Code"))
#SMSSendButton! = CAST(BBjButton,sub!.addButton(sub!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("send_code")))
#SMSSendButton!.setAttribute("theme","default")
#SMSSendButton!.setAttribute("expanse","l")
#SMSSendButton!.setStyle("margin","10px")
Expand All @@ -124,7 +126,7 @@ class public AuthSecurityPanel extends BBjWidget
#SMSTestCode! = CAST(BBjInputE,sub!.addInputE(sub!.getAvailableControlID(),0,0,0,0,$0001$,"000000"))
#SMSTestCode!.setStyle("margin","10px")

#SMSActivateButton! = CAST(BBjButton,sub!.addButton(sub!.getAvailableControlID(),0,0,0,0,"Verify and Activate",$0001$))
#SMSActivateButton! = CAST(BBjButton,sub!.addButton(sub!.getAvailableControlID(),0,0,0,0,I18n.getTranslation("verify_and_activate"),$0001$))
#SMSActivateButton!.setAttribute("theme","default")
#SMSActivateButton!.setAttribute("expanse","l")
#SMSActivateButton!.setStyle("margin","10px")
Expand Down
4 changes: 3 additions & 1 deletion framework/DialogPanel/DialogPanel.bbj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use ::WebKit/util/Icons.bbj::Icons
use ::WebKit/util/DynamicLoader.bbj::DynamicLoader
use ::WebKit/widgets/common/Divider/Divider.bbj::Divider

use ::WebKit/i18n/I18n.bbj::I18n

class public DialogPanel extends BBjWidget
field private BBjChildWindow dialogWnd!
field private BBjWindow parent!
Expand All @@ -21,7 +23,7 @@ class public DialogPanel extends BBjWidget
field private BBjButton submitBtn!
field private BBjButton cancelBtn!

field private BBjString submitBtnText$ = "Submit"
field private BBjString submitBtnText$ = I18n.getTranslation("submit")
field private BBjString submitBtnTheme$ = "primary"
field private BBjString submitBtnCustomCssClass$ = "footerBtn"
field public static BBjNumber ON_SUBMIT = 1234
Expand Down
8 changes: 4 additions & 4 deletions framework/LoginDialog/LoginDialog.bbj
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ class public LoginDialog
else
LoginDialogBuilder.addUsernameInput(wnd!, null(), user$)
fi
LoginDialogBuilder.addSubmitButton(wnd!, "Send Email", "requestForgotPasswordToken")
LoginDialogBuilder.addRedirect(wnd!, "Return to Login", "gotoLogin")
LoginDialogBuilder.addSubmitButton(wnd!, I18n.getTranslation("send-email"), "requestForgotPasswordToken")
LoginDialogBuilder.addRedirect(wnd!, I18n.getTranslation("return-to-login"), "gotoLogin")
methodend

method public void buildResponseContent(LoginDialogWindow wnd!, BBjString memory$, BBjString title$, BBjString response$, Boolean retry!, BBjString methodName$ )
Expand All @@ -257,14 +257,14 @@ class public LoginDialog
method public void buildNewPwContent(LoginDialogWindow wnd!, BBjString token!)
LoginDialogBuilder.addLogo(wnd!, #logoURL$)
LoginDialogBuilder.addPageTitle(wnd!, I18n.getTranslation("choose-a-new-password"))
newPasswordText! = I18n.getTranslation("new-password")
if #isValidationEnabled! = Boolean.TRUE then
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)
LoginDialogBuilder.addPasswordInput(wnd!, null(), newPasswordText!, newPasswordText!, Boolean.TRUE)
fi
repeatPasswordText! = I18n.getTranslation("repeat-password")
LoginDialogBuilder.addRepeatPasswordInput(wnd!, new RepeatPasswordValidator(), repeatPasswordText!, repeatPasswordText!)
Expand Down
25 changes: 5 additions & 20 deletions framework/LoginDialog/LoginDialogWindow.bbj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use ::WebKit/util/ClientUtil.bbj::ClientUtil

use ::WebKit/framework/LoginDialog/LoginDialog.bbj::LoginDialog

use ::WebKit/i18n/I18n.bbj::I18n

class public LoginDialogWindow extends BBjWidget

field private LoginDialog loginDialog!
Expand Down Expand Up @@ -134,7 +136,7 @@ class public LoginDialogWindow extends BBjWidget
newPassword! = #password!.getInput()
repeatPassword! = #repeatPassword!.getInput()
if newPassword! <> repeatPassword! then
#repeatPassword!.setErrorMessage("Passwords don't match")
#repeatPassword!.setErrorMessage(I18n.getTranslation("passwords_dont_match"))
else
#repeatPassword!.setErrorMessage("")
endif
Expand All @@ -144,30 +146,13 @@ class public LoginDialogWindow extends BBjWidget
endif
methodend

method public void validateRepeatPassword(BBjEditModifyEvent event!)
if #repeatPassword! = null() then
a = msgbox("Error that should not occur. -LoginDialogWindow-verifyRepeatPassword()")
rem GOTO LOGIN - break out method
endif

newPassword! = #password!.getInput()
repeatPassword! = #repeatPassword!.getInput()
if newPassword! <> repeatPassword! then
#repeatPassword!.setErrorMessage("Passwords don't match")
else
#repeatPassword!.setErrorMessage("")
endif

if repeatPassword! = "" then
#repeatPassword!.setErrorMessage("")
endif
methodend


method public void onBadLogin()
#username!.getInputField().addStyle("error")
#password!.getInputField().addStyle("error")
#password!.setInput("")
#password!.setErrorMessage("Invalid username and password combination")
#password!.setErrorMessage(I18n.getTranslation("invalid_username"))
#password!.setText("")

if len(#username!.getInputField().getText())=0 then
Expand Down
8 changes: 5 additions & 3 deletions framework/LoginDialog/LoginInputValidator.bbj
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use ::WebKit/widgets/InputField/IValidator.bbj::IValidator

use ::WebKit/i18n/I18n.bbj::I18n

class public UsernameValidator implements IValidator
method public BBjString validate(BBjString field!)
if field!.length() > 0 and field!.length() < 3 then
methodret "username too short"
methodret I18n.getTranslation("username_short")
endif
methodret ""
methodend
Expand All @@ -12,7 +14,7 @@ classend
class public PasswordValidator implements IValidator
method public BBjString validate(BBjString field!)
if field!.length() > 0 and field!.length() < 6 then
methodret "Password too short"
methodret I18n.getTranslation("password_short")
endif
methodret ""
methodend
Expand All @@ -21,7 +23,7 @@ classend
class public NewPasswordValidator implements IValidator
method public BBjString validate(BBjString field!)
if field!.length() > 0 and field!.length() < 6 then
methodret "Password too short"
methodret I18n.getTranslation("password_short")
endif
methodret ""
methodend
Expand Down
12 changes: 12 additions & 0 deletions framework/PortalFrame/PortalFrame.bbj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ use ::WebKit/framework/Favorites/SampleFavoritesProvider.bbj::SampleFavoritesPro
use ::WebKit/i8n/I18n.bbj::I18n
use java.util.HashMap



use ::BBjRouter/BBjRouter.bbj::BBjRouterEvent
use ::WebKit/framework/Router/RouterProtocol.bbj::RouterProtocol

Expand All @@ -34,6 +36,8 @@ use ::WebKit/framework/Router/Router.bbj::Router

class public PortalFrame implements RouterProtocol



field private BBjTopLevelWindow window!
field private Drawer Drawer!
field private BBjChildWindow Main!
Expand Down Expand Up @@ -65,6 +69,8 @@ class public PortalFrame implements RouterProtocol
field public BBjString LogoUrl!
field public BBjString LogoSmallUrl!



field public static BBjString ON_NAVIGATION$ = "navigation"
field private Router router!
field private BBjRouterEvent routerEvent!
Expand Down Expand Up @@ -354,11 +360,14 @@ REM footerMenuItem!.setCallback("onChangeTheme")
#navigateTo(item!)
methodend


method private BBjWidget openPanel(MenuItem item!)

if #currWindow! <> null() and !#currWindow!.isDestroyed() then
#currWindow!.setVisible(0)
#currWindow!=null()


fi
if item!.hasChildren() and !item!.hasProgram() then
declare TreeListPanel menuPanel!
Expand All @@ -380,6 +389,8 @@ REM footerMenuItem!.setCallback("onChangeTheme")
#currWindow!.redraw(0)
#currWindow!.setVisible(1)
else


pgm$ = item!.getProgram()

if pgm$ = "void" then
Expand Down Expand Up @@ -417,6 +428,7 @@ REM footerMenuItem!.setCallback("onChangeTheme")

if #currWindow! <> null() then
#win_list!.put(item!.getNodeId(),#currWindow!)

fi
fi
fi
Expand Down
4 changes: 4 additions & 0 deletions framework/PortalFrame/i18n/PortalFrame.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
#Tue Feb 01 15:56:24 CET 2022
error_starting=
log_out=
4 changes: 4 additions & 0 deletions framework/PortalFrame/i18n/PortalFrame_de.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
#Tue Feb 01 15:56:24 CET 2022
error_starting=Fehler beim starten von
log_out=Log Out
4 changes: 4 additions & 0 deletions framework/PortalFrame/i18n/PortalFrame_en.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
#Tue Feb 01 15:56:24 CET 2022
error_starting=Error starting
log_out=Log Out
5 changes: 4 additions & 1 deletion framework/TreeListPanel/TreeListPanel.bbj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use ::WebKit/util/Icons.bbj::Icons
use ::WebKit/framework/Favorites/IFavoritesProvider.bbj::IFavoritesProvider
use ::WebKit/framework/Favorites/SampleFavoritesProvider.bbj::SampleFavoritesProvider

use ::WebKit/i18n/I18n.bbj::I18n


class public TreeListPanel extends BBjWidget

Expand Down Expand Up @@ -45,6 +47,7 @@ class public TreeListPanel extends BBjWidget
methodend

method public void redraw(Boolean e_init!)
translator! = I18n.getTranslator("TreeListPanel","WebKit/framework/TreeListPanel/i18n")

if e_init! > 0 then
window! = #getCanvas()
Expand All @@ -57,7 +60,7 @@ class public TreeListPanel extends BBjWidget
#Header! = #MenuTilesBox!.addChildWindow(#MenuTilesBox!.getAvailableControlID(),0,0,0,0,"",$00108800$,BBjAPI().getSysGui().getAvailableContext())
#Header!.addStyle("tilesBoxHeader")

Title! = #Header!.addStaticText(#Header!.getAvailableControlID(),0,0,0,0,"APPLICATIONS")
Title! = #Header!.addStaticText(#Header!.getAvailableControlID(),0,0,0,0,translator!.getTranslation("applications"))
Title!.addStyle("tilesBoxTitle")

declare BBjChildWindow favButtonWrapper!
Expand Down
3 changes: 3 additions & 0 deletions framework/TreeListPanel/i18n/TreeListPanel.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
#Tue Feb 01 15:42:17 CET 2022
applications=
3 changes: 3 additions & 0 deletions framework/TreeListPanel/i18n/TreeListPanel_de.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
#Tue Feb 01 15:42:17 CET 2022
applications=ANWENDUNGEN
3 changes: 3 additions & 0 deletions framework/TreeListPanel/i18n/TreeListPanel_en.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
#Tue Feb 01 15:42:17 CET 2022
applications=APPLICATIONS
14 changes: 14 additions & 0 deletions i18n/ChileCompany.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
#Tue Feb 01 15:38:51 CET 2022
address=
chile_company_title=
create_customer=
customer_id=
customers=
item_to_be_deleted=
list_of_customers=
products=
products_dashboard=
salesperson=
salesperson_dashboard=
your_reference=
12 changes: 12 additions & 0 deletions i18n/ChileCompany_de.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
#Tue Feb 01 15:38:29 CET 2022
address=Adresse
chile_company_title=Chile Company Demo
create_customer=Kunden anlegen
customer_id=Kundennummer
customers=Kunden
item_to_be_deleted=Item,welches gel\u00F6scht wird\:
list_of_customers=Liste der Kunden
products=Produkte
salesperson=Verk\u00E4ufer
your_reference=Ihre Referenz
Loading