Is there a way to get the number of strings in my strings.xml
or to check if all strings are available in the selected language?
-
1I guess you could parse it, but what's the use case? Why do you need this, what problem are you trying to solve? – Alex Florescu Mar 06 '12 at 15:01
-
I have an app which is availible in multiple languages and I want to ask the user for help translating if the current translation is less than a percentage complete. – Tobias Mar 06 '12 at 17:31
2 Answers
I don't think there is something in the public api. You can try with reflection since from strings.xml the R.string class is generated..
try this:
Field[] f = R.string.class.getDeclaredFields();

- 156,034
- 29
- 297
- 305
I don't think your approach is the best. If you are going to provide multiple languages, then probably the best way to store these in android is as alternative resources (see http://developer.android.com/guide/topics/resources/providing-resources.html and http://developer.android.com/guide/topics/resources/localization.html).
If you are going to do that, than you should be having translated resources of everything you need, so there isn't a question of partly translated content.
I think you'd be better off using a 3rd party crowd-sourced translation service and just prompt your users to that service for any languages that aren't yet ready to be included. Look at crowdin for an example of such a service. I know Friendcaster, for example, used this service to translate to multiple languages and it worked very well (e.g. https://crowdin.com/project/f-plus).

- 39
- 5

- 5,096
- 1
- 28
- 49
-
I already use crowdsourcing and that's the reason why I sometimes have to relese an update which is not a 100 percent translatet and therfore will display some string in english (which is my base language). So my idea was to show an popup asking for help if that is the case... – Tobias Mar 30 '12 at 19:47