Sergei Ledvanov
Sergei Ledvanov

Reputation: 2251

Alternative strings.xml is mandatory?

I have the followint structure of my Android project

res/values/strings.xml
res/values/arrays.xml

and language specific

res/values-en-rUS/arrays.xml

(notice that I do not have strings.xml in en-rUS folder)

When I run Android lint on my project, it returns an error because I do not have language keys defined in en-rUS folder, though it is permitted according to this doc

UPDATE: the question is, what should I do in order to have my project compiled without errors? Should I just re-configure LINT to show these errors as warnings and that's it? Is this the right way to proceed?

Upvotes: 0

Views: 220

Answers (1)

Sam Dozor
Sam Dozor

Reputation: 40724

No, it's not mandatory. It's just a warning that you have some set of resources defined for the default locale, and some others for en-rUS. As long as all of the resources that are defined for en-rUS are also defined for the default locale, your app will not crash due to a missing resource. If, on the other hand, you define resources for en-rUS that you haven't defined for the default locale, and at runtime you request those resources in any locale other than en-rUS, your app will throw a resource NotFoundException, or perhaps some other crash/error depending on how you're trying to use the missing resource. Lint is just trying to warn you.

As Niek said in the comments of this answer, you can customize the severity level that lint assigns, changing it from an error to warning, if even ignoring it.

Upvotes: 2

Related Questions