Search code examples
androidlocalizationresourcesandroid-productflavors

Translatable attribute for flavor string resources


Hi fellow android developers,

My question is about flavor string resources best practices. My app has string resources that are translated in multiple languages including app name. However, I'm creating a new flavor which app name is not translatable.

Since I do not provide translations for the app name, I'm setting the translatable attribute to false in the new flavor default string resource but what I'm experiencing is that the app name takes the value of the translated value in my main folder.

main
  >res
    >values
    >values-fr
    >values-de
    >...

flavor
  >res
   >values (translatable attribute to false)

So I'm wondering if I have to duplicate my flavor string resource for all languages or if there is a best solution.

Thanks!


Solution

  • Ok, I found the answer by myself. I was managing flavors the wrong way.

    I had to create a flavor for my "default" app with the app name translations and remove translations from the "main" folder. So, now I don't have to provide any app name translation for the flavors I don't want to translate.

    main
      >res
        >values (translatable attribute to false)
    
    default flavor (with some translations)
      >res
        >values
        >values-fr
        >values-de
        >...
    
    new flavor
      >res
        >values (translatable attribute to false)