anki/cargo
Damien Elmes 9aece2a7b8 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
..
remote rework translation handling 2021-03-26 09:41:32 +10:00
BUILD.bazel switch to workspace for Rust code 2020-11-24 18:41:03 +10:00
BUILD.reqwest.bazel update Rust deps 2021-03-10 11:53:27 +10:00
crates.bzl rework translation handling 2021-03-26 09:41:32 +10:00
licenses.json rework translation handling 2021-03-26 09:41:32 +10:00
README.md add note about bumping Rust deps 2021-03-15 13:29:36 +10:00
update.py update is executable 2021-03-13 07:35:36 +01:00

This folder integrates Rust crates.io fetching into Bazel.

To update dependencies, ensure a local Rust environment is available (eg install rustup), then run:

cargo install cargo-raze --version 0.8.0

After updating dependencies in ../rslib/Cargo.toml, change to this folder and run python update.py to update the external Bazel repositories to point to the updated deps.

A couple of crates need extra work to build with Bazel, and are listed in ../Cargo.toml. For example:

[package.metadata.raze.crates.pyo3.'*']
compile_data_attr = "glob([\"**\"])"

With minor version updates, you should not normally need to modify the entries in that file.

Because update.py modifies a lot of files in remote/, it makes it difficult to review in a PR, and the changes can sometimes break platforms like Windows. For this reason, please don't submit PRs that do minor version bumps - those will typically be done after stable releases. If you need a new crate for a feature you're working on, please raise it in an issue first.