Runtime translation with right-to-left (RTL) and left-to-right (LTR) languages can be done with the SetLanguage function. This is valid as long as you use Panel object or Web Panel object with Design System Object (DSO) with the value None in the Base CSS property.
For example, if you use the English and Arabic languages, you can include the following in a Web Panel:
Event 'SetEnglish'
&i = SetLanguage(!"English")
refresh
EndEvent
Event 'SetArabic'
&i = SetLanguage(!"Arabic")
refresh
EndEvent
The orientation will be determined automatically, because the application generated with DSO uses the 'dir' attribute.
- For Native Mobile Generator its recommended to set a GoHome command (Actions external object):
Event 'Arabic'
Composite
&Numeric = SetLanguage(!"Arabic")
Actions.GoHome()
EndComposite
Endevent
Event 'English'
Composite
&Numeric = SetLanguage(!"English")
Actions.GoHome()
EndComposite
EndEvent
- You must use SetTheme function and SetLanguage function together, when using Web Panels with Theme object or DSO with a value other than None in the Base CSS property.
For example, taking the example above and assuming you use the Web Master Panel object, the code should look like the following:
Event 'SetEnglish'
&i = SetTheme(!"Carmine")
&i = SetLanguage(!"English")
refresh
EndEvent
Event 'SetArabic'
&i = SetTheme(!"CarmineRTL")
&i = SetLanguage(!"Arabic")
refresh
EndEvent
This will enable a smooth transitioning between interfaces once a language change is detected.
HowTo: Add RTL styles