Is it possible to iterate over all strings of specific modules (or all except specific ones
No. There's no concept of "module" for resources.
As you already noticed these are all merged into one R
. So your only chance is to make keys unique (i.e. prefixed) and then skip all keys that are not prefixed during your walk, or you can create separate elements holding all the keys of strings from given module and work on it later, which should be faster than iterating over all, still painful to maintain. Or you can combine both, and build such filtered array based on prefix on startup and then work on it later if you need to access it more times.
EDIT
For example, iterate over both English and German strings ?
First, note that for most entries you will have the same keys (which obvious, but easy to overlook). And to iterate on both, you need to get the right resource context:
Resources rsrc = getResources();
Configuration config = new Configuration(rsrc.getConfiguration());
config.locale = Locale.US; //
Resources localeResources = new Resources(rsrc.getAssets(), rsrc.getDisplayMetrics(), config);
and then read as usual. And then repeat setting Locale.GERMAN
in config.
EDIT 2
also iterate over them in all supported languages
Theoretically AssetManager features getLocales():
Get the locales that this asset manager contains data for.
but things get tricky here when you realise that "contains data for" is not what you mean. It's sufficient to include i.e. external library which provides i.e. Greek translation too, to have Greek language also returned.
So the simplest approach may simply be to keep index of supported languages as part of your code be it directly in code or maybe as array in resources and rely on that whenever you want to know what languages your app support. This should
be easy to maintain and you can even create small gradle task to have you this
generated at build time.