What does the translatable
at开发者_JAVA百科tribute, like translatable="false"
, mean?
This attribute points out that this attribute will be the same for all locales. Why is it useful?
- The localization files are more readable for human and saves time.
- It tells the Lint tool that everything is fine and that Android does not need to look for this resource translation.
Full explanation: http://tools.android.com/recent/non-translatablestrings
So, generally, this means if don't put this attribute, you should always localize this resource, otherwise tell people and compiler that this is unique for all locales by specifying this attribute.
If you are supporting multiple languages, and there are some strings which should not be translated (that means same across all languages) then you can use translatable="false"
For ex: Numbers<string name="account_setup_imap" translatable="false">IMAP</string>
Detailed Description
I've never heard of that attribute, but apparently (now) there's a reason for using it: see this post from ADT-Dev google group.
BTW, I just tried it and it works in fixing those Android Lint errors.
I don't see any reference to that in official docs, however, it probably is just an indicator for humans looking at the file that that particular string entity should not be translated.
If you have an Android app that you wish to internationalize, a common tactic is to just send your strings.xml file to translators. So that attribute would just be a flag for them.
精彩评论