Commit graph

19 commits

Author SHA1 Message Date
Damien Elmes
5ef618d8fa add a few more ftl type hints 2021-03-29 15:55:15 +10:00
Damien Elmes
3dee049128 gate qt template inclusion on extra_ftl_root name
Bazel was not noticing that the build script needs to be recompiled
when the qt templates flag was changed.
2021-03-29 13:17:38 +10:00
Damien Elmes
2338998304 update to the latest rules_rust + security framework update 2021-03-27 19:28:19 +10:00
Damien Elmes
0a4bcd3faa update Rust deps 2021-03-27 14:47:16 +10:00
Damien Elmes
c9eddfabac add string/number distinction to generated Rust methods 2021-03-27 14:31:23 +10:00
Damien Elmes
66d84336d7 update to latest Fluent 2021-03-27 13:24:11 +10:00
Damien Elmes
9a7f0f9f5d i18n->tr in rslib/ to match Python/TS code 2021-03-27 12:09:51 +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
d7005803bc update 1 arg tr strings in rslib 2021-03-27 10:39:53 +10:00
Damien Elmes
0421ae3e6d preserve variable order when extracting from ftl files 2021-03-27 09:09:13 +10:00
Damien Elmes
26d265ce08 write methods into generated.rs 2021-03-26 23:07:18 +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
0e50259e6b update TR references with args in *.ts; fix average answer time 2021-03-26 19:10:39 +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
c52bafd1ef delimit variables in docstrings to make them easier to read 2021-03-26 14:38:30 +10:00
Damien Elmes
ee2d3500e5 catch variables only used in plural selection 2021-03-26 14:20:44 +10:00
Damien Elmes
834a7217d6 embed strings.json into write_json.rs
It appears that including the build script as a dependency is not
enough to make the file available at runtime, so the build breaks
if ts/ is built first.
2021-03-26 09:55:21 +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