6

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.

Brijesh Joshi
  • 1,817
  • 1
  • 9
  • 24

5 Answers5

6

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>
inmyth
  • 8,880
  • 4
  • 47
  • 52
4

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

Aba
  • 2,307
  • 2
  • 18
  • 32
  • 1
    Yes That worked for me as well. Now it's not showing any error – Brijesh Joshi Nov 23 '18 at 04:48
  • 1
    I went to try this solution, but I just closed Android Studio instead of Invalidate cache & restart. That solved the problem for me. Another thing that worked was to Analyze->Inspect Code and select the resource file giving you this problem. In the inspection report you get, right click on the line with the error and select set properties. In the dialog you can disable "multiple translations". That solved the problem; but its problematic if you do want multiple translations. I couldn't find a more convenient way to get to the properties associated with resources. – Tom Rutchik Feb 19 '19 at 00:42
1

Syncing project with gradle files solved my issue.

memres
  • 439
  • 2
  • 9
0

On the top of the resources file add this:

<resources tools:ignore="ExtraTranslation" xmlns:tools="http://schemas.android.com/tools">

Worked for me.

f.trajkovski
  • 794
  • 9
  • 24
  • 1
    this is okay if you just have 1 language supported, but otherwise you'll run into an issue of not being warned of the missing string – kassim Dec 11 '18 at 09:23
-4

You should add a default string "string_name" to the strings.xml file.

strings.xml

<resources>
   <string name="string_name">default Test</string>
</resources>

Check you translate in Translations Editor

enter image description here

SergeyBukarev
  • 1,478
  • 1
  • 12
  • 19