简体   繁体   English

Android更改字符串语言

[英]Android change string language

I am using takephoto_library for selecting multiple images. 我正在使用takephoto_library选择多个图像。

https://github.com/crazycodeboy/TakePhoto https://github.com/crazycodeboy/TakePhoto

It is working properly but as you can see in the below screenshot, the caption is in Chinese. 它工作正常,但是如下面的屏幕截图所示,标题为中文。

I found that the view control is "com.darsh.multipleimageselect.activities" and Id of this caption is in the below 我发现视图控件是“ com.darsh.multipleimageselect.activities”,该标题的ID在下面

 actionBar.setTitle(R.string.album_view);

Is there any way to change this string to English? 有什么办法可以将此字符串更改为英语吗?

在此处输入图片说明

Try this . 尝试这个 。

find the strings.xml (values) and strings.xml(values-en) in the library of TakePhoto . TakePhoto的库中找到strings.xml (值)和strings.xml(values-en)

And change the string name to the English . 并将字符串名称更改为English。

In the strings.xml (values) strings.xml (值)

string name="add">确定</string>
<string name="selected">已选</string>
<string name="limit_exceeded">最多能选 %d 张</string>

And add this to the strings.xml (values-en) 并将其添加到strings.xml (values-en)

string name="add">confirm</string>
<string name="selected">selected</string>
<string name="limit_exceeded">You can choose%d at most</string>

And you can change this strings.xml(values-en) and strings.xml(values) 您可以更改strings.xml(values-en)strings.xml(values)

Is there any way to change this string to English? 有什么办法可以将此字符串更改为英语吗?

Yes, you can change all the Strings in strings.xml 是的,您可以更改strings.xml所有strings.xml

https://github.com/crazycodeboy/TakePhoto/blob/master/takephoto_library/src/main/res/values/strings.xml https://github.com/crazycodeboy/TakePhoto/blob/master/takephoto_library/src/main/res/values/strings.xml

Change these two chinese word to english 将这两个中文单词改为英语

<string name="add">确定</string>
<string name="selected">已选</string>

In English 用英语

 <string name="add">confirm</string>
 <string name="selected">selected</string>

For internationalization, android looks in different directories for the appropriate local as determined by your selection for the phone. 为了进行国际化,android将根据您对手机的选择在不同的目录中查找适当的本地名称。 For instance, you should see something like this: 例如,您应该看到以下内容:

./explorer/src/main/res/values-uk/strings.xml
./explorer/src/main/res/values-tr/strings.xml
./explorer/src/main/res/values-ru/strings.xml
./explorer/src/main/res/values-pl/strings.xml
./explorer/src/main/res/values-de/strings.xml
./explorer/src/main/res/values-ko/strings.xml
./explorer/src/main/res/values-sv/strings.xml
...

Where the translated strings are in the values-../strings as determined by the res/values/strings.xml. 转换后的字符串在由res / values / strings.xml确定的values-.. / strings中。 In my case, res/values/strings.xml has an entry: 就我而言,res / values / strings.xml中有一个条目:

<string name="createnewfolder">Create new folder</string>

which is translated in values-uk/strings.xml as 在values-uk / strings.xml中翻译为

<string name="createnewfolder">Нова папка</string>

You might find Localizing with Resources useful. 您可能会发现“ 使用资源本地化”很有用。

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

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