SAPUI5 developers have to consider the text directionality when implementing new controls. The following guidelines explain how this can be done and highlight what you need to focus on.
You should develop the control as usual, with only left-to-right (LTR) direction in mind.
-
You shouldn't add any RTL-specific CSS classes and you shouldn't write RTL-specific styles into a CSS file.
-
You shouldn't use CSS properties related to RTL.
-
You need to consider the semantics of the control properties. Controls that have directional properties like
left
orright
need to be changed tobegin
orend
respectively. -
Think about the RTL behavior according to the items below when writing JavaScript code that relates to positions.
You can find more detailed guidelines and specifics in the Related Information section.
You can test your control by setting the URL parameter sap-ui-rtl
to true
. This will display your control in RTL mode. The automatically converted stylesheets and mirrored images are used, and dir=rtl
is set on the <html>
tag.
Languages that have RTL text directionality keep the default directionality of numeric values and texts in LTR mode. In order to handle these cases, SAPUI5 uses two additional API properties - textDirection
and textAlign
. You can find detailed information on how to use these properties in the Related Information section.
Related Information
API Properties for Right-to-Left Support in Text-Displaying Controls