Android定位

原文地址:https://developer.android.google.cn/guide/topics/resources/localization.html

Localizing with Resources

定位与资源

Android runs on many devices in many regions. To reach the most users, your app should handle text, audio files, numbers, currency, and graphics in ways appropriate to the locales where your app is used.

Android系统在很多地区的很多设备上运行。为了满足大多数用户,你的app应该在处理文本、音频文件、数字、货币和图像方面与其使用的区域相适应。

This document describes best practices for localizing Android apps.

本文档描述了本地化Android应用程序的最佳实践。

You should already have a working knowledge of the Java programming language and be familiar with Android resource loading, the declaration of user interface elements in XML, development considerations such as Activity lifecycle, and general principles of internationalization and localization.

你应该已经具备了Java编程语言和熟悉Android资源加载以及在XML文件用户界面元素的声明,开发注意事项例如Activity的生命周期及国际化和本地化的通用规则的工作知识。

It is good practice to use the Android resource framework to separate the localized aspects of your app as much as possible from the core Java-based functionality:

将Android资源框架同基于Java的核心功能中的定位方面尽可能的分离是很好的做法:

  • You can put most or all of the contents of your app's user interface into resource files, as described in this document and in Providing Resources.
你可以将App用户界面的大部分或者全部内容放入资源文件,如本文档和Providing Resources部分所描述。

  • The behavior of the user interface, on the other hand, is driven by your Java-based code. For example, if users input data that needs to be formatted or sorted differently depending on locale, then you would use the Java programming language to handle the data programmatically. This document doesn't cover how to localize your Java-based code.

用户界面的行为,从另一方面是说,是基于你的Java代码驱动的。例如,如果用户输入的数据需要被格式化或者在不同区域排序,那么你就要运用Java语言去进行相关的数据编程(以达到这种目的)。本文档不包含如何使用Java进行定位。

For a short guide to localizing strings in your app, see the training lesson, Supporting Different Languages.

有关在应用程序中定位字符串的简短指南,请参见培训课程,Supporting Different Languages

Overview: Resource-Switching in Android

概述:Android中的资源转换

Resources are text strings, layouts, sounds, graphics, and any other static data that your Android app needs. An app can include multiple sets of resources, each customized for a different device configuration. When a user runs the app, Android automatically selects and loads the resources that best match the device.

资源是Android app所需要的文本字符串、布局文件、音频、图像和任何其他静态数据。一个app可以包含多套资源,为了给不同的设备进行定制。当用户去运行app时,Android系统会自动选择加载与该设备最匹配的资源。

(This document focuses on localization and locale. For a complete description of resource-switching and all the types of configurations that you can specify — screen orientation, touchscreen type, and so on — see Providing Alternative Resources.)

(本文件着重于本地化和地区设置)。对于资源转换的完整描述以及可以指定的所有类型的配置(屏幕定向、触摸屏类型等),请参见Providing Alternative Resources.

先翻译到这

猜你喜欢

转载自blog.csdn.net/agoddog/article/details/79650705
今日推荐