Update translations

This commit is contained in:
Lucas Lima 2020-07-03 17:53:53 -03:00
parent 6957143768
commit 421c79113d
No known key found for this signature in database
GPG key ID: 0259A3F43EC1027A
9 changed files with 76 additions and 108 deletions

View file

@ -361,7 +361,7 @@ class GameActivity : AppCompatActivity(), DialogInterface.OnDismissListener {
AlertDialog.Builder(this)
.setTitle(R.string.rating)
.setMessage(R.string.rating_message)
.setPositiveButton(R.string.rating_button) { _, _ ->
.setPositiveButton(R.string.yes) { _, _ ->
openRateUsLink("Dialog")
}
.setNegativeButton(R.string.rating_button_no) { _, _ ->
@ -373,7 +373,7 @@ class GameActivity : AppCompatActivity(), DialogInterface.OnDismissListener {
private fun newGameConfirmation(action: () -> Unit) {
AlertDialog.Builder(this, R.style.MyDialog).apply {
setTitle(R.string.start_over)
setTitle(R.string.new_game)
setMessage(R.string.retry_sure)
setPositiveButton(R.string.resume) { _, _ -> action() }
setNegativeButton(R.string.cancel, null)
@ -553,9 +553,8 @@ class GameActivity : AppCompatActivity(), DialogInterface.OnDismissListener {
private fun shareCurrentGame() {
val levelSetup = viewModel.levelSetup.value
val field = viewModel.field.value
val spentTime: Long? = if (status is Status.Over) currentTime else null
GlobalScope.launch {
shareViewModel.share(levelSetup, field, spentTime)
shareViewModel.share(levelSetup, field)
}
}

View file

@ -162,7 +162,7 @@ class TvGameActivity : AppCompatActivity() {
private fun newGameConfirmation(action: () -> Unit) {
AlertDialog.Builder(this, R.style.MyDialog).apply {
setTitle(R.string.start_over)
setTitle(R.string.new_game)
setMessage(R.string.retry_sure)
setPositiveButton(R.string.resume) { _, _ -> action() }
setNegativeButton(R.string.cancel, null)

View file

@ -74,12 +74,12 @@ class EndGameDialogFragment : AppCompatDialogFragment() {
isVictory -> {
titleEmoji = endGameViewModel.randomVictoryEmoji()
title = context.getString(R.string.you_won)
message = endGameViewModel.messageTo(context, rightMines, totalMines, time, isVictory)
message = endGameViewModel.messageTo(context, time, isVictory)
}
else -> {
titleEmoji = endGameViewModel.randomGameOverEmoji()
title = context.getString(R.string.you_lost)
message = endGameViewModel.messageTo(context, rightMines, totalMines, time, isVictory)
message = endGameViewModel.messageTo(context, time, isVictory)
}
}
@ -119,7 +119,7 @@ class EndGameDialogFragment : AppCompatDialogFragment() {
val field = viewModel.field.value
GlobalScope.launch {
shareViewModel.share(setup, field, time)
shareViewModel.share(setup, field)
}
}
}

View file

@ -35,18 +35,11 @@ class EngGameDialogViewModel : ViewModel() {
"\uD83E\uDD2C", "\uD83E\uDD15", "\uD83D\uDE16", "\uD83D\uDCA3", "\uD83D\uDE05"
).safeRandomEmoji(except)
fun messageTo(context: Context, rightMines: Int, totalMines: Int, time: Long, isVictory: Boolean): String =
if (totalMines != 0 && time != 0L) {
fun messageTo(context: Context, time: Long, isVictory: Boolean): String =
if (time != 0L) {
when {
isVictory -> context.getString(R.string.game_over_desc_4, time)
rightMines / totalMines > 0.9 -> context.getString(R.string.game_over_desc_3)
rightMines < 4 -> context.getString(
arrayOf(
R.string.game_over_desc_0,
R.string.game_over_desc_1
).random()
)
else -> context.getString(R.string.game_over_desc_2, rightMines, totalMines, time)
else -> context.getString(R.string.game_over_desc_1)
}
} else {
context.getString(R.string.game_over_desc_1)

View file

@ -13,10 +13,9 @@ import androidx.core.content.FileProvider
import dev.lucasnlm.antimine.BuildConfig
import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.Minefield
import dev.lucasnlm.antimine.common.level.models.Mark
import dev.lucasnlm.antimine.common.level.models.AreaPalette
import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
import dev.lucasnlm.antimine.common.level.models.AreaPalette
import dev.lucasnlm.antimine.common.level.models.Minefield
import dev.lucasnlm.antimine.common.level.view.paintOnCanvas
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@ -28,14 +27,11 @@ class ShareBuilder(
) {
private val context: Context = context.applicationContext
suspend fun share(minefield: Minefield, field: Sequence<Area>, spentTime: Long?): Boolean {
val rightMines = field.count { it.hasMine && it.mark == Mark.Flag }
val totalMines = field.count { it.hasMine }
suspend fun share(minefield: Minefield, field: Sequence<Area>): Boolean {
val file = createImage(minefield, field)
return if (file != null) {
shareFile(context, file, rightMines, totalMines, spentTime)
shareFile(context, file)
} else {
false
}
@ -116,27 +112,13 @@ class ShareBuilder(
return result
}
private fun shareFile(context: Context, file: File, right: Int, total: Int, spentTime: Long?): Boolean {
private fun shareFile(context: Context, file: File): Boolean {
val imageUri = FileProvider.getUriForFile(context, "${BuildConfig.APPLICATION_ID}.provider", file)
val intent = Intent(Intent.ACTION_SEND).apply {
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
putExtra(Intent.EXTRA_STREAM, imageUri)
putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.app_name))
if (spentTime != null) {
putExtra(
Intent.EXTRA_TEXT,
context.getString(R.string.share_body_text, right, total, spentTime.toInt())
)
} else {
putExtra(
Intent.EXTRA_TEXT,
context.getString(
R.string.share_body_text_generic,
context.getString(R.string.app_name)
)
)
}
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
type = "image/png"
}

View file

@ -13,9 +13,9 @@ class ShareViewModel(
) : AndroidViewModel(application) {
private val context = getApplication<Application>().applicationContext
suspend fun share(minefield: Minefield?, field: Sequence<Area>?, spentTime: Long?) {
suspend fun share(minefield: Minefield?, field: Sequence<Area>?) {
val result = if (minefield != null && field != null && field.count() != 0) {
ShareBuilder(context).share(minefield, field, spentTime)
ShareBuilder(context).share(minefield, field)
} else {
false
}

View file

@ -8,6 +8,6 @@
<item
android:id="@+id/reset"
android:icon="@drawable/replay"
android:title="@string/start_over"
android:title="@string/new_game"
app:showAsAction="ifRoom" />
</menu>

View file

@ -77,6 +77,7 @@
<string name="width">Width</string>
<string name="height">Height</string>
<string name="mines">Mines</string>
<string name="enable_automatic_flags">Enable automatic placing of flags</string>
<string name="desc_convered_area">Covered area</string>
<string name="desc_marked_area">Marked area</string>
<string name="desc_question_area">Doubtful area</string>

View file

@ -4,84 +4,28 @@
<string name="app_description">You have to clear a rectangular board containing hidden mines without detonating any of them.</string>
<string name="games">Games</string>
<string name="previous_games">Previous Games</string>
<string name="install">Install</string>
<string name="minefield">Difficulty</string>
<string name="standard">Standard</string>
<string name="beginner">Beginner</string>
<string name="intermediate">Intermediate</string>
<string name="expert">Expert</string>
<string name="open">Open</string>
<string name="open_menu">Open Menu</string>
<string name="close_menu">Close Menu</string>
<string name="settings">Settings</string>
<string name="animations">Animations</string>
<string name="vibration">Haptic Feedback</string>
<string name="about">About</string>
<string name="no_network">No internet connection.</string>
<string name="events">Statistics</string>
<string name="start_over">New Game</string>
<string name="retry_sure">If you start a new game, your current progress will be lost.</string>
<string name="cancel">Cancel</string>
<string name="resume">Resume</string>
<string name="show_licenses">Show Licenses</string>
<string name="source_code">Source Code</string>
<string name="translation">Translation</string>
<string name="licenses">Licenses</string>
<string name="google_play_games">Google Play Games</string>
<string name="leaderboards">Leaderboards</string>
<string name="connect">Connect</string>
<string name="connecting">Connecting…</string>
<string name="disconnect">Disconnect</string>
<string name="disconnected">Disconnected</string>
<string name="new_game">New Game</string>
<string name="share">Share</string>
<string name="share_menu">Share…</string>
<string name="new_game_request">Do you want to start a new game?</string>
<string name="yes">Yes</string>
<string name="general">General</string>
<string name="all_mines_disabled">All mines were disabled.</string>
<string name="mines_remaining">%d mines</string>
<string name="game_time">Game Time</string>
<string name="covered_field">Covered Field</string>
<string name="mine">Mine</string>
<string name="exploded_mine">Exploded Mine</string>
<string name="game_started">Game Started</string>
<string name="you_exploded_a_mine">You exploded a mine!</string>
<string name="flag_placed">Flag placed!</string>
<string name="flag_removed">Flag removed!</string>
<string name="used_software_text">This game uses the following third parties software:</string>
<string name="translators_text">This game was translated by the following people:</string>
<string name="sign_in_failed">Failed to sign in. Please check your network connection and try again.</string>
<string name="unknown_error">Unknown error.</string>
<string name="retry">Retry</string>
<string name="empty">Empty</string>
<string name="quit_confirm">You\'ll lose all moves on current game.\nBut you can also install the game before quit.</string>
<string name="you_won">You won!</string>
<string name="victories">Victories</string>
<string name="you_lost">You lost!</string>
<string name="defeats">Defeats</string>
<string name="game_over_desc_0">Long press a square to put a flag.</string>
<string name="game_over_desc_1">Good luck on your next game.</string>
<string name="game_over_desc_2">You did %1$d/%2$d in %3$d seconds.</string>
<string name="game_over_desc_3">You almost did it!</string>
<string name="game_over_desc_4">You finished the minefield in %1$d seconds.</string>
<string name="share_body_text">I did %1$d/%2$d in %3$d seconds.</string>
<string name="share_body_text_generic">I\'m playing %1$s</string>
<string name="fail_to_share">Failed to share game</string>
<string name="version_s">Version %1$s</string>
<string name="sound_effects">Sound Effects</string>
<string name="quit">Quit</string>
<string name="are_you_sure">Are you sure?</string>
<string name="custom">Custom</string>
<string name="start">Start</string>
<string name="width">Width</string>
<string name="height">Height</string>
<string name="mines">Mines</string>
<string name="enable_automatic_flags">Enable automatic placing of flags</string>
<string name="desc_convered_area">Covered area</string>
<string name="desc_marked_area">Marked area</string>
<string name="desc_question_area">Doubtful area</string>
<string name="desc_wrongly_marked_area">Wrongly marked area</string>
<string name="retry_sure">If you start a new game, your current progress will be lost.</string>
<string name="show_licenses">Show Licenses</string>
<string name="new_game_request">Do you want to start a new game?</string>
<string name="mines_remaining">%d mines</string>
<string name="game_time">Game Time</string>
<string name="mine">Mine</string>
<string name="settings_general">General</string>
<string name="settings_vibration_desc">Vibrates on explosion or flag toggle</string>
<string name="settings_sound_desc">Makes a sound of explosion</string>
@ -91,8 +35,22 @@
<string name="settings_large_areas_desc">Increases the touch area</string>
<string name="rating">Feedback</string>
<string name="rating_message">If you like this game, please give us a feedback. It will help us a lot.</string>
<string name="rating_button">Yes ❤️️️</string>
<string name="rating_button_no">No</string>
<string name="used_software_text">This game uses the following third parties software:</string>
<string name="translators_text">This game was translated by the following people:</string>
<string name="sign_in_failed">Failed to sign in. Please check your network connection and try again.</string>
<string name="quit_confirm">You\'ll lose all moves on current game.\nBut you can also install the game before quit.</string>
<string name="you_won">You won!</string>
<string name="victories">Victories</string>
<string name="you_lost">You lost!</string>
<string name="defeats">Defeats</string>
<string name="game_over_desc_1">Good luck on your next game.</string>
<string name="game_over_desc_4">You finished the minefield in %1$d seconds.</string>
<string name="fail_to_share">Failed to share</string>
<string name="version_s">Version %1$s</string>
<string name="sound_effects">Sound Effects</string>
<string name="quit">Quit</string>
<string name="are_you_sure">Are you sure?</string>
<string name="enable_automatic_flags">Enable automatic placing of flags</string>
<string name="open_areas">Open Areas</string>
<string name="total_time">Total Time</string>
<string name="average_time">Average Time</string>
@ -107,4 +65,39 @@
<string name="long_press">Long Press</string>
<string name="open_tile">Open Tile</string>
<string name="flag_tile">Flag Tile</string>
<string name="retry">Retry</string>
<string name="empty">Empty</string>
<string name="unknown_error">Unknown error.</string>
<string name="leaderboards">Leaderboards</string>
<string name="cancel">Cancel</string>
<string name="resume">Resume</string>
<string name="yes">Yes</string>
<string name="rating_button_no">No</string>
<string name="general">General</string>
<string name="source_code">Source Code</string>
<string name="translation">Translation</string>
<string name="licenses">Licenses</string>
<string name="google_play_games">Google Play Games</string>
<string name="install">Install</string>
<string name="connect">Connect</string>
<string name="connecting">Connecting…</string>
<string name="disconnect">Disconnect</string>
<string name="disconnected">Disconnected</string>
<string name="new_game">New Game</string>
<string name="share">Share</string>
<string name="share_menu">Share…</string>
<string name="no_network">No internet connection.</string>
<string name="open_menu">Open Menu</string>
<string name="close_menu">Close Menu</string>
<string name="covered_field">Covered Field</string>
<string name="all_mines_disabled">All mines were disabled.</string>
<string name="desc_convered_area">Covered area</string>
<string name="desc_marked_area">Marked area</string>
<string name="desc_question_area">Doubtful area</string>
<string name="desc_wrongly_marked_area">Wrongly marked area</string>
<string name="exploded_mine">Exploded Mine</string>
<string name="game_started">Game Started</string>
<string name="you_exploded_a_mine">You exploded a mine!</string>
<string name="flag_placed">Flag placed!</string>
<string name="flag_removed">Flag removed!</string>
</resources>