开发者

multilanguage app: best way? [closed]

开发者 https://www.devze.com 2023-02-12 04:35 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, v开发者_开发问答isit the help center for guidance. Closed 10 years ago.

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.

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 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.

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!


There can be two very different goals here:

  • an app that can run on different Android platforms, each set to a locale with a different language
  • an app running on a single platform that allows the user to select a different language within the app without there being a change to the platform locale

The former question is well supported and, as others have pointed out, discussed in the docs. The latter is not well supported (see here and here and here).

Depending on the locale(s) installed on the phone, supporting multiple languages within an app may also run into font problems. You may have to package your own fonts with the app (see, e.g., here). Even then there may be problems if the font rendering engine doesn't support the language (there have been lots of complaints about this for complex scripts like Arabic and Thai).


Android is designed with this problem in mind.

Check the official reference:

http://developer.android.com/guide/topics/resources/localization.html


You can create your strings in XML and insert them into iL10Nz.

In order to avoid context issues, it is good to have a screenshot for each strings that you are progressively creating. This will pay off with the languages you will translate into

Check http://www.myl10n.net

0

精彩评论

暂无评论...
验证码 换一张
取 消