Commit graph

910 commits

Author SHA1 Message Date
Damien Elmes
3d11e74774 List->Sequence in a bunch of table/browser methods
Most code doesn't require a list specifically, and build a list
is an extra step.
2021-03-29 16:48:33 +10:00
Damien Elmes
165c90824b avoid rebuilding card/note id list when searching 2021-03-29 16:25:55 +10:00
RumovZ
1f79a8766d squash merge browser refactor
Closes #1100
2021-03-29 16:14:54 +10:00
Damien Elmes
d793c30526 switch NoteType to Notetype
When used as a variable, we were typically calling it a 'notetype', not
a 'note type'.
2021-03-27 22:03:19 +10:00
Damien Elmes
b251843da6 add Dict suffix to Dict aliases in models.py 2021-03-27 21:46:49 +10:00
Damien Elmes
6b72aaf8c2 ID -> Id in protobuf and Python
follow-up to a90d5aa359
2021-03-27 21:38:20 +10:00
Damien Elmes
2338998304 update to the latest rules_rust + security framework update 2021-03-27 19:28:19 +10:00
Damien Elmes
4676d2f3b1 drop the legacy enum from rslib, and pass separate module/message idx 2021-03-27 11:56:31 +10:00
Damien Elmes
cf32bb034a update remaining TR references in rslib 2021-03-27 11:18:34 +10:00
Damien Elmes
d7005803bc update 1 arg tr strings in rslib 2021-03-27 10:39:53 +10:00
Damien Elmes
51f5df600f update no-arg TR references in rslib/ 2021-03-26 23:16:08 +10:00
Damien Elmes
0006a385e1 allow js to request specific i18n modules
Brings the payload on the congrats page with a non-English language
down from about 150k to 15k
2021-03-26 21:43:36 +10:00
Damien Elmes
7a7cb7402d update most no-arg TR references in *.svelte 2021-03-26 19:13:30 +10:00
Damien Elmes
1ed1902933 update TR references with args in *.svelte 2021-03-26 19:13:30 +10:00
Damien Elmes
0e50259e6b update TR references with args in *.ts; fix average answer time 2021-03-26 19:10:39 +10:00
Damien Elmes
2ab7a30b7b convert no-arg TR references to method invocations in *.ts 2021-03-26 19:10:27 +10:00
Damien Elmes
d7bef83f98 add types to some more Fluent variables 2021-03-26 16:52:54 +10:00
Damien Elmes
afdca58e31 declare variables with some common names as int instead of a union 2021-03-26 16:33:53 +10:00
Damien Elmes
3d0e5248aa update TR references that crossed multiple lines 2021-03-26 14:38:15 +10:00
Damien Elmes
5d164bea7f update TR references that contain arguments 2021-03-26 14:21:04 +10:00
Damien Elmes
1df14f7c9c update no-arg tr references in qt/ 2021-03-26 13:48:26 +10:00
Damien Elmes
568bd54a61 update some more TR references in pylib; update tr_legacyglobal 2021-03-26 13:33:46 +10:00
Damien Elmes
dec406691d switch the Importers global to a callable for i18n
I18n is not set up at init time, so the strings can't be generated
at import.

