Localization within product flavors

孤人 提交于 2019-12-31 03:58:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!