问题
I have 3 product flavors, debug and release for each flavor, each of which I have successfully given each unique strings and icons. Now I am preparing for Localization, which requires different strings for each product flavor. Here's my current folder/directory setup:
myApp/
src/
main/
res/
values/strings.xml
flav1Debug/
res/
values/strings.xml
flav1Release/
res/
values/strings.xml
flav2Debug/
res/
values/strings.xml
flav2Release/
res/
values/strings.xml
flav3Debug/
res/
values/strings.xml
flav3Release/
res/
values/strings.xml
Each product flavor is already overriding the default strings.xml. Now I need my Spanish and French strings to override the default strings for each product flavor. Here's what I'm assuming my folder/directory setup needs to be:
myApp/
src/
main/
res/
values/strings.xml
values-es/strings.xml
values-fr/strings.xml (repeated for each flavor below)
flav1Debug/
res/
values/strings.xml
flav1Release/
res/
values/strings.xml
flav2Debug/
res/
values/strings.xml
flav2Release/
res/
values/strings.xml
flav3Debug/
res/
values/strings.xml
flav3Release/
res/
values/strings.xml
Can someone confirm my assumption? Then I have to find the easiest way to test it without getting stuck on a foreign language on my phone.
Thanks in advance, Devin
回答1:
That structure looks right, see http://developer.android.com/training/basics/supporting-devices/languages.html.
You can also use Robotium (https://code.google.com/p/robotium/) to help automate testing to confirm.
来源:https://stackoverflow.com/questions/23396860/localization-within-product-flavors