@kelciour you have a few importing add-ons, so wanted to give you a
heads-up. The importing code is likely to change more in
future months, but for now this should be the only change
2021-03-26 13:28:21 +10:00
Damien Elmes
bd59e41f73 update some no-arg TR constants 2021-03-26 12:37:18 +10:00
Damien Elmes
ede095ef71 Merge branch 'int_type' into main 2021-03-26 11:38:34 +10:00
Damien Elmes
bfcf86e21a fix incorrect constant naming 2021-03-26 11:29:07 +10:00
Damien Elmes
c03e2db3de fix incorrect camelCase 2021-03-26 11:28:51 +10:00
Damien Elmes
be1d990919 fix typo and PEP8 naming in noteimp.py 2021-03-26 11:28:18 +10:00
Damien Elmes
71429f7e52 fix .select() not handling string arguments 2021-03-26 11:27:49 +10:00
Arthur Milchior
6113c4e628 NF: CardType type 2021-03-26 11:14:08 +10:00
Arthur Milchior
42e5c83eb5 NF: CardQueue type 2021-03-26 11:14:08 +10:00
Arthur Milchior
f8e8113c90 NF: NoteTypeID type 2021-03-26 11:14:08 +10:00
Arthur Milchior
4b98263a7c NF: DeckConfID 2021-03-26 11:14:08 +10:00
Arthur Milchior
ea3b55a3a4 NF: DeckID type 2021-03-26 11:14:08 +10:00
Arthur Milchior
5ae21f04dc NF: default_deck_conf_id as constant
So that the 1 is clearer
2021-03-26 11:14:08 +10:00
Arthur Milchior
f50ba44f05 NF: default_deck_id as a constant
Otherwise it's not clear what this 1 represents
2021-03-26 11:14:08 +10:00
Arthur Milchior
375ac6ea91 NF: currentDeckID factorize odid or did 2021-03-26 11:14:08 +10:00
Arthur Milchior
13710c1357 NF: CardID type 2021-03-26 11:14:08 +10:00
Arthur Milchior
575c1d32ec NF: NoteID type 2021-03-26 11:14:08 +10:00
Arthur Milchior
326d7874c5 NF: add types to noteimp.py 2021-03-26 11:14:08 +10:00
Damien Elmes
0c63a7c8c4 rework translation handling
Instead of generating a fluent.proto file with a giant enum, create
a .json file representing the translations that downstream consumers
can use for code generation.

This enables the generation of a separate method for each translation,
with a docstring that shows the actual text, and any required arguments
listed in the function signature.

The codebase is still using the old enum for now; updating it will need
to come in future commits, and the old enum will need to be kept
around, as add-ons are referencing it.

Other changes:

- move translation code into a separate crate
- store the translations on a per-file/module basis, which will allow
us to avoid sending 1000+ strings on each JS page load in the future
- drop the undocumented support for external .ftl files, that we weren't
using
- duplicate strings in translation files are now checked for at build
time
- fix i18n test failing when run outside Bazel
- drop slog dependency in i18n module
2021-03-26 09:41:32 +10:00
Damien Elmes
46dc212207 move markdown dep into pylib 2021-03-24 22:19:14 +10:00
Damien Elmes
be9e46a9ea rework filtered deck screen & search errors
- Filtered deck creation now happens as an atomic operation, and is
undoable.
- The logic for initial search text, normalizing searches and so on
has been pushed into the backend.
- Use protobuf to pass the filtered deck to the updated dialog, so
we don't need to deal with untyped JSON.
- Change the "revise your search?" prompt to be a simple info box -
user has access to cancel and build buttons, and doesn't need a separate
prompt. Tweak the wording so the 'show excluded' button should be more
obvious.
- Filtered decks have a time appended to them instead of a number,
primarily because it's easier to implement. No objections going back to
the old behaviour if someone wants to contribute a clean patch.
The standard de-duplication will happen if two decks are created in the
same minute with the same name.
- Tweak the default sort order, and start with two searches. The UI
will still hide the second search by default, but by starting with two,
the frontend doesn't need logic for creating the starting text.
- Search errors now have their own error type, instead of using
InvalidInput, as that was intended mainly for bad API calls. The markdown
conversion is done when the error is converted from the backend, allowing
errors to printed as a string without any special handling by the calling
code.

TODO: when building a new filtered deck, update_active() is clobbering
the undo log when the overview is refreshed
2021-03-24 22:04:35 +10:00
Damien Elmes
53f8e06172 rename&simplify the deck/config type aliases
- QueueConfig is only used by the scheduler
- DeckConfig was being used in places that Config should have been used
- Add "Dict" to the name so that the bare name is free for use with a
stronger type.
2021-03-24 16:29:02 +10:00
Damien Elmes
d80ed5ff3b support undo of filtered deck build/empty 2021-03-24 12:56:06 +10:00
Damien Elmes
2bffcba345 Merge pull request #1082 from RumovZ/backend-rows
Backend rows
2021-03-23 18:31:42 +10:00
Damien Elmes
15c76c1a09 switch DeckID to a NewType
Not sure at this point whether this will buy us much in the Python
codebase over a simple int alias, but let's give it a go.
2021-03-22 23:43:54 +10:00
Damien Elmes
fafe30f4b4 use perform_op() for deck creation 2021-03-22 23:17:07 +10:00
Damien Elmes
12e1ca0c2f deck rename with perform_op() 2021-03-22 20:38:51 +10:00
Damien Elmes
42d007d94d use perform_op() for deck drag&drop 2021-03-22 18:23:56 +10:00