Coding for localization Providing alternate layouts
suggest changeCreating language specific layouts is often unnecessary if you have specified the correct start/end
notation, as described in the earlier example. However, there may be situations where the defaults layouts may not work correctly for certain languages. Sometimes, left-to-right layouts may not translate for RTL languages. It is necessary to provide the correct layouts in such cases.
To provide complete optimization for RTL layouts, we can use entirely separate layout files using the ldrtl
resource qualifier (ldrtl
stands for layout-direction-right-to-left}). For example, we can save your default layout files in res/layout/
and our RTL optimized layouts in res/layout-ldrtl/
.
The ldrtl
qualifier is great for drawable resources, so that you can provide graphics that are oriented in the direction corresponding to the reading direction.
Here is a great post which describes the precedence of the ldrtl
layouts : Language specific layouts