-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
238 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
iosApp/Survey/Resources/Localizations/en.lproj/Localizable.strings
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
iosApp/Survey/Sources/Supports/Extensions/MokoResources/StringResource+Localized.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// StringResource+Localized.swift | ||
// Survey | ||
// | ||
// Created by Bliss on 18/10/22. | ||
// Copyright © 2022 Nimble. All rights reserved. | ||
// | ||
|
||
import Shared | ||
|
||
typealias LocalizeId = MR.strings | ||
|
||
extension StringResource { | ||
|
||
var localized: String { | ||
desc().localized() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,3 @@ | |
|
||
typealias Assets = R.image | ||
typealias Fonts = R.font | ||
typealias Localize = R.string.localizable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/presentation/helpers/MokoLocalize.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package co.nimblehq.blisskmmic.presentation.helpers | ||
|
||
import co.nimblehq.blisskmmic.MR | ||
import dev.icerock.moko.resources.AssetResource | ||
import dev.icerock.moko.resources.ResourceContainer | ||
import dev.icerock.moko.resources.StringResource | ||
import dev.icerock.moko.resources.desc.Resource | ||
import dev.icerock.moko.resources.desc.StringDesc | ||
|
||
class MokoLocalize { | ||
fun localize(id: String?): StringDesc? { | ||
if (id == MR.strings.common_error.toString()) { | ||
return StringDesc.Resource(MR.strings.common_error) | ||
} | ||
return null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="common_error">An error occurred. Please try again.</string> | ||
<string name="login_fields_email">Email</string> | ||
<string name="login_fields_password">Password</string> | ||
<string name="login_button_login">Log in</string> | ||
<string name="login_button_forgot">Forgot?</string> | ||
<string name="reset_password_field_email">Email</string> | ||
<string name="reset_password_text_instruction">Enter your email to receive instructions for resetting your password.</string> | ||
<string name="reset_password_button_reset">Reset</string> | ||
</resources> |
16 changes: 16 additions & 0 deletions
16
shared/src/commonTest/kotlin/co/nimblehq/blisskmmic/presentation/helpers/MokoLocalizeTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package co.nimblehq.blisskmmic.presentation.helpers | ||
|
||
import co.nimblehq.blisskmmic.MR | ||
import dev.icerock.moko.resources.desc.Resource | ||
import dev.icerock.moko.resources.desc.StringDesc | ||
import io.kotest.matchers.shouldBe | ||
import kotlin.test.Test | ||
|
||
class MokoLocalizeTest { | ||
|
||
@Test | ||
fun `When calling localize with common_error desc, it returns correct StringDesc`() { | ||
StringDesc.Resource(MR.strings.common_error) shouldBe | ||
MokoLocalize().localize(MR.strings.common_error.toString()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters