Mais conteúdo relacionado
Semelhante a Beyond English - Make Your Android App a Global Success (20)
Mais de Motorola Mobility - MOTODEV (20)
Beyond English - Make Your Android App a Global Success
- 1. AnDevCon 2011
Eric Cloninger (@
E i Cl i (@ecmoto)
t )
Product Line Manager
Motorola M bilit Inc.
M t l Mobility, I
Beyond English
eyo d g s
Make Your Android App a Global Success
MOTOROLA and the Stylized M Logo are trademarks or registered trademarks of Motorola Trademark Holdings, LLC.
All other trademarks are the property of their respective owners. © 2011 Motorola Mobility, Inc. All rights reserved.
- 2. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 2
Online Resources
• This presentation at Slideshare net
Slideshare.net
• bit.ly bundle of all the links
mentioned in this presentation
– http://bit.ly/eWKHgf
© 2011 Motorola Mobility, Inc. 9 March 2011
- 3. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 3
Agenda
• Concepts for globalized applications
• Layout of an Android project
• Folder naming
• Locating localized resources
• Android runtime support
• Tools at your disposal
• MOTODEV Studio features for localization
• Testing your localized Android app
• Publishing to Android Market
• Best
B t practices
ti
© 2011 Motorola Mobility, Inc. 9 March 2011
- 4. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 4
Terms
• Globalization
– The process of preparing and delivering software for an international
customer base (i.e. Internationalization + Localization)
•I t
Internationalization (i18 )
ti li ti (i18n)
– Should be designed into the product during development
• Monetary formats
• Time/Date display
• Numbers separators
• Measurements (imperial vs. metric)
• Localization (l10n)
( )
– Translating user interface elements, inputs and outputs so that your
customer can use your application in their language of choice
– Mostly done after development is complete (or in final phases)
© 2011 Motorola Mobility, Inc. 9 March 2011
- 5. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 5
ISO Codes
• ISO 639 – Language Codes
– 639-1 – 2 Digit code from original specification in 1967 (185 entries)
– Special cases and ranges for ‘user-defined’
– Convention is to use lower case for Android
– en for English, de for German (Deutsch), zh for Chinese
• ISO 3166 – C
Country Codes
t C d
– Specifically, ISO 3166-1 alpha-2
– Countries, dependent territories, & areas of geographical interest
, p , g g p
– Convention is to use upper case for Android
– US for United States, DE for Germany, CN for China (PRC)
© 2011 Motorola Mobility, Inc. 9 March 2011
- 6. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 6
ISO Codes (cont’d)
• ISO 10646 – Universal Character Set
– “Not quite the same” as Unicode (Unicode is not controlled by ISO)
• ISO 15924 – Names of Systems of Writing (
y g (i.e. scripts)
p )
– Four letter code and a number
– Latn/215 for Latin, Hani/500 for Han, Cyrl/220 for Cyrillic
• ISO 4217 – Names of Currencies
C rrencies
– USD for US Dollar, EUR for Euro, CNY for Chinese Yuan
© 2011 Motorola Mobility, Inc. 9 March 2011
- 7. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 7
Layout of an Android project
Non-Localized Localized project with
project with default language-
language and locale-
locale
folder names specific folder names
© 2011 Motorola Mobility, Inc. 9 March 2011
- 8. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 8
Layout of an Android project
• AndroidManifest xml
AndroidManifest.xml
– Metadata that the Android Market and Package Manager uses to
find, install, and launch your app
• default.properties, build.properties
– Metadata used for building your app, such as the target
platform version. build properties is used by Ant
version build.properties Ant.
• .classpath
– Folders used by the Java compiler
• .project
– Used by Eclipse build system
© 2011 Motorola Mobility, Inc. 9 March 2011
- 9. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 9
Layout of an Android project
• assets
– Non-code components of your app that aren‘t in the /res folder.
– Don‘t have a resource ID, so they can‘t be accessed with R. syntax
– E
Example: a SQLit database that contains initial or default data
l SQLite d t b th t t i i iti l d f lt d t
• bin, gen
– Generated folders where your .apk resides, output from various tools
• raw
– Audio and video files, which are accessible with R.raw
• res
– Non-code components, accessible with R. syntax
– Layouts, icons, drawables, strings, animations
• src
© 2011 Motorola Mobility, Inc. 9 March 2011
- 10. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 10
Folder naming
• If no localization folders are found folders contain files with
found,
default values
– As a rule, your projects should have defaults
– values/strings.xml
• When adding a translation, append a hyphen and the 2 digit
ISO 639 code for the translated language to the folder name
– File names remain the same
– values-de/strings.xml
• When adding a country, append a hyphen, lower case ‘r’ and
the 2 digit ISO 3166 code for the country to the folder name
– File names remain the same
– values-de-rDE/strings.xml
© 2011 Motorola Mobility, Inc. 9 March 2011
- 11. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 11
Folder naming ‘gotchas’
• There is no way to add a country modifier by itself. You
itself
must specify all the languages and duplicate contents.
– If you want values-rCA for “all of Canada”, you must specify values-
en-rCA and values-fr-rCA
• Some notable code and language code variations
– Japan: Language is ja country is JP (ja rJP)
ja, (ja-rJP)
– Korea (ROK): Language is ko, country is KR (ko-rKR)
– China (PRC) is zh-rCH (Simplified Chinese)
– Taiwan (ROC) is zh-rTW (Traditional Chinese)
zh rTW
– Hong Kong is zh-rHK (Traditional Chinese)
© 2011 Motorola Mobility, Inc. 9 March 2011
- 12. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 12
Locating localized resources
• Android searches for a ‘best match , based on precedence
best match’
• Locale almost always takes precedence
– User settings override what the carrier or manufacturer configure
– Only exception involves mobile country and network code
– Will “cover up” more precise matches
• e.g. drawable-de-ldpi will not be used if drawable-de exists
e g d a ab e de dp ot d a ab e de e sts
• Logic of search
– Eliminate resource files that contradict the device configuration
– Pick the next highest-precedence qualifier. If no matches, continue
searching until one is found. If no matches, use default.
– If there are qualifiers based on pixel density, Android will choose the
value th t’ closest t th value f th users’ d i
l that’s l t to the l for the ’ device
© 2011 Motorola Mobility, Inc. 9 March 2011
- 13. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 13
Configuration qualifier precedence
• Precedence table is provided at the Android developer site
– http://bit.ly/i1rDij
Qualifier
Q lifi Values/Examples
V l /E l
MCC and MNC mcc310, mcc310-mnc004, mcc208-mnc00, etc.
Language and region en, fr, en-rUS, fr-rFR, fr-rCA , etc.
Screen size small, normal large
small normal, large, xlarge
Screen aspect long, notlong
Screen orientation port, land
Dock mode car, desk
Night mode night, notnight
Screen pixel density (dpi) ldpi, mdpi, hdpi, xhdpi, nodpi
Touchscreen type notouch, stylus, finger
… more online …
© 2011 Motorola Mobility, Inc. 9 March 2011
- 14. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 14
Example
• This is the device configuration we’re testing
we re
– Locale = en-GB
– Screen orientation = port
– Screen pixel density = hdpi
– Touchscreen type = notouch
– Primary text input method = 12key
© 2011 Motorola Mobility, Inc. 9 March 2011
- 15. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 15
Example (cont’d)
• These directories each contain different versions of the
same named image (e.g. flag.png)
– drawable/
– drawable-en/
– drawable-fr-rCA/
– drawable-en-port/
– drawable-en-notouch-12key/
drawable en notouch 12key/
– drawable-port-ldpi/
– drawable-port-notouch-12key/
© 2011 Motorola Mobility, Inc. 9 March 2011
- 16. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 16
Example (cont’d)
• Eliminate directories that contradict the device configuration
• Eliminate drawable-fr-rCA because it contradicts en-GB
– drawable/
– drawable-en/
– drawable-fr-rCA/
– drawable en port/
drawable-en-port/
– drawable-en-notouch-12key/
– drawable-port-ldpi/
– drawable-port-notouch-12key/
p y
© 2011 Motorola Mobility, Inc. 9 March 2011
- 17. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 17
Example (cont’d)
• Eliminate directories that do not include a language qualifier
– drawable/
– drawable-en/
– drawable-fr-rCA/
drawable fr rCA/
– drawable-en-port/
– drawable-en-notouch-12key/
– drawable-port-ldpi/
– drawable-port-notouch-12key/
© 2011 Motorola Mobility, Inc. 9 March 2011
- 18. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 18
Example (cont’d)
• Eliminate directories that do not include a screen orientation
– drawable/
– drawable-en/
– drawable-fr-rCA/
drawable fr rCA/
– drawable-en-port/
– drawable-en-notouch-12key/
– drawable-port-ldpi/
– drawable-port-notouch-12key/
© 2011 Motorola Mobility, Inc. 9 March 2011
- 19. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 19
minSDKVersion
• There are localization improvements in platform 1 6 and
1.6
later, so consider this when choosing minSDKVersion
– From the Android dashboard http://bit.ly/fxFY7P
Platform API Level Distribution
Android 1.5 3 3.9%
Android 1.6 4 6.3%
Android 2.1 7 31.4%
Android 2 2
2.2 8 57.6%
57 6%
Android 2.3 9 0.8%
Data collected during two weeks
ending on February 2, 2011
g y
© 2011 Motorola Mobility, Inc. 9 March 2011
- 20. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 20
Android runtime support
• Android and Java APIs supporting l10n and i18n
• Unicode fonts in Android
•I t
International Components for Unicode (ICU) i i 1 5+
ti lC t f U i d is in 1.5+
– Constructing locales is different from Android convention (ll_CC)
– http://site.icu-project.org/
Platform ICU Version
Cupcake/donut/éclair 3.8
Froyo 4.2
Gingerbread 4.4
y
Honeycomb 4.6?
© 2011 Motorola Mobility, Inc. 9 March 2011
- 21. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 21
Tools at Your Disposal
• Eclipse + ADT
– Creating localized resources
– Extracting strings and caveats
– Images with external editor
– F5 (Refresh) for drawables changes
• Sequoyah project
© 2011 Motorola Mobility, Inc. 9 March 2011
- 22. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 22
MOTODEV Studio for Android
• A complete development tools package with multiple
package,
installation use cases (full installer or plugins)
• Built on the most recent version of the Eclipse IDE
• 100% project compatibility with Eclipse and Google ADT
• Designed to work with all Android products
• Free download for registered MOTODEV members
• Supported on MOTODEV discussion boards
• Available today for Windows, Mac OS & Linux
© 2011 Motorola Mobility, Inc. 9 March 2011
- 23. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 23
MOTODEV Studio features for localization
• Localized to Simplified Chinese Spanish and Portuguese
Chinese, Spanish,
• Other languages available for Eclipse components (<100%)
• Device manager
• Integrated emulator
• Localization file editor
• Code snippets
© 2011 Motorola Mobility, Inc. 9 March 2011
- 24. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 24
Testing your localized Android app
• Custom Locale app in Google platform emulator builds
• Language preference screen
• Home Screen Widget
• MoreLocale2 (in Android Market)
• Language choice in the MOTODEV Studio device manager
• Crowd sourcing
Crowd-sourcing
• MOTODEV App Validator
© 2011 Motorola Mobility, Inc. 9 March 2011
- 25. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 25
Publishing to Android Market
• Verify your localization efforts when you upload to the
Android Market
© 2011 Motorola Mobility, Inc. 9 March 2011
- 26. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 26
Best practices for creating globalized apps
• Localization Industry Standards Assn http://www lisa org
http://www.lisa.org
• IBM developerWorks http://bit.ly/fSBBYt
• “Lessons Learned”
– Localization is usually not a one-time event
– Translators may not know your industry / subject matter
– Technical terms often aren’t translated
– Handle Unicode files with care
© 2011 Motorola Mobility, Inc. 9 March 2011
- 27. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 27
© 2011 Motorola Mobility, Inc. 9 March 2011
- 28. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 28
MOTOROLA MOBILITY DEVELOPER NETWORK
• Detailed product specs
• Practical advice, technical
articles, and documentation
• Expert support via forums
• Community interaction via
blogs, podcasts, and social
media
• Global news, events, and
training
• Web: developer.motorola.com
• Twitter: @motodev
© 2011 Motorola Mobility, Inc. 9 March 2011
- 29. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 29
GET STARTED NOW!
• Test Your Apps on the MOTODEV App Validator at
http://moto.ly/appvalidator
• Join the MOTODEV Community: Ask questions, read our blogs, and
network at http://moto.ly/joinmotodev
• Join our live chat with technical experts during the MOTODEV Office
Hours March 16 2pm PST - Details at http://moto.ly/officehours
© 2011 Motorola Mobility, Inc. 9 March 2011
- 30. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 30
Questions
• This presentation at Google Docs
– http://bit.ly/fWAUq2
• Li k to items online at bit l
Links t it li t bit.ly
– http://bit.ly/bundles/mtdvstudio/1
– http://bit ly/eWKHgf
http://bit.ly/eWKHgf
• MOTODEV
– MOTODEV Studio http://bit.ly/hJW5fm
– MOTODEV discussion boards http://bit.ly/hxzIAY
– MOTODEV Fast-track partners http //bit l /gh8K n
Fast track http://bit.ly/gh8Kxn
© 2011 Motorola Mobility, Inc. 9 March 2011
- 31. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 31
LIFE. POWERED.
© 2011 Motorola Mobility, Inc. 9 March 2011
- 32. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 32
Page
Licenses
Source code examples displayed in this presentation may be licensed under Apache License,
Version 2 as follows:
Copyright © 2010, Android Open Source Project. All rights reserved unless otherwise explicitly indicated.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
p y py
http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and limitations under
the License.
© 2011 Motorola Mobility, Inc. 9 March 2011
- 33. AnDevCon 2011 Beyond English – Make Your Android App a Global Success Page 33
Page
Licenses
Source code examples displayed in this presentation may be licensed under BSD License, as
follows:
Copyright © 2010-2011, Motorola Mobility, Inc. All rights reserved except as otherwise explicitly indicated.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
Neither the name of the Motorola Mobility Inc nor the names of its contributors may be used to endorse or promote products
Mobility, Inc.
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
© 2011 Motorola Mobility, Inc. 9 March 2011