本地化iOS项目的更好方法应该是什么? [英] What should be the better way for localizing iOS project?

查看:56
本文介绍了本地化iOS项目的更好方法应该是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了两种为iOS项目启用本地化的方法:

I have found two ways to enable localization for iOS project:

  1. 创建本地化的.xib文件
  2. 创建本地化的.string文件

我已经对这两种方法学了很多,甚至我都尝试了这两种方法.但是,哪一个应该更好地使用,为什么呢?请引导我.

I have read up so much about both the methodologies, even I have tried both the ways. But which one should be better to use and why? Please guide me.

推荐答案

第一种选择是正确的方法. 数字1的原因是,并非所有语言的长度都相同. 与英语相比,德语通常是一种更广泛的"语言,而中文是一种更窄"的语言. 这意味着,如果您的UIButton用英语测量的大小为100px x 37px,则德语版本的大小应为130px x 37px,中文版本的大小约为70px X 37px.创建本地化的字符串文件时,您没有更好的控件.缺点是,如果要编辑XIB(如添加另一个按钮),则必须将其添加到所有XIB.解决方法是设计一种XIB以适应最广泛的语言并使用本地化的字符串文件,但是这样,您的UI看起来就不会优美.因此,最终将其归结为为用户优化的UI"与额外的开发时间",您必须做出决定.

The first choice is the right way to do. The number 1 reason is, not all languages are of same length. German is usually a "wider" language than English whereas Chinese is a "narrower" language. This means, if your UIButton measures 100px x 37px in English, it needs to be 130px x 37px in German and around 70px X 37px for the Chinese version. You don't have this finer controls when creating a localized string files. The downside is, if you are editing a XIB (like adding another button) you have to add it to all the XIBs. The workaround is to design one XIB to cater to the widest language and use localized string files, but then, your UI will not look polished. So at the end it boils down to a "polished UI for the user" vs "extra development time" and you have to make that decision.

第二,某些语言(如阿拉伯语)从右到左,您必须自定义XIB的布局以反映这一点. (可能是表单,UILabel在右边,UITextFields在左边吗?)

Secondly, some languages like arabic are right to left and you have to customize the layout of the XIB to reflect that. (May be if it is a form, UILabel go on right and UITextFields on left?)

这篇关于本地化iOS项目的更好方法应该是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