Localisation error 'is translated here but not in default locale'
Asked Answered
N

3

10

I have created a values-fr and values-es and values.

The contents of values is english, but for each string I am getting this error:

<string name="cancel">Cancel</string>

it says: "cancel" is translated here but is not found in default locale and im not sure what this means.

values/strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation" tools:locale="en">

    <string translatable="false" name="app_name">Kendal Mintfest</string>
    <string name="action_settings">Settings</string>
    <string name="itin_string">Itinerary</string>
    <string name="event_string">Events</string>
    <string name="info_string">Info!</string>
    <string name="filerText">Note: Turning this option on will show only results on the selected day on the hour you select.</string>
    <string-array name="time_filter_array">
        <item>Friday 30th August</item>
        <item>Saturday 31st August</item>
        <item>Sunday 1st September</item>
    </string-array>
    <color name="Pink">#EC008B</color>
    <string name="okay">Okay</string>
    <string name="cancel">Cancel</string>
</resources>

values-fr/strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="action_settings">Paramètres</string>
    <string name="itin_string">itinéraire</string>
    <string name="event_string">Events</string>
    <string name="info_string">Info!</string>
    <string name="filerText">Remarque: Activer cette option affichera uniquement les r\ésultats le jour sélectionné à l\'heure que vous sélectionnez.</string>
    <string-array name="time_filter_array">
         <item>Vendredi 30 Août</item>
         <item>Samedi 31 Août</item>
         <item>dimanche 1er Septembre</item>
    </string-array>
    <color name="Pink">#EC008B</color>
    <string name="okay">OK</string>
    <string name="cancel">Annuler</string>
</resources>

values-es/strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="action_settings">Configuración</string>
    <string name="itin_string">Itinerario</string>
    <string name="event_string">Events</string>
    <string name="info_string">Info!</string>
    <string name="filerText">Nota: Al activar esta opción sólo mostrará los resultados en el día seleccionado en la hora de seleccionar.</string>
    <string-array name="time_filter_array">
         <item>Viernes 30 de agosto</item>
         <item>Sábado 31 de agosto</item>
         <item>Domingo 01 de septiembre</item>
    </string-array>
    <color name="Pink">#EC008B</color>
    <string name="okay">Okay</string>
    <string name="cancel">Cancelar</string>
</resources>

Note: the error I stated above happens on ALL of the values/strings.xml lines

Nertie answered 9/8, 2013 at 8:12 Comment(14)
When are you changing your language??? After click event of any item?Hypoderm
Nope, in the strings files in the IDE (so different folders for different languages)Nertie
Ok... Have you set string for cancel in all string.xml file?Hypoderm
Yep, no errors from the files just the values/strings.xml fileNertie
Ok..that means you are not adding cancel string in values/strings.xml folderHypoderm
The problem is, it is in the values/strings.xml folder, they all are :/Nertie
can you post your string.xml file for all three folders?Hypoderm
Updated my OP, sorry for the delay - internet problemsNertie
have you set Locale.US as default?Hypoderm
How do I go about doing that? Possibly not thenNertie
The XMLs should reside in the /res folder.Accompany
@JoopEggen the path of them is /res/values-fr/strings.xml, /res/values/strings.xml etcNertie
I started getting similar problems when I updated my Mac OS to Maveriks (a java update came up as well).Fawne
to me this started to appear when I added <resources xmlns:tools="schemas.android.com/tools" tools:locale="en"> instead of just <resources> in the translation files. If you add tools:ignore="ExtraTranslation" then it should disappear IMHOBeekman
B
6

To me this started to appear when I added <resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en"> instead of just <resources> in the translation files. If you add tools:ignore="ExtraTranslation" then it should disappear IMHO

Beekman answered 18/8, 2014 at 1:14 Comment(1)
Sure it disappear as Android Studio no longer check it. However, I noticed the resource definition is not available in code, and this error cannot be dismissed. Interestingly, building or launching debug works just fine, it's just the UI.Lidia
S
5

Try the below two things:

1)check in strings file if the key string name being used is not misspelled in another translate, or copied twice in same file.

2)Try clean Project and rebuild project also perform restarting Android Studio with invalidate cache and restart. Android Studio >> File >> Invalidate Caches/Restart...

click on invalidate cache and restart.

Steersman answered 14/12, 2018 at 13:36 Comment(0)
P
1

Make sure you have the string in the default locale. If you have it, try to delete the error line in the strings.xml and undo the deletion. If the string.xml is from a lib, delete the lib, sync, undo the deletion and sync again.

If the above step did not work, clean the project.

Peltry answered 8/1, 2019 at 20:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.