-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mylife: smoother list translation (fixes #4401) #4426
Conversation
@Kuljeet1998 I don't know why but "Mylife" translation in the dashboard doesn't work when I login with my username; however, it works when I login with okuro's username as shown in the video below: translation.webm |
I believe its because the language when you login would have been set to arabic but the language when okuro's account was used must have been english at the start and then changed to arabic. This is an edge case which I discussed w @Okuro3499 and trying to come up w a solution. |
fun getStringIdentifier(name: String?): Int { | ||
if (name == "mymessages" || name == "myachievements"){ | ||
val modifiedString = name.substring(2) | ||
return context.resources.getIdentifier(modifiedString, "string", context.packageName) | ||
} | ||
else if (name == "mysurvey"){ | ||
return context.resources.getIdentifier("my_survey", "string", context.packageName) | ||
} | ||
else if (name == "mysubmissions"){ | ||
return context.resources.getIdentifier("submission", "string", context.packageName) | ||
} | ||
else if (name == "help wanted"){ | ||
return context.resources.getIdentifier("help_wanted", "string", context.packageName) | ||
} | ||
else { | ||
return context.resources.getIdentifier(name, "string", context.packageName) | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mylife items are sourced from the database, and in this implementation, you're passing the title directly to this function for translation. However, this approach may not work if there's an item that isn't hardcoded into this function. We need a more dynamic solution to handle such cases
Fixes: #4401
pending: dashboard -> myLife -> cards