产品口味中的本地化

时间:2014-04-30 19:50:45

标签: android localization gradle android-productflavors

我有3种产品口味,每种口味的调试和发布,每一种都成功地给出了每个独特的字符串和图标。现在我正在准备本地化,每个产品的味道需要不同的字符串。这是我当前的文件夹/目录设置:

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

每个产品风格已经覆盖了默认的strings.xml。现在我需要我的西班牙语和法语字符串来覆盖每种产品风格的默认字符串。这是我假设我的文件夹/目录设置需要:

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

有人可以证实我的假设吗? 然后我必须找到最简单的方法来测试它而不会卡在手机上的外语上。

提前致谢, 德文

1 个答案:

答案 0 :(得分:2)

该结构看起来正确,请参阅http://developer.android.com/training/basics/supporting-devices/languages.html

您还可以使用Robotium(https://code.google.com/p/robotium/)帮助自动化测试以确认。