Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Board local(e) cab to user's heart ❤

Board local(e) cab to user's heart ❤

Preparing your android apps to add localization support and common issues. Presented at GDG BlrDroid DevFest '16.

Arun Babu A S P

October 15, 2016
Tweet

More Decks by Arun Babu A S P

Other Decks in Technology

Transcript

  1. If you talk to a man in a language he

    understands, that goes to his head. If you talk to him in his language, that goes to his heart. - Nelson Mandela
  2. Basic changes String login = "Log In"; ✘ String login

    = context.getResources().getString(R.string.login); ✓
  3. Basic changes String login = "Log In"; ✘ String login

    = context.getResources() .getString(R.string.login); ✓ TextView textView = new TextView(this); textView.setText(“Log In”); ✘ textView.setText(R.string.login); ✓
  4. Basic changes String login = "Log In"; ✘ String login

    = context.getResources() .getString(R.string.login); ✓ TextView textView = new TextView(this); textView.setText(“Log In”); ✘ textView.setText(R.string.login); ✓ <TextView ... android:text="Login" /> ✘ android:text="@string/login" /> ✓
  5. With format strings JAVA String message = “Welcome “ +

    username + “! Successfully logged in.”; ✘
  6. With format strings JAVA String message = “Welcome “ +

    username + “! Successfully logged in.”; ✘ XML <string name="welcome">Welcome %1s! Successfully logged in.</string> ✓ JAVA String welcome = getString(R.string.welcome, username); ✓
  7. JAVA textView.setText("" + count + "item(s) downloaded") ; ✘ XML

    <plurals name="itemsDownloaded" > ✓ <item quantity="zero">%d items downloaded</ item> <item quantity="one">%d item downloaded</item> <item quantity="two">%d items downloaded</ item> <item quantity="few">%d items downloaded</ item> <item quantity="many">%d items downloaded</ item> <item quantity="other">%d items downloaded</item> </plurals> Quantity strings
  8. Language script type English and English-like: Latin (except Vietnamese), Greek,

    Cyrillic, Hebrew, Armenian and Georgian. Tall: Language scripts that require extra line height to accommodate larger glyphs, including South and Southeast Asian and Middle Eastern languages, like Arabic, Hindi, Telugu, Thai, Vietnamese.
  9. Language script type English and English-like: Latin (except Vietnamese), Greek,

    Cyrillic, Hebrew, Armenian and Georgian. Tall: Language scripts that require extra line height to accommodate larger glyphs, including South and Southeast Asian and Middle Eastern languages, like Arabic, Hindi, Telugu, Thai, Vietnamese. Dense: Language scripts that require extra line height to accommodate larger glyphs but have different metrics from tall scripts. Includes Chinese, Japanese, and Korean.
  10. I Love You ❤ म तुमसे यार करता हूँ ❤

    আিম তামায় ভােলাবািস ❤ ಾನು ನ ನು ೕ ಸು ೆ ೕ ೆ ❤ ను ను సు ను ❤ ഞാൻ നിെ േപമി ു ു ❤ நா உ ைன காதலி கிேற ❤ Tall / Lengthy languages
  11. Custom font for full app Calligraphy CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("your font

    path") .setFontAttrId(R.attr.fontPath) .build(); Using reflection final Field staticField = Typeface.class.getDeclaredField(staticTypefaceFieldName); staticField.setAccessible(true); staticField.set(null, newTypeface); http://stackoverflow.com/questions/2711858/is-it-possible-to-set-a-custom-font-for-entire-of-application
  12. RTL support - Native RTL support from Jellybean (4.2) -

    Left -> Start - Right -> End - Images with Text should be split - Background Image - Text as overlay
  13. Flexible layout android:layoutDirection — attribute for setting the direction of

    a component's layout. android:textDirection — attribute for setting the direction of a component's text.
  14. Flexible layout android:layoutDirection — attribute for setting the direction of

    a component's layout. android:textDirection — attribute for setting the direction of a component's text. android:textAlignment — attribute for setting the alignment of a component's text.
  15. Currency - Can be make or break for your app

    - Must provide easy way to change it - $$ must be included if international
  16. Common issues Clipped text, or text that overlaps the edge

    of UI elements or the screen Poor line wrapping
  17. Common issues Clipped text, or text that overlaps the edge

    of UI elements or the screen Poor line wrapping Incorrect word breaks or punctuation
  18. Common issues Clipped text, or text that overlaps the edge

    of UI elements or the screen Poor line wrapping Incorrect word breaks or punctuation Incorrect alphabetical sorting
  19. Common issues Clipped text, or text that overlaps the edge

    of UI elements or the screen Poor line wrapping Incorrect word breaks or punctuation Incorrect alphabetical sorting Incorrect layout direction or text direction
  20. Common issues Clipped text, or text that overlaps the edge

    of UI elements or the screen Poor line wrapping Incorrect word breaks or punctuation Incorrect alphabetical sorting Incorrect layout direction or text direction Untranslated text
  21. Thanks! Arun Babu A S P Love building apps with

    best user experience! https://www.linkedin.com/in/arunasp https://yourstory.com/2016/09/arun-babu-story/