0

I am implementing Remote Config in my app. The idea is to be able to A/B test some of the messages shown to the user.

I might want to run some of the experiments with the English messages only and I am trying to figure out what is the best (or most practical) way to do this.

  1. One way would be having an xml file with default values for each language in the res/xml- directory. The main drawback I see is that this will be hard to maintain as every single value needs to be copied to all the xml files (some experiments might be language independent such as a layout color).
  2. A second way would be setting language dependent values to an empty string and then implement some logic to look for the right string in R.strings if the value provided by remote config is empty. This seems like too much overhead for what I want to accomplish.

What is the recommended way to run experiments only for a certain language with A/B testing and Remote Config?

ig343
  • 277
  • 1
  • 3
  • 17
  • It is possible to target an App Instance using device language for both Remote Config conditions and Remote Config experiments. – Sinan Kadavath Oct 01 '19 at 23:37

1 Answers1

-1
  1. It is a default way in android to provide a localized string resources. Is hard to maintain but there are a service which can help you https://phraseapp.com/ . They have a lot of nice features, like manual translation, cross platform app and ide plugins which can replace/add/append/remove new strings to your xml localized files, also it works for ios.

  2. You can keep string resources name in remote config and load it by some kid of reflection. Here is an nice answer How to get a resource id with a known resource name? . Here is an example for your case:

      int resourceId = context.getResources().getIdentifier(nameFromRemoteConfig, "string", context.getPackageName())
    

Localization a very static logic, boring and expensive process in terms of time and maintaining. From my point of view better solution is to develop your own maximum abstract mechanism for localization and reuse it in all your projects. For example a backend service or library which will provide localized data by your own format, and a library for clients which will deserialize that data. As a result you will obtain production ready api for future projects.

Link182
  • 733
  • 6
  • 15