Localization error 'translates here, but not to the default locale'

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

The contents of the values are English, but for each line I get this error:

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

he says: "cancel" is translated here but is not found in default locale and im not sure what that 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 mentioned above occurs in ALL lines of values/strings.xml

+6
source share
3 answers

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

+4
source

Try the following two things:

1) check in the line file whether the name of the key line with an error is used in another translation or is double copied to the same file.

2) Try clearing Project and rebuilding the project, as well as restarting Android Studio with invalidating the cache and rebooting. Android Studio >> File >> Invalid caches / restart ...

click on void cache and restart.

+3
source

Make sure you have the line in the default locale. If you have one, try deleting the error line in strings.xml and discard the deletion. If string.xml is from the lib library, uninstall lib, sync, undo the deletion, and re-sync.

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

0
source

Source: https://habr.com/ru/post/1496096/


All Articles