moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

Base language do not work on iOS

Open PiotrPrus opened this issue 3 years ago • 0 comments

I set up the moko-resources as it is in the documentation. I have 2 targets: Android and iOS. Android works well with 2 supported languages("en", "pl"), but iOS shows only "pl" which is super weird, cause the "pl" is not a base language. Additionally, when I set the phone to other language(ex. Spanish), all the text displays keys, not translated texts..

Here is my gradle file:

plugins {
    kotlin("multiplatform")
    id("com.android.library")
    id("kotlinx-serialization")
    id("com.codingfeline.buildkonfig")
    id("com.squareup.sqldelight")
    id("dev.icerock.mobile.multiplatform-resources")
}

kotlin {
    android()

    ios {
        binaries {
            framework {
                baseName = "shared"
                export(project(":domain"))
                export("dev.icerock.moko:resources:${Versions.mokoResources}")
            }
        }
    }

    // export correct artifact to use all classes of moko-resources directly from Swift
    targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java).all {
        binaries.withType(org.jetbrains.kotlin.gradle.plugin.mpp.Framework::class.java).all {
            export("dev.icerock.moko:resources:${Versions.mokoResources}")
        }
    }
}
...
multiplatformResources {
    multiplatformResourcesPackage = "org.airly.shared" // required
    multiplatformResourcesClassName = "SharedRes" // optional, default MR
    iosBaseLocalizationRegion = "en"
}

PiotrPrus avatar Sep 20 '22 20:09 PiotrPrus