简体   繁体   English

如何设置Android应用程序的默认语言? (Appcelerator的)

[英]How do I set the default language of an Android App? (Appcelerator)

I'm currently developing an Android app with Appcelerator which is only in Spanish. 我目前正在使用Appcelerator开发仅使用西班牙语的Android应用。

My problem is that if the user doesn't have its smartphone in Spanish, strings from strings.xml won't show: 我的问题是,如果用户没有西班牙语的智能手机,strings.xml中的字符串将不会显示:

缺少strings.xml

How do I set Spanish as the default language of my app? 如何将西班牙语设置为应用程序的默认语言? I found a solution on the Appcelerator wiki, but it's just for iOS https://wiki.appcelerator.org/display/guides2/Internationalization#Internationalization-Setdefaultlanguage 我在Appcelerator Wiki上找到了一个解决方案,但这仅适用于iOS https://wiki.appcelerator.org/display/guides2/Internationalization#Internationalization-Setdefaultlanguage

English is the default translation for all Titanium apps, therefore the English files are mandatory. 英文是所有Titanium应用程序的默认翻译,因此英文文件是必需的。 If you just add the English folder to your i18n directory (inside the app directory) you should be good. 如果仅将English文件夹添加到i18n目录(在app目录中),那应该很好。

If your app is only going to be in Spanish, just add Spanish to that directory and everything should work everywhere. 如果您的应用仅使用西班牙语,则只需将西班牙语添加到该目录中,一切就可以在任何地方工作。

There is a ticket in the Appcelerator JIRA for adding support, there is also a way to override in the comments: https://jira.appcelerator.org/browse/TIMOB-20527 Appcelerator JIRA中有一张票证可用于添加支持,还有一种在注释中覆盖的方法: https : //jira.appcelerator.org/browse/TIMOB-20527

I would suggest, adding a translation in another language. 我建议添加另一种语言的翻译。 Simply go to Strings.xml and there on top right, you will find an option which says - "Open Editor". 只需转到Strings.xml,然后在右上角,您会找到一个选项-“打开编辑器”。 In editor, just type your translation of strings in another language(maybe English). 在编辑器中,只需用另一种语言(可能是英语)输入字符串的翻译即可。 This will make your app in both English and Spanish. 这将使您的应用程序同时使用英语和西班牙语。

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

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