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:

I am encountering an issue with the translatable tag.
In my source file I have this kind of lines:

    <string name="language_de" translatable="false">Deutsch</string>

Thus, I also want them to remain in the target files. However, these lines disappear after export, and I’m not sure what setting to use to fix this.

Hi @countroll ! Are those strings visible in the Editor after the file import? Can you please share some screenshot on the matter? Please tell us the ID of the project and the name of the file.

Thanks in advance!

Hi Tania,

the project is countroll-app

I can see the strings after importing in both source file and target files
image

Dear @countroll !

Is there any chance that you could share with us your source file so we will be able to test everything from our side?

Looking forward to your kind reply,

yes, please tell me via which channel.

You can share to support@crowdin.com