Change the word order of some of the toast messages
Pull Request template
Purpose / Description
Anki Desktop uses the following word order pattern on some toast messages, for example, Card suspended.,
- Subject
- omission of be Verb
- Past participle
but it isn't used on some strings of AnkiDroid, for example, Suspended card.
It is probably appropriate to use Anki Desktop's word order pattern on AnkiDroid as well.

Fixes
n/a
Approach
Change the strings on 02-strings.xml
How Has This Been Tested?
on my physical device




Learning (optional, can help others)
n/a
Checklist
Please, go through these checks before submitting the PR.
- [x] You have a descriptive commit message with a short title (first line, max 50 chars).
- [ ] You have commented your code, particularly in hard-to-understand areas
- [x] You have performed a self-review of your own code
- [x] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
- [ ] UI Changes: You have tested your change using the Google Accessibility Scanner
Message to maintainers, this PR contains strings changes.
- Before merging this PR, it is best to run the "Sync Translations" GitHub action, then make and merge a PR from the i18n_sync branch to get translations cleaned out.
- Then merge this PR, and immediately do another translation PR so the huge change made by this PR's key changes are all by themselves.
Read more about updating strings on the wiki,
Actually, we have access to Anki Desktop strings, so we can reuse them directly. I'm on my phone right now, so I can't link the exact implementation on the moment, but if I recall correctly, it is on col.TR. So that is an option.
As the current PR only changes the English translation, I'd approve it, but I would like to see if the approach of reusing the Anki Desktop strings directly wouldn't be better
Indeed - here's an example usage https://github.com/ankidroid/Anki-Android/pull/11740/files#diff-03de22cd624f1cb4006ae0c6622ec035f598d779dd1dfb64e2207f0a1824933cR42
And I just logged a couple items with regard to backend translation - it's all pretty new for us (#12452 + https://github.com/ankidroid/Anki-Android-Backend/issues/235)
You can also use CollectionManager.TR(), which doesn't require an open collection or usage of withCol
Here's how you could do it:
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
index a13e4e352..c122b8bd8 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
@@ -50,6 +50,7 @@ import com.drakeet.drawer.FullDraggableContainer
import com.google.android.material.snackbar.Snackbar
import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anim.ActivityTransitionAnimation.getInverseTransition
+import com.ichi2.anki.CollectionManager.TR
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.UIUtils.showThemedToast
import com.ichi2.anki.cardviewer.*
@@ -908,6 +909,15 @@ abstract class AbstractFlashcardViewer :
}
}
+ private fun showSnackbarWithUndoButtonText(
+ text: String,
+ duration: Int = Snackbar.LENGTH_SHORT
+ ) {
+ showSnackbarAboveAnswerButtons(text, duration) {
+ setAction(R.string.undo) { undo() }
+ }
+ }
+
private fun getRecommendedEase(easy: Boolean): Int {
return try {
when (answerButtonCount) {
@@ -1648,7 +1658,7 @@ abstract class AbstractFlashcardViewer :
internal fun buryCard(): Boolean {
return dismiss(BuryCard(currentCard!!)) {
- showSnackbarWithUndoButton(R.string.buried_card)
+ showSnackbarWithUndoButtonText(TR.studyingCardsBuried(1))
}
}
Thank you all for the information and advice. I'll try :-D
I would like to see if the approach of reusing the Anki Desktop strings directly wouldn't be better
@BrayanDSO I've tried the approach with CollectionManager.TR() as @dae taught me.

My concern is that the approach makes inconsistency about punctuation between the reused messages and the other ones, at least for the moment. In general, the messages of AnkiDroid end without period as follows
while ones of Anki Desktop generally (maybe) end with it.

Using Anki translations is something I prefer as it represents a more "shared work" future (between Anki Desktop and AnkiDroid), which may also be read as "less work per contributor" and is thus more sustainable long-term, even if there is punctuation inconsistency.
Anyone can remove the dot on Poonton (Anki desktop translating platform) later. Sharing translations is the best path for consistency
I see. Then, I'll continue this approach without so much concern about temporary inconsistency of punctuation.
About the approach, I have one question.
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt - showSnackbarWithUndoButton(R.string.buried_card) + showSnackbarWithUndoButtonText(TR.studyingCardsBuried(1))
For example, if the above replacement is done, should I delete
<string name="buried_card">Card buried</string>
in AnkiDroid/src/main/res/values/02-strings.xml?
If the string isn't somewhere else, you can delete it. Actually, Lint will force will to delete it on this case.
Thanks. Then, I guess I'd better leave it to Lint Debug to check if the string isn't somewhere else.
After Bury note action is done, a message, for example, 2 cards buried., is shown on Anki Desktop.

In order to reproduce it on AnkiDroid with Anki Desktop strings, what should be done? Filling in some variable in the following parentheses?
internal fun buryNote(): Boolean {
return dismiss(BuryNote(currentCard!!)) {
showSnackbarWithUndoButtonText(TR.studyingCardsBuried(●))

On methods that operate on a note, you can use currentCard!!.note().numberOfCards(). If it operates on a card, passing 1 should be fine
I see. Thanks a lot!
@dae On Anki Desktop, the actions of Bury and Suspend produce messages whose styles are different from each other as follows. Is it intentional?
Action --> Message
Bury Card --> 1 card buried.
Bury Note --> 2 cards buried. (the case of a note with 2 cards)
Suspend Card --> Card suspended.
Suspend Note --> Note suspended.
@dae good question for you just above :point_up:
Sorry, lost track of this. I think the difference is just because they were added at different times by different people. Suspend card/note came earlier and is only used in the review screen; the bury message was added later, and including the number was likely because it can be used in both the reviewer and browse screen (even though the browse screen doesn't currently provide a bury option, it may in the future).
@dae @mikehardy thanks. Then, I suppose the following hybrid style might be good.
Action --> Message
Bury Card --> Card buried.
Bury Note --> n cards buried. (n≧2) ; 1 card buried. (the case of executing Bury Note gesture on a card which has no siblings. On AnkiDroid, Bury Note item itself on action menu isn't shown for the card)
Same for Suspend
Suspend Card --> Card suspended.
Suspend Note --> n cards suspended. (n≧2) ; 1 card suspended. (the case of executing Suspend Note gesture on a card which has no siblings. On AnkiDroid, Suspend Note item itself on action menu isn't shown for the card)
May I continue working in this direction?
Fine with me
On Pontoon of Anki, the string of Card buried seems to exist only in AnkiMobile resource.

What approach would be preferable?
Using the string of AnkiMobile in some way?
Requesting creation of that string in Anki Desktop resource?
Just replacing
<string name="buried_card">Buried card</string>
with
<string name="buried_card">Card buried</string> in AnkiDroid/src/main/res/values/02-strings.xml?
Or replacing it with
<string name="Card_buried">Card buried</string>?
If we can use the mobile translation with CollectionManager.TR, use it
else if we have an AnkiDroid string equivalent to Card buried/Buried card, use it
else, create a new one on AnkiDroid
The AnkiMobile translations are not easily usable. It's possible to migrate individual translations from mobile→desktop, but it's currently it's a bit of a pain to do so I'm afraid.
Thank you, two. Then, rewriting the following related string on AnkiDroid is currently a handy way, I guess.
<string name="buried_card">Buried card</string>
I've made strings (on 02-strings.xml in my local repository) for the snackbar message after the action of "Suspend note".
<!-- Reviewer actions -->
<string name="card_buried">Card buried.</string>
<plurals name="note_suspended">
<item quantity="one">%d card suspended</item>
<item quantity="other">%d cards suspended</item>
</plurals>
Could anyone please advise me how to reflect the number of cards (%d) in the following code of AbstractFlashcardViewer.kt to show it on the snackbar message? Using getQuantityString and currentCard!!.note().numberOfCards()? (Currently, tapping "Suspend note" causes a crash on my debug.apk...)
internal fun buryCard(): Boolean {
return dismiss(BuryCard(currentCard!!)) {
showSnackbarWithUndoButton(R.string.card_buried)
}
}
internal fun buryNote(): Boolean {
return dismiss(BuryNote(currentCard!!)) {
showSnackbarWithUndoButtonText(TR.studyingCardsBuried(currentCard!!.note().numberOfCards()))
}
}
internal fun suspendCard(): Boolean {
return dismiss(SuspendCard(currentCard!!)) {
showSnackbarWithUndoButtonText(TR.studyingCardSuspended())
}
}
internal fun suspendNote(): Boolean {
return dismiss(SuspendNote(currentCard!!)) {
showSnackbarWithUndoButton(R.plurals.note_suspended)
}
}
The results of the last commits are as follows. I would deeply appreciate it if you would give me a review and some advice.

Hello 👋, this PR has been opened for more than 1 month with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically
Thank you so much for taking the trouble to do the review and the works!
I'm clearing strings out now then will merge the strings-related stack of PRs queued up
Hi there @snowtimeglass! This is the OpenCollective Notice for PRs merged from 2023-03-01 through 2023-03-31
If you are interested in compensation for this work, the process with details is here:
https://github.com/ankidroid/Anki-Android/wiki/OpenCollective-Payment-Process#how-to-get-paid
We only post one comment per person per month to avoid spamming you, regardless of the number of PRs merged, but this note applies to all PRs merged for this month
Please note that GSoC contributions are okay for this process. Our philosophy is that our users have donated to AnkiDroid for all contributions. The only PRs that will not go through the OpenCollective process are ones directly related to am accepted GSoC project from a selected participant, since those receive a stipend from GSoC itself.
Please understand that our monthly budget is never guaranteed to cover all claims - the cap on payments-per-person may be lower, but we try to make our process as fair and transparent as possible, we just need your understanding.
Thanks!