Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strings.xml gives a translation error whenever I try to add a new string resource

Tags:

android

kotlin

The following is the only error message when i try to add a new string resource.

NOTE : I'm not doing any localization, there is only default values folder and adding string in strings.xml file only using extract string functionality of the android studio from my xml layout.

"string_name" is translated here but not found in default locale.

like image 320
Brijesh Joshi Avatar asked Jun 22 '18 13:06

Brijesh Joshi


People also ask

How do I add a new line to a string in xml?

Add \t for tab and \n for new line.

How do I open a string in xml?

In the Project > Android panel on the left, select ModuleName > res > values. Double-click strings. xml to open it for editing.

What is strings xml for?

String. xml file contains all the strings which will be used frequently in Android project. String. xml file present in the values folder which is sub folder of res folder in project structure.In Android Studio, we have many Views such as TextView,Button,EditText,CheckBox,RadioButton etc.

What is the purpose of strings XML file inside resource directory?

A string resource provides text strings for your application with optional text styling and formatting. There are three types of resources that can provide your application with strings: String. XML resource that provides a single string.


Video Answer


3 Answers

In newer Android Studio (v.3) any string named with dot will cause "... is translated here but not found in default locale" error. If your strings.xml has something like this

<string name="aaa.bbb">cccc</string>

you need to change it to

<string name="aaa_bbb">cccc</string>
like image 114
inmyth Avatar answered Oct 24 '22 02:10

inmyth


I did invalidate cache & restart, which solved my issue.

like image 22
Aba Avatar answered Oct 24 '22 04:10

Aba


Syncing project with gradle files solved my issue.

like image 1
memres Avatar answered Oct 24 '22 02:10

memres