Can localization resources be downloaded in runtime?

后端 未结 3 868
傲寒
傲寒 2021-01-02 15:48

I have application with internet access and don\'t want to store many string.xml files for different languages.

What I want:

  1. Application c
相关标签:
3条回答
  • 2021-01-02 16:35

    You obviously cannot change, download or remove strings.xml at runtime

    If you want to store locations, you will have to use SQLite storage to store translations.

    similar:
    How to modify strings.xml file at runtime
    run time modification of strings.xml

    0 讨论(0)
  • 2021-01-02 16:41

    Now I can see only solution:

    1. Create some "localization proxy" that will return me necessary resource (from string.xml or downloaded resource)
    2. Replace all getString() and getText() to your own method getStringFromLocalization
    3. Override TextView, Button and some other views with custom one and change there init and setText methods.
    0 讨论(0)
  • 2021-01-02 16:44

    Overriding the standered resource/language using resource files which are complied time then your scarifying performance over customization. Do it only if u need this.

    0 讨论(0)
提交回复
热议问题