Skip to content

Internationalization process#206

Open
jjmontes wants to merge 12 commits into
acristescu:masterfrom
jjmontes:master
Open

Internationalization process#206
jjmontes wants to merge 12 commits into
acristescu:masterfrom
jjmontes:master

Conversation

@jjmontes

@jjmontes jjmontes commented Jun 5, 2026

Copy link
Copy Markdown

Hi! I'm working on the internationalization process.

My goal is to only modify the bare minimum necessary to extract the hardcoded text and add it to the strings.xml file, although in some cases I had to tweak the code a bit (for example, I had to inject the Context into ActiveGamesRepository to use the functionality to read the resource files).

I'm linking the commits to ticket 155.

There's still a lot of work to do, and I'll be making progress as quickly as work and family obligations allow.

NOTE: There may be repeated texts that I've saved in strings.xml with different keys because I understood that the context changed; there may also be cases where the context is the same. Feel free to comment and correct me in either case.

PS: Excellent project!

* Created by alex on 08/11/2017.
*/
class ActiveGamesRepository(
private val context: Context,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't inject context into the repositories, the repos should be Android agnostic. There is no point in translating log messages, in fact it can be detrimental as I may get Firbase logs in several languages that I may not understand.

if (gameDao.getGameNullable(game.id) == null) {
FirebaseCrashlytics.getInstance()
.log("ActiveGameRepository: New game found from active_game notification ${game.id}")
.log(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't translate logs, only strings that are visible to the user.

val localGames = games.map(Game.Companion::fromOGSGame)
gameDao.insertAllGames(localGames)
FirebaseCrashlytics.getInstance().log("overview returned ${localGames.size} games")
FirebaseCrashlytics.getInstance().log(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't translate logs, only strings that are visible to the user.

private suspend fun updateGamesThatFinishedSinceLastUpdate(gameIds: List<Long>) {
FirebaseCrashlytics.getInstance()
.log("Found ${gameIds.size} games that are neither active nor marked as finished")
.log(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't translate logs, only strings that are visible to the user.

override val highlighted: Boolean = false
) : BottomBarButton {
) : BottomBarButton, KoinComponent {
private val context: Context by inject()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't inject the Context like this, you don't need it, as Compose has stringResource() for this exact purpose

},
text = { Text("That move would repeat the board position. That's called a KO, and it is not allowed. Try to make another move first, preferably a threat that the opponent can't ignore.") },
title = { Text("Illegal KO move", style = MaterialTheme.typography.titleLarge) },
text = { Text(stringResource(R.string.that_move_would_repeat_the_board_position_that_s_called_a_ko_and_it_is_not_allowed_try_to_make_another_move_first_preferably_a_threat_that_the_opponent_can_t_ignore)) },

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use shorter kets for translation such as R.string.ko_description

import kotlin.coroutines.cancellation.CancellationException

class MyGamesViewModel(
private val context: Context,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no Context inside ViewModel please

@jjmontes

jjmontes commented Jun 7, 2026

Copy link
Copy Markdown
Author

Hi @acristescu !

I reviewed the comments and made the necessary corrections.

I'm not familiar with Java or Kotlin (I'm from the .NET world), so please excuse any conceptual errors I'm making in the project. I'll be more attentive to these issues so as not to overload you with work.

Thanks for the feedback.

@jjmontes jjmontes requested a review from acristescu June 9, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants