如何让android应用程序用中文显示(应用程序名称本地化)

对于ios来说则是非常简单的,创建一个本地化的路径  创建i18n这个路径 如下所示:

i18n/en/app.xml, i18n/es/app.xml, i18n/ja/app.xml 里面的文件如下所示:

en/app.xml里的内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="appname">Cat</string>
</resources>
es/app.xml里的内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="appname">Gato</string>
</resources>
ja/app.xml里的内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="appname"></string>
</resources>
 
 
但是如果在android下的话  则稍微要复杂点:
 
 
 
 

在values-en文件夹内的strings.xml文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="appname">HotSales</string>
</resources>

在values-zh文件夹内的strings.xml文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="appname">火速帮销售</string>
</resources>

然后修改已经存在的AndroidManifest.xml

我们需要添加自定义的 manifest file,看到上图所示的platform/android/AndroidManifest.xml

其实就是把AndroidManifest.xml文件里的内容复制进新建立的platform/android/AndroidManifest.xml内

change the android:label attributes of the<application> and <activity> elements from the defined value of your app name to the value@string/app_name

原文地址:https://www.cnblogs.com/ctriphire/p/2913208.html