applying english override for the last carousel page copy

This commit is contained in:
Adam Brown 2022-01-11 14:42:18 +00:00
parent b137009e6e
commit fbe60f5a52
5 changed files with 21 additions and 7 deletions

View file

@ -27,3 +27,5 @@ class LocaleProvider @Inject constructor(private val resources: Resources) {
return ConfigurationCompat.getLocales(resources.configuration)[0] return ConfigurationCompat.getLocales(resources.configuration)[0]
} }
} }
fun LocaleProvider.isEnglishSpeaking() = current().language.startsWith("en")

View file

@ -21,14 +21,17 @@ import androidx.annotation.AttrRes
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.epoxy.charsequence.EpoxyCharSequence import im.vector.app.core.epoxy.charsequence.EpoxyCharSequence
import im.vector.app.core.epoxy.charsequence.toEpoxyCharSequence import im.vector.app.core.epoxy.charsequence.toEpoxyCharSequence
import im.vector.app.core.resources.LocaleProvider
import im.vector.app.core.resources.StringProvider import im.vector.app.core.resources.StringProvider
import im.vector.app.core.resources.isEnglishSpeaking
import im.vector.app.features.themes.ThemeUtils import im.vector.app.features.themes.ThemeUtils
import me.gujun.android.span.span import me.gujun.android.span.span
import javax.inject.Inject import javax.inject.Inject
class SplashCarouselStateFactory @Inject constructor( class SplashCarouselStateFactory @Inject constructor(
private val context: Context, private val context: Context,
private val stringProvider: StringProvider private val stringProvider: StringProvider,
private val localeProvider: LocaleProvider,
) { ) {
fun create() = SplashCarouselState(listOf( fun create() = SplashCarouselState(listOf(
@ -51,13 +54,20 @@ class SplashCarouselStateFactory @Inject constructor(
R.drawable.bg_carousel_page_3 R.drawable.bg_carousel_page_3
), ),
SplashCarouselState.Item( SplashCarouselState.Item(
R.string.ftue_auth_carousel_4_title.colorTerminatingFullStop(R.attr.colorAccent), collaborationTitle().colorTerminatingFullStop(R.attr.colorAccent),
R.string.ftue_auth_carousel_4_body, R.string.ftue_auth_carousel_4_body,
R.drawable.ic_splash_collaboration, R.drawable.ic_splash_collaboration,
R.drawable.bg_carousel_page_4 R.drawable.bg_carousel_page_4
) )
)) ))
private fun collaborationTitle(): Int {
return when {
localeProvider.isEnglishSpeaking() -> R.string.cut_the_slack_from_teams
else -> R.string.ftue_auth_carousel_4_title
}
}
private fun Int.colorTerminatingFullStop(@AttrRes color: Int): EpoxyCharSequence { private fun Int.colorTerminatingFullStop(@AttrRes color: Int): EpoxyCharSequence {
val string = stringProvider.getString(this) val string = stringProvider.getString(this)
val fullStop = "." val fullStop = "."

View file

@ -14,6 +14,9 @@
<!-- Temporary string --> <!-- Temporary string -->
<string name="template_not_implemented" translatable="false">Not implemented yet in ${app_name}</string> <string name="template_not_implemented" translatable="false">Not implemented yet in ${app_name}</string>
<!-- onboarding english only word play -->
<string name="cut_the_slack_from_teams" translatable="false">Cut the slack from teams.</string>
<!-- WIP strings, will move to strings.xml when signed off --> <!-- WIP strings, will move to strings.xml when signed off -->
<string name="ftue_auth_use_case_title" translatable="false">Who will you chat to the most?</string> <string name="ftue_auth_use_case_title" translatable="false">Who will you chat to the most?</string>
<string name="ftue_auth_use_case_subtitle" translatable="false">We\'ll help you get connected.</string> <string name="ftue_auth_use_case_subtitle" translatable="false">We\'ll help you get connected.</string>
@ -24,5 +27,4 @@
<string name="ftue_auth_use_case_skip_partial" translatable="false">You can skip this question</string> <string name="ftue_auth_use_case_skip_partial" translatable="false">You can skip this question</string>
<string name="ftue_auth_use_case_join_existing_server" translatable="false">Looking to join an existing server?</string> <string name="ftue_auth_use_case_join_existing_server" translatable="false">Looking to join an existing server?</string>
<string name="ftue_auth_use_case_connect_to_server" translatable="false">Connect to server</string> <string name="ftue_auth_use_case_connect_to_server" translatable="false">Connect to server</string>
</resources> </resources>

View file

@ -2525,7 +2525,8 @@
<string name="ftue_auth_carousel_2_title">You\'re in control.</string> <string name="ftue_auth_carousel_2_title">You\'re in control.</string>
<string name="ftue_auth_carousel_2_body">Element lets you choose where your messages are stored, keeping you in control of your data.</string> <string name="ftue_auth_carousel_2_body">Element lets you choose where your messages are stored, keeping you in control of your data.</string>
<string name="ftue_auth_carousel_3_title">Secure Messaging.</string> <string name="ftue_auth_carousel_3_title">Secure Messaging.</string>
<string name="ftue_auth_carousel_3_body">No phone number required, so you don\'t have to share those details with the outside world. No ads, no tracking or datamining.</string> <string name="ftue_auth_carousel_3_body">No phone number required, so you don\'t have to share those details with the outside world. No ads, no datamining.</string>
<!-- Todo replace with literal english translation -->
<string name="ftue_auth_carousel_4_title">Cut the slack from teams.</string> <string name="ftue_auth_carousel_4_title">Cut the slack from teams.</string>
<string name="ftue_auth_carousel_4_body">As universal as email, Element is a completely new type of collaboration.</string> <string name="ftue_auth_carousel_4_body">As universal as email, Element is a completely new type of collaboration.</string>
@ -3657,8 +3658,8 @@
<!-- %s will be replaced by the value of link_this_email_settings_link and styled as a link --> <!-- %s will be replaced by the value of link_this_email_settings_link and styled as a link -->
<string name="link_this_email_with_your_account">%s in Settings to receive invites directly in Element.</string> <string name="link_this_email_with_your_account">%s in Settings to receive invites directly in Element.</string>
<string name="labs_enable_latex_maths">Enable LaTeX mathematics</string> <string name="labs_enable_latex_maths">Enable LaTeX mathematics</string>
<string name="restart_the_application_to_apply_changes">Restart the application for the change to take effect.</string> <string name="restart_the_application_to_apply_changes">Restart the application for the change to take effect.</string>
<!-- Poll --> <!-- Poll -->
<string name="create_poll_title">Create Poll</string> <string name="create_poll_title">Create Poll</string>

View file

@ -9,5 +9,4 @@
<string name="resources_country_code">US</string> <string name="resources_country_code">US</string>
<!-- Value MUST have 4 letters and MUST be in this list: https://www.unicode.org/iso15924/iso15924-codes.html. Example: "Arab", "Cyrl", "Latn", etc. --> <!-- Value MUST have 4 letters and MUST be in this list: https://www.unicode.org/iso15924/iso15924-codes.html. Example: "Arab", "Cyrl", "Latn", etc. -->
<string name="resources_script">Latn</string> <string name="resources_script">Latn</string>
</resources> </resources>