-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement multiplatform strings on Spell detail (#253)
- Loading branch information
1 parent
c89b4fe
commit 0123354
Showing
16 changed files
with
297 additions
and
308 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
1 change: 0 additions & 1 deletion
1
...il/android/src/main/java/br/alexandregpereira/hunter/spell/detail/SpellDetailAnalytics.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
95 changes: 95 additions & 0 deletions
95
...tail/android/src/main/java/br/alexandregpereira/hunter/spell/detail/SpellDetailStrings.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,95 @@ | ||
package br.alexandregpereira.hunter.spell.detail | ||
|
||
import br.alexandregpereira.hunter.localization.AppLocalization | ||
import br.alexandregpereira.hunter.localization.Language | ||
|
||
interface SpellDetailStrings { | ||
val subtitle: (Int, String) -> String | ||
val castingTime: String | ||
val range: String | ||
val components: String | ||
val duration: String | ||
val saveType: String | ||
val concentration: String | ||
val atHigherLevels: String | ||
val savingThrowStrength: String | ||
val savingThrowDexterity: String | ||
val savingThrowConstitution: String | ||
val savingThrowIntelligence: String | ||
val savingThrowWisdom: String | ||
val savingThrowCharisma: String | ||
val schoolAbjuration: String | ||
val schoolConjuration: String | ||
val schoolDivination: String | ||
val schoolEnchantment: String | ||
val schoolEvocation: String | ||
val schoolIllusion: String | ||
val schoolNecromancy: String | ||
val schoolTransmutation: String | ||
val cantrip: String | ||
} | ||
|
||
internal data class SpellDetailEnStrings( | ||
override val subtitle: (Int, String) -> String = { level, school -> | ||
if (level == 0) "Cantrip, $school" else "Level $level, $school" | ||
}, | ||
override val castingTime: String = "Casting Time:", | ||
override val range: String = "Range:", | ||
override val components: String = "Components:", | ||
override val duration: String = "Duration:", | ||
override val saveType: String = "Saving Throw:", | ||
override val concentration: String = "Concentration", | ||
override val atHigherLevels: String = "At Higher Levels.", | ||
override val savingThrowStrength: String = "Strength", | ||
override val savingThrowDexterity: String = "Dexterity", | ||
override val savingThrowConstitution: String = "Constitution", | ||
override val savingThrowIntelligence: String = "Intelligence", | ||
override val savingThrowWisdom: String = "Wisdom", | ||
override val savingThrowCharisma: String = "Charisma", | ||
override val schoolAbjuration: String = "abjuration", | ||
override val schoolConjuration: String = "conjuration", | ||
override val schoolDivination: String = "divination", | ||
override val schoolEnchantment: String = "enchantment", | ||
override val schoolEvocation: String = "evocation", | ||
override val schoolIllusion: String = "illusion", | ||
override val schoolNecromancy: String = "necromancy", | ||
override val schoolTransmutation: String = "transmutation", | ||
override val cantrip: String = "Cantrip", | ||
) : SpellDetailStrings | ||
|
||
internal data class SpellDetailPtStrings( | ||
override val subtitle: (Int, String) -> String = { level, school -> | ||
if (level == 0) "Truque, $school" else "$level° círculo, $school" | ||
}, | ||
override val castingTime: String = "Tempo de Conjuração:", | ||
override val range: String = "Alcance:", | ||
override val components: String = "Componentes:", | ||
override val duration: String = "Duração:", | ||
override val saveType: String = "Salvaguarda:", | ||
override val concentration: String = "Concentração", | ||
override val atHigherLevels: String = "Em Níveis Superiores.", | ||
override val savingThrowStrength: String = "Força", | ||
override val savingThrowDexterity: String = "Destreza", | ||
override val savingThrowConstitution: String = "Constituição", | ||
override val savingThrowIntelligence: String = "Inteligência", | ||
override val savingThrowWisdom: String = "Sabedoria", | ||
override val savingThrowCharisma: String = "Carisma", | ||
override val schoolAbjuration: String = "abjuração", | ||
override val schoolConjuration: String = "conjuração", | ||
override val schoolDivination: String = "adivinhação", | ||
override val schoolEnchantment: String = "encantamento", | ||
override val schoolEvocation: String = "evocação", | ||
override val schoolIllusion: String = "ilusão", | ||
override val schoolNecromancy: String = "necromancia", | ||
override val schoolTransmutation: String = "transmutação", | ||
override val cantrip: String = "Truque", | ||
) : SpellDetailStrings | ||
|
||
fun SpellDetailStrings(): SpellDetailStrings = SpellDetailEnStrings() | ||
|
||
internal fun AppLocalization.getStrings(): SpellDetailStrings { | ||
return when (getLanguage()) { | ||
Language.ENGLISH -> SpellDetailEnStrings() | ||
Language.PORTUGUESE -> SpellDetailPtStrings() | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
...-detail/android/src/main/java/br/alexandregpereira/hunter/spell/detail/ui/LocalStrings.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,11 @@ | ||
package br.alexandregpereira.hunter.spell.detail.ui | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.compositionLocalOf | ||
import br.alexandregpereira.hunter.spell.detail.SpellDetailStrings | ||
|
||
internal val LocalStrings = compositionLocalOf { SpellDetailStrings() } | ||
|
||
internal val strings: SpellDetailStrings | ||
@Composable | ||
get() = LocalStrings.current |
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
Oops, something went wrong.