Prevent localization warning on a string in Android

Lint might warn you that some resources are not localized. Sometimes you need to put a string in a resource so that it can be referenced from another xml and read from code without duplicating the string value (error prone). You want also to make sure that this string will not be localized. An example I use sometimes is to put dummy key string in a preference activity

A good reference is here: http://tools.android.com/recent/non-translatablestrings
According to the doc, this is all you need:

<string name="app_homeurl" translatable="false">http://my/app/home.html</string>


According to Android translation service there is also a way to mark a whole string or a part of a string not translatable (http://developer.android.com/distribute/googleplay/publish/localizing.html)

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
 <!-- Example placeholder for a for a URL -->
 <string name="app_homeurl">
  Visit <xliff:g id="app_homepage">http://my/app/home.html</xliff:g>
 </string>
</resources>

Popular posts from this blog

Simple Samba setup on Lubuntu

Soving AccessDenied on Google Cloud Storage domain mapping

Install Maven 3.1.1 on Ubuntu 13.10