简体   繁体   English

翻译工具

[英]Translation tool

我想知道是否可以在我的应用程序上使用可以将应用程序翻译成其他语言的功能,以便用户可以选择一系列语言,以便即使他不会说英语也可以阅读该应用程序,非常感谢

If you use the framework's localization facilities, this will happen automatically based on the user's language setting on their device 如果您使用框架的本地化工具,则会根据用户在其设备上的语言设置自动进行此操作

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

Basically, instead of using string literals in your code (ie. txt.setText("Something") or android:text="Something" ), you create these in your strings.xml file and use the automatically created reference id's. 基本上,不是在代码中使用字符串文字(即txt.setText("Something")android:text="Something" ),而是在strings.xml文件中创建这些android:text="Something" ,并使用自动创建的引用ID。

res/values/strings.xml: res / values / strings.xml:

<string name="something">Something</string>

Then, you create alternate res/values folders for the other languages you support and create a similar strings.xml file there. 然后,为您支持的其他语言创建备用res / values文件夹,并在其中创建类似的strings.xml文件。

res/values-es/strings.xml res / values-es / strings.xml

<string name="something">Algo</string>

Then your layouts and codes would have txt.setText(R.string.something) or android:text="@string/something" . 然后,您的布局和代码将具有txt.setText(R.string.something)android:text="@string/something"

You can do the same thing for drawable, layout, menu, etc. 您可以对可绘制,布局,菜单等执行相同的操作。

"to use a feature on my app that can translate the app to other languages" “在我的应用程序上使用可以将其翻译为其他语言的功能”

I do not think such feature exist from Google. 我认为Google不存在这种功能。 But if you write the app according Google's localization guide then you can use our Nativer app, which is designed exactly for that. 但是,如果您根据Google的本地化指南编写该应用程序,则可以使用专为此目的设计的Nativer应用程序。 It takes you language resources - translates with a machine and then let's the crowd to correct it. 它需要您的语言资源-用机器翻译,然后让人群来纠正它。 All these happens in runtime - so you do not need to bother when the language translation finished by the crowd. 所有这些都在运行时发生-因此,当人群完成语言翻译时,您无需打扰。 You can find further info here transround.com 您可以在这里找到更多信息transround.com

Peter 彼得

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM