深圳哪家网站建设公司好,信息网站有哪些,网站建设完成情况工作总结,网站运营怎么样转自别人的一片文章#xff0c;出处以找不到了#xff0c;觉得写得不错#xff0c;记录一下 一、概念 1.Internationalization(I18N) 国际化 使得App在不改的源码、资源文件的情况下#xff0c;能够适应各国、各文化、各语言 是L10N的基础 2.Localization(L10N) 本地化 为A…转自别人的一片文章出处以找不到了觉得写得不错记录一下 一、概念 1.Internationalization(I18N) 国际化 使得App在不改的源码、资源文件的情况下能够适应各国、各文化、各语言 是L10N的基础 2.Localization(L10N) 本地化 为App提供本地化的语言图片媒体资源等 二、Strings 1.永远不要在任何地方Hard-code字符串 layouts, xmls, menus, codes 使用Lint查找所有hardcoded字符串 2.永远不要拼接字符串 错误的做法: string name“total”共计/string string name“apps”个应用/string String result getString(R.string.total) Integer.toString(appCount) getString(R.string.apps) 正确的做法: string name“total_apps”共计%1$d个应用/string String result getString(R.string.total_apps, appCount) 三、Layouts 1.Flexible layouts 避免hard code margin, padding, width, height 多使用minWidth, minHeight, maxWidth, maxHeight等属性 需要定义精确尺寸的时候请注意 为外语留出足够的空间例如中文长度*2或者英文长度*1.5 为特定语言提供定制的Layouts 2.RTL 中东语言为主 Android 4.2支持 layoutDirection, textDirection, textAlignment, etc http://android-developers.blogspot.fr/2013/03/native-rtl-support-in-android-42.html 四、Plurals 1.量词 一个应用两个应用三个应用 One app, two apps, three apps 中文非常简单但是其他语言可能有更多变化 至少需要定义one, other, 但是也可以定义zero, two, few, many 2.R.plurals 使用专用的plurals/plurals在资源中定义 http://developer.android.com/guide/topics/resources/string-resource.html#Plurals 五、Date, time, numbers, currencies 1.利用现有API 不要重复制造轮子 不如Android系统对语言的支持广泛 2.需要深入理解以下类: DateUtils DateFormat DecimalFormat 六、Resource Management 1.为不同locale定义不同的resources values values-es values-jp values-zh-rCN values-zh-rTW 2.资源匹配 MCC, MNC, configuration(landscape, portrait), language, region Android会尝试按照精确度寻找匹配如果无法找到匹配则使用默认资源 对于国际化产品默认资源建议为英文中文资源请放在-zh-rCN中 默认资源必须为全集 3.资源命名 Module_Name 其中Module为缩写全部小写不超过3个字符 Name为具体资源的英文名称首字母大写 4.删除不需要的资源 在多语言环境下多出一个资源会导致apk文件体积大幅增加 避免使用 Resources.getIdentifier可能被compressed) 5.禁止使用反射等方式获取资源id 6.不要使用可被本地化的资源作为索引或进行持久化 例如hashmap的key或者使用button.text判断是否是特定button这些资源可能会在运行时改变导致程序工作异常 七、Help translators 1.提供string的上下文信息 !-- The action for submitting a form. This text is on a button that can fit 30 chars -- string namelogin_submit_buttonSign in/string 2.标出无法翻译的部分 string namecountdownxliff:g idtime example5 days%1$s/xliff:guntil holiday/string 3.在翻译团队提出问题时请尽快给出反馈 八、Testing 1.I18N testing 提供中文与英文版本测试人员测试不同环境下UI语言是否正确(hardcode) 未来可制作pseudo translation版本测试I18N 在运行时切换系统语言设定App需要能够正确改变语言(configuration change) 2.L10N testing 众测机制用户当地运营团队etc 九、References 1.Localizing with Resources http://developer.android.com/guide/topics/resources/localization.html 2.Localization Checklist http://developer.android.com/distribute/tools/localization-checklist.html 3.String resources http://developer.android.com/guide/topics/resources/string-resource.html 4.RTL http://android-developers.blogspot.fr/2013/03/native-rtl-support-in-android-42.html 5.Support Different Languages http://developer.android.com/training/basics/supporting-devices/languages.html 转载于:https://www.cnblogs.com/wanjintun/p/5003828.html