Retrieve data based on the app selected language

my app is almost ready, but there is an issue I’m not sure how to approach which is my app support Arabic and English. English is the main language of the app and users can change it from within app settings. my app provide services with name, price, and description that are in English. What I’m trying to do when the user changes the app language the Arabic data get retrieved, so If I added an other document for name, price, and description for the Arabic version. will be able to get the data ? ill share a screenshot and some code.
Note: I’m working with java

this one to get the service data from firebase and load them into a recylerview, I have an adapter and a model, which contain the name, price and decription.

Query query = db.collection("ServiceInfo");
    FirestoreRecyclerOptions<ServiceModel> options = new FirestoreRecyclerOptions.Builder<ServiceModel>()
            .setQuery(query, ServiceModel.class).build();
    adapter = new ServiceAdapter(options);

this is how my database is structured
enter image description here

enter image description here

thank you

  • I’m not sure I understand. What exactly in this code doesn’t work the way you expect? Tell us what is wrong with shared code. Do you have any errors?

    – 

  • the code snippet I shared works fine I added it so everyone knows how I retrieve the data from firebase.

    – 

  • I updated the question. check it again please

    – 

  • I still don’t understand what the problem is.

    – 

Leave a Comment