iosswiftlocalizationotaphrase

How & Where to Locate Phrase OTA downloaded translation files?


I've implemented the 'Phrase' SDK to simply 'push and pull' translations, it's working fine.

Now while implementing PhraseSDK(OTA version), I am able to update the translations as well using Phrase.shared.updateTranslations method during run-time.

Next, when I clear my local translation files content, example, from inside en.lrpoj/Localizable.strings and es.lproj/Localizable.strings, I'm still able to see the Translations since the OTA SDK has stored the updated translations somewhere, separate to the default .lproj files.

BTW, this is how it is suppose to work, because OTA downloaded translations takes precedence over local translations.

Now I want to know where does this Phrase OTA SDK stores those Translations, because I couldn't find it inside document directory.

Reference: iOS App Translation Over the Air with Phrase


Solution

  • The downloaded translations are stored inside of the sandboxed Application Support Directory as recommended by Apple.

    The complete folder is composed like this:

    └── Application Support
        └── PhraseSDK
            └── Translations
                └── [Release Version Number]
                    ├── en.lproj
                    │   ├── Localizable.strings
                    │   └── Localizable.stringsdict
                    └── ...
                        ├── Localizable.strings
                        └── Localizable.stringsdict
    

    Access the Application Support like usually done, e.g. using FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first.

    Append the Path Components for PhraseSDK and Translations afterwards. The Release Number depends on what is set in the Backend and updates automatically.

    If you want to remove all downloaded translations you could remove everything inside Translations if you like, but please be aware that this should never happen during a running download (despite errors being catched, this might lead to unknown side-effects).

    But we're also checking if the known release version is available in the file system, if not a re-download is triggered anyway.

    hth!