Slide 19
Slide 19 text
Fail fast, Fail cheap, Fail automatically: Localization
Test to match placeholders in default strings with others
@RunWith(RobolectricTestRunner::Class)
class PlaceholderTest {
private val strings: MutableMap = HashMap() // default strings
private val placeholderPattern: Pattern = Pattern.compile(“.*\\{.+}.*”)
private val locales: List = arrayListOf(“en”, “fr”, “ja”)
private val optionalPlaceholders: Map> = hashMapOf(
Pair(R.string.text_having_optional_placeholder, arrayListOf(“{optional}”)),
// ……
)
// ……
}
19
Shibuya.apk #21