-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #470 from colintheshots-meetup/develop
Fix #118: Fill in missing string translations with base translation
- Loading branch information
Showing
8 changed files
with
98 additions
and
4 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
47 changes: 47 additions & 0 deletions
47
resources/src/iosTest/kotlin/dev/icerock/moko/resources/desc/AppleLocalizationBundleTests.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,47 @@ | ||
/* | ||
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package dev.icerock.moko.resources.desc | ||
|
||
import dev.icerock.moko.resources.StringResource | ||
import platform.Foundation.NSBundle | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class AppleLocalizationBundleTests { | ||
|
||
@Test | ||
fun localizedStringWithLocalizationCaseTest() { | ||
val resource = StringResource( | ||
resourceId = "noResultsFound", | ||
bundle = NSBundle.bundleWithPath(NSBundle.mainBundle.bundlePath + "/tests.bundle")!! | ||
) | ||
StringDesc.localeType = StringDesc.LocaleType.Custom("es-US") | ||
val stringDesc = ResourceStringDesc( | ||
resource | ||
) | ||
assertEquals( | ||
expected = "No se han encontrado resultados", | ||
actual = stringDesc.localized() | ||
) | ||
StringDesc.localeType = StringDesc.LocaleType.System | ||
} | ||
|
||
@Test | ||
fun localizedStringMissingLocalizationCaseTest() { | ||
val resource = StringResource( | ||
resourceId = "noInternetConnection", | ||
bundle = NSBundle.bundleWithPath(NSBundle.mainBundle.bundlePath + "/tests.bundle")!! | ||
) | ||
StringDesc.localeType = StringDesc.LocaleType.Custom("es-US") | ||
val stringDesc = ResourceStringDesc( | ||
resource | ||
) | ||
assertEquals( | ||
expected = "No internet connection", | ||
actual = stringDesc.localized() | ||
) | ||
StringDesc.localeType = StringDesc.LocaleType.System | ||
} | ||
} |
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
2 changes: 2 additions & 0 deletions
2
...rces/src/iosTest/resources/tests.bundle/Contents/Resources/Base.lproj/Localizable.strings
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,2 @@ | ||
"noResultsFound" = "No results found"; | ||
"noInternetConnection" = "No internet connection"; |
1 change: 1 addition & 0 deletions
1
...ces/src/iosTest/resources/tests.bundle/Contents/Resources/es-US.lproj/Localizable.strings
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 @@ | ||
"noResultsFound" = "No se han encontrado resultados"; |
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