Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Get and Save Localised String From Web API

Discussion in 'Localization Tools' started by Skibitsky, Dec 27, 2021.

  1. Skibitsky

    Skibitsky

    Joined:
    Mar 22, 2016
    Posts:
    24
    Hello,

    We have a content management system with the REST API that we would like to use to manage some localised strings in our project. After strings have been changed in the CMS, the player should be able to download updated strings for active locale and cache for the later use. When the player changes the active locale, it would also need to update strings for the new locale.

    After doing some research, I ended up with the 2 approaches we can take:
    1. On the app launch, get content from the CMS, save it into player preferences, and then inject all values into StringTables. If the app is offline, use the cached version from player preferences or whatever StringTables already have inside.
    2. Have an Extension, similar to GoogleSheetsExtension, that would pull strings from the CMS. Then we build Addressables and put artefacts on the server, so the players could use content update functionality of the Addressable system to get updated strings.

    I probably could also use custom IResourceProvider, but as I understand, it doesn’t provide persistence for updated content. There is very little documentation on resource providers available, so I may be wrong.

    Is there a better way of achieving our goal apart from what I described above?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,226
    I cant think of anything else, you have summed up the 2 main ways I would suggest. I would say both are good approaches. Number 1 is probably simpler for when you need to make small patches for little changes as you can then only pull the new data and not the entire table.
     
    Skibitsky likes this.