Code Monkey home page Code Monkey logo

Comments (10)

DKalachniuk avatar DKalachniuk commented on August 20, 2024 1

@winkelsdorf i find a solution:

if i setup phrase like this
Phrase.shared.setup(distributionID: "", environmentSecret: "", localeOverride: Locale.current.languageCode)
with localeOverride parameter then it works as expected

from ios-sdk.

winkelsdorf avatar winkelsdorf commented on August 20, 2024

Hello @DKalachniuk,

sorry for the late response. Thanks for the report! We are currently trying to reproduce this and keep you updated.

Best regards

from ios-sdk.

winkelsdorf avatar winkelsdorf commented on August 20, 2024

Glad you found a working solution for you! We are planning some changes to make those overrides easier. As soon as I know more I'll post an update here.

from ios-sdk.

angelolloqui avatar angelolloqui commented on August 20, 2024

I got some users reporting something similar. In this particular case he has these settings
image

but they get the app in English, which is our default language, but we support Spanish and French too, so both should be picked before EN

I'll try @DKalachniuk suggestion and update the ticket if fixed

from ios-sdk.

angelolloqui avatar angelolloqui commented on August 20, 2024

UPDATE: Instead of the code provided before, I did this:

        let supportedLanguages = Bundle.main.localizations
        let preferredLanguage = Locale.preferredLanguages.first { pref in supportedLanguages.contains { pref.starts(with: $0) }}
        Phrase.shared.setup(distributionID: Constants.phraseAppOtaDistributionId,
                             environmentSecret: Constants.phraseAppOtaSecret)
                            environmentSecret: Constants.phraseAppOtaSecret,
                            localeOverride: preferredLanguage
        )

This way it will respect the preferred language from the user, even using a custom region like es-MX but only of those that are actually part of the bundle, so if some language is not supported it will take the next until one is found or then nil to have the default one.

from ios-sdk.

winkelsdorf avatar winkelsdorf commented on August 20, 2024

@DKalachniuk: We were able to reproduce this problem and will address it in the next release.

@angelolloqui: Thank you for the given code. Could you try using just
let preferredLanguage = Bundle.main.preferredLocalizations.first instead of your iterating code? It should give you the same result, a language code which fits the system/app preferences and the languages the bundle supports (in the right order).

from ios-sdk.

angelolloqui avatar angelolloqui commented on August 20, 2024

@winkelsdorf it is not the same thing. I believe your suggested method will not contain the "regional languages". For example, if your main language is ES-MX, your method will return ES only, so the mexican customizations are discarded (I havent checked, but when I researched on this solution this was the only combination that worked in my case, combining regions and supported languages

from ios-sdk.

winkelsdorf avatar winkelsdorf commented on August 20, 2024

@angelolloqui Thank you for your valuable feedback!

I now verified it to be working correctly, e.g. when the System is set to German, the System Region is set to Austria and the App Bundle contains de-AT. Bundle.main.preferredLocalizations then correctly returns de-AT with de as fallback in the returned array. If the bundle only supports de, then only de is returned, ignoring the region.

We are going to release a Beta of the upcoming 4.0 version of the SDK which implements that logic and fixes other side issues. But of course you will still be able to set an override like you did.

from ios-sdk.

winkelsdorf avatar winkelsdorf commented on August 20, 2024

I welcome everybody to test our latest RC which implements some changes related to our language detection logic. See: https://github.com/phrase/ios-sdk/releases/tag/4.0.1-rc.1.

from ios-sdk.

winkelsdorf avatar winkelsdorf commented on August 20, 2024

I am pleased to announce that v4.0.1 has just been released, which includes the improved language detection and fallback logic. I'm closing this ticket for now, if there are any questions about it, let us know - just reopen or create a new ticket.

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.