Given: a library that runs its windows, with its text fields and strings. There are three string.xml files for the Russian-speaking and English-speaking regions that localize these windows.

Required: to give the opportunity to localize these windows to users of the library. I cannot support all languages, which means I have to provide this opportunity to library users.

Solution: create a Java class that will contain all the lines. Lines will be filled with string resources (which allows Android to choose localization). The user will fill in these fields if required. Of course, this method is inconvenient, even with a small number of lines.


Question: how to enable the library user to localize it?

    2 answers 2

    Because you can redefine library resources, then you need to provide users with a list of them. They will be able to create a folder for the desired localization in their project and place the necessary strings for translation there. The app will take them from there.

    Those. in the README, provide a link to the library res/values/strings.xml (or a separate file if you don’t need to translate all the strings) and tell the user to take the strings from there and translate them in his project

    • 2
      Hah ... While writing the answer, you already answered :). It is a pity ... But oh well, I still put a plus sign! : D - Rostislav Dugin
    • one
      @RostislavDugin, multi turnip farm? =))) - YuriySPb
    • one
      What, what, and?) I collect a various repository? - Rostislav Dugin

    I was able to solve this problem by trying to create a strings.xml file in the project in the values-de folder for the German language. The project "picked up" these values.


    Total: the project library can use string resources of the project in which the library is used, provided that the project file strings.xml uses the same string names as in the library strings.xml file.