-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Describe ios locales (#1886)
Fixes #1849 ## Test Plan Code is refactored according to the description in #1849 Needs clarification that it follows 100% the correct methodology for passing of values. ## Checklist - [x] Unit tested
- Loading branch information
Showing
11 changed files
with
38 additions
and
17 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
13 changes: 7 additions & 6 deletions
13
test_runner/src/main/kotlin/ftl/domain/DescribeIosLocales.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 |
---|---|---|
@@ -1,22 +1,23 @@ | ||
package ftl.domain | ||
|
||
import flank.common.log | ||
import ftl.api.Locale.Identity | ||
import ftl.api.Platform | ||
import ftl.api.fetchLocales | ||
import ftl.args.IosArgs | ||
import ftl.environment.getLocaleDescription | ||
import ftl.presentation.Output | ||
import ftl.run.exception.FlankConfigurationError | ||
import ftl.run.exception.FlankGeneralError | ||
import java.nio.file.Paths | ||
|
||
interface DescribeIosLocales { | ||
interface DescribeIosLocales : Output { | ||
val locale: String | ||
val configPath: String | ||
} | ||
|
||
fun DescribeIosLocales.invoke() { | ||
if (locale.isBlank()) throw FlankConfigurationError("Argument LOCALE must be specified.") | ||
log( | ||
fetchLocales(Identity(IosArgs.loadOrDefault(Paths.get(configPath)).project, Platform.IOS)).getLocaleDescription(locale) | ||
) | ||
|
||
fetchLocales(Identity(IosArgs.loadOrDefault(Paths.get(configPath)).project, Platform.IOS, locale)).find { | ||
it.id == locale | ||
}?.out() ?: throw FlankGeneralError("ERROR: '$locale' is not a valid locale") | ||
} |
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