Android Internationalization and localization (I18N and L10N) Coding for localization : Providing alternate layouts

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Creating 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



Got any Android Question?