简体   繁体   English

如何在我的android项目中找到所有String文字并将其移动到strings.xml文件

[英]How to find all String literal in my android project and move it to strings.xml file

I'm currently working on the Android project. 我目前正在从事Android项目。 I'm mostly put all the string literals in strings.xml file. 我主要将所有字符串文字放在strings.xml文件中。 But in few cases, I directly inserted few strings in Java file directly. 但是在少数情况下,我直接在Java文件中直接插入了几个字符串。

Now, I want to give multilingual support for my project. 现在,我想为我的项目提供多语言支持。 So, that I have to find all string literal in my android project and want to move it to strings.xml. 因此,我必须在我的android项目中找到所有字符串文字,然后将其移至strings.xml。 The manual process was too much time-consuming. 手动过程非常耗时。 Any other easy way to achieve this task in Android studio? 还有其他简单的方法可以在Android Studio中完成此任务吗?

You can achieve it like this: Go to >Analyze>Inspect code e click ok on the pop up, after a few minutes, inspection results will be visible, and you should find hardcoded strings under "Android>Lint>Internationalization-Hardcoded text" 您可以这样实现:转到>分析>检查代码,然后在弹出的窗口中单击确定,几分钟后,检查结果将可见,并且您应该在“ Android> Lint> Internationalization-Hardcoded text”下找到硬编码的字符串。 Android Lint

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

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