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.

A840d50ff8fdfeefe6d6bd98b4f18873?s=128

Arun Babu A S P

October 15, 2016
Tweet

More Decks by Arun Babu A S P

Other Decks in Technology

Transcript

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

  2. None
  3. 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
  4. Successful stories 1 - 5M

  5. Successful stories 1 - 5M 1 - 5M

  6. Successful stories 1 - 5M 10 - 50M 1 -

    5M
  7. Preparing “Text”

  8. Basic changes String login = "Log In"; ✘ String login

    = context.getResources().getString(R.string.login); ✓
  9. 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); ✓
  10. 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" /> ✓
  11. With format strings JAVA String message = “Welcome “ +

    username + “! Successfully logged in.”; ✘
  12. 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); ✓
  13. JAVA textView.setText("" + count + "item(s) downloaded"); ✘ Quantity strings

  14. 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
  15. JAVA String messages = getResources().getQuantityString( R.plurals.itemsDownloaded, count, count); ✓ Quantity

    strings
  16. Handling script types

  17. Language script type English and English-like: Latin (except Vietnamese), Greek,

    Cyrillic, Hebrew, Armenian and Georgian.
  18. 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.
  19. 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.
  20. I Love You ❤ म तुमसे यार करता हूँ ❤

    আিম তামায় ভােলাবািস ❤ ಾನು ನ ನು ೕ ಸು ೆ ೕ ೆ ❤ ను ను సు ను ❤ ഞാൻ നിെ േപമി ു ു ❤ நா உ ைன காதலி கிேற ❤ Tall / Lengthy languages
  21. Important TextView attrs android:ellipsize

  22. Important TextView attrs android:ellipsize android:maxLines android:minLines

  23. Important TextView attrs android:ellipsize android:maxLines android:minLines android:fontFeatureSettings android:elegantTextHeight

  24. Important TextView attrs android:ellipsize android:maxLines android:minLines android:fontFeatureSettings android:elegantTextHeight android:typeface

  25. Custom font for full app Calligraphy CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("your font

    path") .setFontAttrId(R.attr.fontPath) .build();
  26. 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
  27. Localized layouts

  28. RTL support - Native RTL support from Jellybean (4.2) -

    Left -> Start - Right -> End
  29. RTL support - Native RTL support from Jellybean (4.2) -

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

    a component's layout.
  31. 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.
  32. 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.
  33. Force RTL layout

  34. Distance, Time, Currency

  35. Distance

  36. Distance

  37. Time

  38. Currency - Can be make or break for your app

    - Must provide easy way to change it - $$ must be included if international
  39. Common issues

  40. Common issues Clipped text, or text that overlaps the edge

    of UI elements or the screen
  41. Common issues Clipped text, or text that overlaps the edge

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

    of UI elements or the screen Poor line wrapping Incorrect word breaks or punctuation
  43. 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
  44. 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
  45. 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
  46. 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/