Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MissingTranslation for default language ( "..." is not translated in "en")

I want to generate a signed apk and get following error:

Error:(65) Error: "..." is not translated in "en" (English) [MissingTranslation]

My projects ONLY contain default folders (no addon for an language) like values folder for example and ONE language, which is german (meaning, I have an values-de folder)

My default language is english, so all resources that do not belong to a special language should be the english ones.

QUESTIONS

Why is android studio telling me, it's missing the en language, although I don't have a single en-folder? Maybe an en-folder is part of a gradle import? Can I somehow exclude them? Actually, I don't know where the en comes from as I don't use it anywhere...

EXAMPLE

I only have values and values-defolder!

In values I have following:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="pause_alarms">
        <item>Silent</item>
        <item>Vibrate</item>
        <item>Sound</item>
        <item>Vibrate + Sound</item>
    </string-array>
</resources>

In values-de I have following:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="pause_alarms">
        <item>Leise</item>
        <item>Vibrieren</item>
        <item>Ton</item>
        <item>Vibrieren + Ton</item>
    </string-array>
</resources>
like image 893
prom85 Avatar asked Jan 23 '15 09:01

prom85


2 Answers

I don't know where the en comes from, but if I define the language of my default resources in the xml file like following

<resources
    xmlns:tools="http://schemas.android.com/tools"
    tools:locale="en">

the error disappears...

Probably, I just guess, some gradle imports have the en folder...

like image 196
prom85 Avatar answered Sep 30 '22 13:09

prom85


Maybe the build is getting confused by the string-array? It's good practice to have the array only in one values folder and define the strings as external resources. So instead of your entry, it's better to do this:

<string-array name="pause_alarms">
    <item>@string/silent</item>
    <item>@string/vibrate</item>
    ... etc ...
</string-array>

Then in res/values/strings.xml

<string name="silent">Silent</string>
<string name="vibrate">Vibrate</string>
 ... etc ...

and in res/values-de/strings.xml

<string name="silent">Leise</string>
<string name="vibrate">Vibrieren</string>
 ... etc ...

This way you don't have to keep 2 string-arrays up to date and sync'd in order, just the raw string values.

The "en" thing is weird - in the docs for localization, Google never mention English. They only ever talk about the "default" language. Makes sense, as values is language-neutral. You could write the default in Spanish and have a values-en folder, it wouldn't matter.

Other things to check - are you using local libraries in the project folder? Maybe they have resources in a values-en folder that are getting picked up and confusing the build system?

like image 21
richq Avatar answered Sep 30 '22 12:09

richq