How to avoid crashes due to missing row entries?

I have an application translated into 3 languages: English, German, Polish

So, I have three folders for languages ​​in the project:

values
strings.xml

values-en
strings.xml

values-de
strings.xml

values-pl
strings.xml

I realized that if I put all the lines in the values ​​folder and you still have some lines in the Polish version that the application crashes when accessing the missing lines in the Polish version.

I would suggest that the system simply gets a string from the default values ​​folder if it does not find it in the -pl values ​​folder.

Is there a way to catch these potential string flaws? EVen, if I can get a warning in the compiler that there is no line in any language, will it be OK?

EDIT AND ADD

Actually another line was missing by default ... so thanks for the answer / comments!

, strings.xml , . - .

, , de, en, pl, , , ( , , ).

, , . :

context.getString(R.string.MYTRING_abc),
+5
3

eclipse Window --> Properties --> Android --> Lint Error Checking Correctness:Messages MissingTranslation Error Severity. string.xml . refresh icon Link Warnings ( Outline window), .
, , Eclipse .

+3

, , -pl.

<string> s, <string-array> s. <string-array> , , . , XML , .

RES//misc.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Resources that are neither styles nor strings to be translated. -->
<resources>
  <string-array name="notification_line_content_entries">
    <item>@string/time_remaining</item>
    <item>@string/time_since_status_change</item>
    <item>@string/vital_signs</item>
  </string-array>
</resources>

, , .

, , , , res/values/.

+2

Android Studio:

Settings -> Editor -> Inspections -> (search for or find) Incomplete translation

info warning. Error create signed APK.

In my own experience, I get this error only when creating an assembly (not debugging via USB debugging, that is, when it is a signed assembly), but changing the incomplete translation to warning(so I get a notification about this is not complete, but it is not ignored if I just forgot) (or info, for that matter) it allows you to create an application, and it functions the same way as when debugging, when incomplete translations go to the default value.

But if you also had a debugging error, this should still work and prevent the crash when creating the APK.

0
source

All Articles