问题描述
这是有一个多语言的应用程序的最佳方法是什么?我应该创建一组写在我的语言字符串,然后使用谷歌的API,在线翻译上的飞?任何code的例子吗?而且,如何获取用户,如何的语言来传递这个信息的API?
Which is the best way to have a multilanguage app?Should I create a set of strings written in my language and then use an google api that translates online on-the-fly? Any code example?And, how to get the language of the user and how to pass this information to the api?
推荐答案
我不相信在即时翻译的字符串;即使是最好的自动翻译可以产生不准确的输出。此外,增加了复杂性,开销和依赖相当数量的(例如,具有网络连接)通过处理转换这种方式。
I wouldn't trust on-the-fly translation of your strings; even the best automatic translators can produce inaccurate output. Additionally, you add a fair amount of complexity, overhead, and dependency (e.g., having a network connection) by handling translation this way.
有一个multilangauge应用程序(你叫吧)的问题是众所周知的,并且解决它的过程被称为internationalization和本地化 。一般来说,当你使用一个框架或编程语言,你可以看一下有关这个话题现有的包/库 - 这几乎是给定的,别人花了显著的时间建立一个良好的机制(S),以促进这一点。
The problem of having a "multilangauge app" (as you called it) is well-known, and the process of solving it is called internationalization and localization. In general, when you're working with a framework or programming language, you can look for existing packages/libraries relating to this topic -- it's almost a given that others have spent significant time building a good mechanism(s) to facilitate this.
的Android也不例外;它已经开发出本地化的支持内置。 Android的开发者文档有一个 COM prehensive指南的本地化,你应该看一看在。你仍然需要以某种方式翻译文本,但很多如何可以设置特定的邮件服务到用户的基础的已经奠定了你。
Android is no exception; it's been developed with localization support built-in. The Android Developer Documentation has a comprehensive guide on Localization that you should take a look at. You'll still need to translate your text somehow, but a lot of the "groundwork" of how you can serve up locale-specific messages to the user has already been laid out for you.
最后一个音符 - Android的文档还提供了一个名为教程您好,本地化 ,这将引导您完成创建本地化应用程序的基本知识。希望这有助于!
One last note -- the Android docs also provide a tutorial called "Hello, L10n", which walks you through the basics of creating a localized app. Hope this helps!
这篇关于多语言应用程序:最好的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!