Android / translatable="false"

In my Android project I defined the following string resource in the default language folder (res/values/):

  • <string name="preference_default_value_alternative_schedule_url" translatable="false" />

The value for the key is empty. Hence there is nothing to translate.

When I look at the translations I was surprised to find the string resources there (e.g. res/values-sv/), too:

  • <string name="preference_default_value_alternative_schedule_url" translatable="false"></string>

Questions

  1. Why is a string resource marked as translatable="false" added to other languages?
  2. Why is the XML tag for an empty string not collapsed as in />?

Hello,

  1. This is a general recommended workflow which we have implement, I never heard that it breaks the code or changes somethings in an application. For mobile development I can suggest you enabling skip stings option in project export settings:

Project Settings | Crowdin Documentation.

  1. Those are 2 ways to do the same thing and receive same result.
1 Like
  1. Thank you. I added skip_untranslated_strings to my configuration file so it is picked up by the CLI client. It works. Interestingly, the setting does two things:

    1. it excludes strings attributed with translatable="false"
    2. it excludes strings which have not been translated

    The first effect was not clear to me from the documentation. Maybe it is worth rephrasing the paragraph a little.

  2. Not exactly. In Android Studio, by default the Lint tool highlights empty XML tags which use a closing tag like </string> with a warning:

    This leaves the developer with the burden of handling the warning. Depending on the project configuration this can break a build.

Thanks for your notice, we’ll consider your comments regarding the documentation.

Regarding 2nd, I’m sure there is a logical explanation for why our system works that way, otherwise, we should already have received many complaints about that :slight_smile: