Comments (10)
@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.
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.
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.
I got some users reporting something similar. In this particular case he has these settings
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.
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.
@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.
@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.
@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.
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.
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)
- [Binary upload error] Multiple binaries with same code sign path HOT 3
- unchecked "use default language as locale" setting in OTA doesn't work HOT 2
- Two languages being returned when using "localeOverride" HOT 12
- Planning for OTA SwiftUI support? HOT 3
- String is not localised when running test plan with multiple configs HOT 4
- Preferred language automatically switch to Localization native development region HOT 5
- Xcode 14 preview error HOT 3
- tableName parameter is ignored, Phrase always returns from Localizable HOT 9
- New strings values are not available on updateTranslation completion handler HOT 11
- Can we get a new "Example App" HOT 3
- Translations from other tables are lost HOT 11
- Latencies after switching from 4.0.1 to 4.1.0 HOT 7
- Configure OTA with two different distributions HOT 3
- Support mac catalyst
- Support mac catalyst HOT 3
- Phrase App Inconsistency update error HOT 7
- Malformed Archive Error and SPM Compatibility Issue HOT 5
- Add Privacy Manifest file to library if needed HOT 5
- Phrase OTA on iOS native project, with KMP moko library HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ios-sdk.