From b5b7f7ec50b1270b49dc14544ecaaaeb3d84c5d8 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Thu, 24 Oct 2019 01:21:06 +0200 Subject: [PATCH 1/3] Tells QT not to translate shortcuts. There is currently a problem with crowdin. It asks to translate shortcut. I assume that actually, shortcuts are intended to remain the same independtly of the language, and thus that they should not appear here. I kind of assume that crowdin gets the strings to which _ or ngettext are applied. So I wanted to ensure that none of those methods are applied to shortcut. The python file containing those shortcut are generated from .ui files, used by QTCreator. I thus changed those files to indicates that shortcuts should not be translated. I assumed that shortcuts are strings containing either only "F(digit)", a single letter, "Alt+" or "Ctrl+". I may have missed other shortcuts if they exists. --- designer/browser.ui | 58 ++++++++++++++++++++++----------------------- designer/main.ui | 22 ++++++++--------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/designer/browser.ui b/designer/browser.ui index 71ddbf188..9f7b7a40c 100644 --- a/designer/browser.ui +++ b/designer/browser.ui @@ -120,7 +120,7 @@ Preview - Ctrl+Shift+P + Ctrl+Shift+P true @@ -327,7 +327,7 @@ &Reschedule... - Ctrl+Alt+R + Ctrl+Alt+R @@ -335,7 +335,7 @@ Select &All - Ctrl+Alt+A + Ctrl+Alt+A @@ -343,7 +343,7 @@ &Undo - Ctrl+Alt+Z + Ctrl+Alt+Z @@ -351,7 +351,7 @@ &Invert Selection - Ctrl+Alt+S + Ctrl+Alt+S @@ -359,7 +359,7 @@ &Find - Ctrl+F + Ctrl+F @@ -367,7 +367,7 @@ N&ote - Ctrl+Shift+N + Ctrl+Shift+N @@ -375,7 +375,7 @@ &Next Card - Ctrl+N + Ctrl+N @@ -383,7 +383,7 @@ &Previous Card - Ctrl+P + Ctrl+P @@ -391,7 +391,7 @@ &Guide - F1 + F1 @@ -399,7 +399,7 @@ Change Note Type... - Ctrl+Shift+M + Ctrl+Shift+M @@ -412,7 +412,7 @@ Find and Re&place... - Ctrl+Alt+F + Ctrl+Alt+F @@ -425,7 +425,7 @@ Fil&ter - Ctrl+Shift+F + Ctrl+Shift+F @@ -433,7 +433,7 @@ Card List - Ctrl+Shift+L + Ctrl+Shift+L @@ -446,7 +446,7 @@ Reposition... - Ctrl+Shift+S + Ctrl+Shift+S @@ -470,7 +470,7 @@ Close - Ctrl+W + Ctrl+W @@ -478,7 +478,7 @@ &Info... - Ctrl+Shift+I + Ctrl+Shift+I @@ -486,7 +486,7 @@ Add Tags... - Ctrl+Shift+A + Ctrl+Shift+A @@ -494,7 +494,7 @@ Remove Tags... - Ctrl+Shift+D + Ctrl+Shift+D @@ -502,7 +502,7 @@ Toggle Suspend - Ctrl+J + Ctrl+J @@ -510,7 +510,7 @@ Delete - Ctrl+Del + Ctrl+Del @@ -518,7 +518,7 @@ Add Notes... - Ctrl+E + Ctrl+E @@ -526,7 +526,7 @@ Change Deck... - Ctrl+D + Ctrl+D @@ -537,7 +537,7 @@ Red Flag - Ctrl+1 + Ctrl+1 @@ -548,7 +548,7 @@ Orange Flag - Ctrl+2 + Ctrl+2 @@ -559,7 +559,7 @@ Green Flag - Ctrl+3 + Ctrl+3 @@ -570,7 +570,7 @@ Blue Flag - Ctrl+4 + Ctrl+4 @@ -578,7 +578,7 @@ Sidebar - Ctrl+Shift+R + Ctrl+Shift+R @@ -596,7 +596,7 @@ Toggle Mark - Ctrl+K + Ctrl+K diff --git a/designer/main.ui b/designer/main.ui index 654bda94e..3f6a1a76d 100644 --- a/designer/main.ui +++ b/designer/main.ui @@ -101,7 +101,7 @@ E&xit - Ctrl+Q + Ctrl+Q @@ -112,7 +112,7 @@ Configure interface language and options - Ctrl+P + Ctrl+P QAction::PreferencesRole @@ -134,7 +134,7 @@ &Undo - Ctrl+Z + Ctrl+Z @@ -173,7 +173,7 @@ &Guide... - F1 + F1 @@ -181,7 +181,7 @@ &Switch Profile - Ctrl+Shift+P + Ctrl+Shift+P @@ -189,7 +189,7 @@ &Export... - Ctrl+E + Ctrl+E @@ -197,7 +197,7 @@ &Import... - Ctrl+Shift+I + Ctrl+Shift+I @@ -205,7 +205,7 @@ Study Deck... - / + / @@ -218,7 +218,7 @@ Create Filtered Deck... - F + F @@ -226,7 +226,7 @@ Manage Note Types - Ctrl+Shift+N + Ctrl+Shift+N @@ -234,7 +234,7 @@ Add-ons - Ctrl+Shift+A + Ctrl+Shift+A From 955db2d13378ffdf7b60c90a0d6a4c8881f537f6 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Thu, 24 Oct 2019 02:10:52 +0200 Subject: [PATCH 2/3] Stating that some UI strings are not translatable Mostly because those strings are not actually supposed to be seen by the user. The point here being that it does not show in crowdin --- designer/customstudy.ui | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer/customstudy.ui b/designer/customstudy.ui index bc677d0e5..a2638641f 100644 --- a/designer/customstudy.ui +++ b/designer/customstudy.ui @@ -69,7 +69,7 @@ - ... + ... @@ -78,7 +78,7 @@ - ... + ... @@ -88,7 +88,7 @@ - ... + ... From 26acc412b1e9c1aeebcab6711792db7430de6e31 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Thu, 24 Oct 2019 02:01:27 +0200 Subject: [PATCH 3/3] Adding explanation to translators Some strings are missing in French at least. And some are quite complex to understand. Especially without context, without knowledge of Python. I tried to copy the only indication I found and add more indication, hoping I did it correctly. --- anki/stats.py | 10 +++++++++- anki/utils.py | 6 ++++++ aqt/browser.py | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/anki/stats.py b/anki/stats.py index bac90b39b..615b5b145 100644 --- a/anki/stats.py +++ b/anki/stats.py @@ -379,6 +379,7 @@ group by day order by day""" % (self._limit(), lim), tunit = _("hours") else: tunit = unit + #T: unit: can be hours, minutes, reviews... tot: the number of unit. self._line(i, _("Total"), _("%(tot)s %(unit)s") % dict( unit=tunit, tot=int(tot))) if convHours: @@ -747,6 +748,7 @@ when you answer "good" on a review.''') return txt def _line(self, i, a, b, bold=True): + #T: Symbols separating first and second column in a statistics table. Eg in "Total: 3 reviews". colon = _(":") if bold: i.append(("%s%s%s") % (a,colon,b)) @@ -814,7 +816,13 @@ from cards where did in %s""" % self._limit()) if xunit is None: conf['timeTicks'] = False else: - conf['timeTicks'] = {1: _("d"), 7: _("w"), 31: _("mo")}[xunit] + #T: abbreviation of day + d = _("d") + #T: abbreviation of week + w = _("w") + #T: abbreviation of month + mo = _("mo") + conf['timeTicks'] = {1: d, 7: w, 31: mo}[xunit] # types width = self.width height = self.height diff --git a/anki/utils.py b/anki/utils.py index 6272a8580..385c36455 100644 --- a/anki/utils.py +++ b/anki/utils.py @@ -50,11 +50,17 @@ inTimeTable = { def shortTimeFmt(type): return { +#T: year is an abbreviation for year. %s is a number of years "years": _("%sy"), +#T: m is an abbreviation for month. %s is a number of months "months": _("%smo"), +#T: d is an abbreviation for day. %s is a number of days "days": _("%sd"), +#T: h is an abbreviation for hour. %s is a number of hours "hours": _("%sh"), +#T: m is an abbreviation for minute. %s is a number of minutes "minutes": _("%sm"), +#T: s is an abbreviation for second. %s is a number of seconds "seconds": _("%ss"), }[type] diff --git a/aqt/browser.py b/aqt/browser.py index f127e0c6e..b5c220d43 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -1060,6 +1060,8 @@ by clicking on one on the left.""")) # add templates for c, tmpl in enumerate(nt['tmpls']): + #T: name is a card type name. n it's order in the list of card type. + #T: this is shown in browser's filter, when seeing the list of card type of a note type. name = _("%(n)d: %(name)s") % dict(n=c+1, name=tmpl['name']) subm.addItem(name, self._filterFunc( "note", nt['name'], "card", str(c+1)))