Adjusted Landing page string substitutions to cater for emojis

This commit is contained in:
alansley 2024-08-27 15:33:55 +10:00
parent 4809b5444b
commit a402a1be79
4 changed files with 44 additions and 18 deletions

View File

@ -18,7 +18,9 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import com.squareup.phrase.Phrase
import network.loki.messenger.R
import org.session.libsession.utilities.NonTranslatableStringConstants.WAVING_HAND_EMOJI
import org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.EMOJI_KEY
import org.thoughtcrime.securesms.ui.Divider
import org.thoughtcrime.securesms.ui.theme.LocalColors
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
@ -49,7 +51,10 @@ internal fun EmptyView(newAccount: Boolean) {
Text(
stringResource(R.string.onboardingBubbleWelcomeToSession).let { txt ->
val c = LocalContext.current
Phrase.from(txt).put(APP_NAME_KEY, c.getString(R.string.app_name)).format().toString()
Phrase.from(txt)
.put(APP_NAME_KEY, c.getString(R.string.app_name))
.put(EMOJI_KEY, WAVING_HAND_EMOJI)
.format().toString()
},
style = LocalType.current.base,
color = LocalColors.current.primary,

View File

@ -37,7 +37,10 @@ import androidx.compose.ui.unit.dp
import com.squareup.phrase.Phrase
import kotlinx.coroutines.delay
import network.loki.messenger.R
import org.session.libsession.utilities.NonTranslatableStringConstants.BACKHAND_INDEX_POINTING_DOWN_EMOJI
import org.session.libsession.utilities.NonTranslatableStringConstants.WAVING_HAND_EMOJI
import org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.EMOJI_KEY
import org.thoughtcrime.securesms.ui.AlertDialog
import org.thoughtcrime.securesms.ui.DialogButtonModel
import org.thoughtcrime.securesms.ui.GetString
@ -132,12 +135,28 @@ internal fun LandingScreen(
key = { it.stringId }
) { item ->
// Perform string substitution only in the bubbles that require it
val bubbleTxt = if (item.stringId == R.string.onboardingBubbleWelcomeToSession ||
item.stringId == R.string.onboardingBubbleSessionIsEngineered) {
Phrase.from(stringResource(item.stringId)).put(APP_NAME_KEY, stringResource(R.string.app_name)).format().toString()
} else {
stringResource(item.stringId)
val bubbleTxt = when (item.stringId) {
R.string.onboardingBubbleWelcomeToSession -> {
Phrase.from(stringResource(item.stringId))
.put(APP_NAME_KEY, stringResource(R.string.app_name))
.put(EMOJI_KEY, WAVING_HAND_EMOJI)
.format().toString()
}
R.string.onboardingBubbleSessionIsEngineered -> {
Phrase.from(stringResource(item.stringId))
.put(APP_NAME_KEY, stringResource(R.string.app_name))
.format().toString()
}
R.string.onboardingBubbleCreatingAnAccountIsEasy -> {
Phrase.from(stringResource(item.stringId))
.put(EMOJI_KEY, BACKHAND_INDEX_POINTING_DOWN_EMOJI)
.format().toString()
}
else -> {
stringResource(item.stringId)
}
}
AnimateMessageText(
bubbleTxt,
item.isOutgoing

View File

@ -1,14 +1,16 @@
package org.session.libsession.utilities
// Non-translatable strings for use with the UI
// Non-translatable strings for UI substitutions
object NonTranslatableStringConstants {
const val APP_NAME = "Session"
const val ARBISCAN = "Arbiscan"
const val ARBITRUM = "Arbitrum"
const val DEBUG_MENU = "Debug Menu"
const val ETHEREUM = "Ethereum"
const val NETWORK_NAME = "Session Network"
const val TOKEN_NAME_LONG = "Session Token"
const val TOKEN_NAME_LONG_PLURAL = "Session Tokens"
const val TOKEN_NAME_SHORT = "SENT"
const val APP_NAME = "Session"
const val ARBISCAN = "Arbiscan"
const val ARBITRUM = "Arbitrum"
const val DEBUG_MENU = "Debug Menu"
const val ETHEREUM = "Ethereum"
const val NETWORK_NAME = "Session Network"
const val TOKEN_NAME_LONG = "Session Token"
const val TOKEN_NAME_LONG_PLURAL = "Session Tokens"
const val TOKEN_NAME_SHORT = "SENT"
const val WAVING_HAND_EMOJI = "\uD83D\uDC4B" // Used on the landing page & substituted into `onboardingBubbleWelcomeToSession`
const val BACKHAND_INDEX_POINTING_DOWN_EMOJI = "\uD83D\uDC47" // Used on the landing page & substituted into `onboardingBubbleCreatingAnAccountIsEasy`
}

View File

@ -613,11 +613,11 @@ NOTE: Strings with blank lines have manually been replaced with '\n\n' - this wi
<string name="onboardingAccountExists">I have an account</string>
<string name="onboardingBackAccountCreation">You cannot go back further. In order to cancel your account creation, {app_name} needs to quit.</string>
<string name="onboardingBackLoadAccount">You cannot go back further. In order to stop loading your account, {app_name} needs to quit.</string>
<string name="onboardingBubbleCreatingAnAccountIsEasy">Creating an account is instant, free, and anonymous </string>
<string name="onboardingBubbleCreatingAnAccountIsEasy">Creating an account is instant, free, and anonymous {emoji}</string>
<string name="onboardingBubbleNoPhoneNumber">You don\'t even need a phone number to sign up.</string>
<string name="onboardingBubblePrivacyInYourPocket">Privacy in your pocket.</string>
<string name="onboardingBubbleSessionIsEngineered">{app_name} is engineered to protect your privacy.</string>
<string name="onboardingBubbleWelcomeToSession">Welcome to {app_name}</string>
<string name="onboardingBubbleWelcomeToSession">Welcome to {app_name} {emoji}</string>
<string name="onboardingHitThePlusButton">Hit the plus button to start a chat, create a group, or join an official community!</string>
<string name="onboardingMessageNotificationExplanation">There are two ways {app_name} can notify you of new messages.</string>
<string name="onboardingPrivacy">Privacy Policy</string>