Code Monkey home page Code Monkey logo

Comments (3)

BVantur avatar BVantur commented on August 20, 2024

We solve that with our custom handling of fetching resources from the correct bundle. Whenever we tried to fetch from local data we used the moko bundle, and when we tried to use Phrase OTA data, we used the iOS app bundle.

from ios-sdk.

theSoenke avatar theSoenke commented on August 20, 2024

Hi @BVantur, that's great to hear that both SDKs already work almost out of the box with KMP! Would you mind sharing the snippet that you use to use the correct bundle on iOS if that's possible? I would like to make sure that the KMP support is also properly documented

from ios-sdk.

BVantur avatar BVantur commented on August 20, 2024

Yeah, sure.
We have a strange behavior in our app and I am not even sure if the above issue is a valid issue that we observed, In the end, what we needed to do with the iOS part of the app, is to use 2 different bundles in our LocalizationManager class.

For moko-based strings that we want to use in a case when there were no Phrase OTA texts present, we used this bundle:
SharedRes.strings().__platformDetails.nsBundle

But for Phrase OTA texts we needed to use a bundle depending on the language with the URL like this:

let phrasePath = "com.phrase.phraseSDK/Translations/\(languageCode).lproj"
let languageDirectoryURL = applicationSupportDirectory.appendingPathComponent(phrasePath, isDirectory: true)
return languageDirectoryURL
Bundle(url: languageDirectoryURL)

In our LocalizationManager we are always trying to read Phrase OTA text first and if it doesn't exist we fall back to a bundle that has strings from the moko library.

I hope this comment will help someone who might end up in the same situation.

from ios-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.