Issue
I was wondering if anyone has seen if it is possible to get string resources from another directory. So by default my strings are in something like:
/MyProject/src/main/res/values
and translated languages in /MyProject/src/main/res/values-es
etc...
I would like to get my string resources from another file or sub-directory like:
/MyProject/sub-module/src/res/values
but also have it get values for translated languages the same: /MyProject/sub-module/src/res/values-es
I have looked around in the developer documents and other resources but have seen nothing about changing the directory of the strings resources.
Solution
The gradle tools let you move the entire res/
folder with everything in it, but not only the string resources. It's now possible to use sub-folders, so you if you're on Mac or Linux could probably make something work using symlinks.
Moving the entire res/
folder in gradle:
sourceSets {
main {
resources {
srcDir 'sub-module/src/res'
}
}
}
The symlinks approach (I haven't tried this, but it might work):
project/
src/
main/
java/
res/
values/
dimens.xml
strings/ <--- actually a symlink to another folder
strings.xml
values-en/
strings/ <--- actually a symlink to another folder
strings.xml
Answered By - Barend
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.