mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-11 00:11:46 +00:00
refactor(xtask): read the i18n registry from i18n.rs
This commit is contained in:
1 parent
b7b113352e
commit
25e8edb784
3 files changed
+5
-5
No files matched your search
+1
-1
@@ -344,7 +344,7 @@ the live command registry (`menus::is_live`) and rewrites [`docs/parity-checklis
|
||||
`parity::tests::parity_does_not_regress` fails if the live count drops below `parity::FLOOR`.
|
||||
|
||||
`cargo xtask i18n-coverage` prints the UI translation coverage for each language in the
|
||||
`crates/ui-egui/src/i18n/mod.rs` registry, in stable language-code order. Its English-key set is
|
||||
`crates/ui-egui/src/i18n.rs` registry, in stable language-code order. Its English-key set is
|
||||
derived from UI `tl!` literals, the menu catalog and UI command table, and menu command labels in
|
||||
the engine source. Catalog rows are validated for malformed and duplicate keys; unused legacy
|
||||
translations do not affect the denominator. Unregistered locale TSV files are ignored. After the
|
||||
|
||||
@@ -27,7 +27,7 @@ language manually there.
|
||||
|
||||
- `crates/ui-egui/src/i18n/zh-hans.tsv` contains the translations, independent of
|
||||
the lookup implementation. Its UTF-8 columns are `context<TAB>source<TAB>translation`.
|
||||
- `crates/ui-egui/src/i18n/mod.rs` registers `zh-hans` with one plural form and
|
||||
- `crates/ui-egui/src/i18n.rs` registers `zh-hans` with one plural form and
|
||||
`complete_menus: true`. `cargo xtask i18n-coverage` lists any menu string,
|
||||
`tl!` literal or other source key the catalog lacks; those show in English.
|
||||
- Shortcut templates retain `{key}` so the shell supplies the correct key for
|
||||
|
||||
@@ -16,7 +16,7 @@ struct Language {
|
||||
|
||||
pub fn run(root: &Path) -> Result<(), String> {
|
||||
let i18n_dir = root.join("crates/ui-egui/src/i18n");
|
||||
let registry_path = i18n_dir.join("mod.rs");
|
||||
let registry_path = root.join("crates/ui-egui/src/i18n.rs");
|
||||
let registry = fs::read_to_string(®istry_path).map_err(|e| format!("{}: {e}", registry_path.display()))?;
|
||||
let languages = registered_languages(®istry)?;
|
||||
|
||||
@@ -176,7 +176,7 @@ fn source_files(root: &Path) -> Result<Vec<(PathBuf, String)>, String> {
|
||||
fn tl_keys(sources: &[(PathBuf, String)]) -> BTreeSet<Key> {
|
||||
let mut keys = BTreeSet::new();
|
||||
for (path, source) in sources {
|
||||
if path.ends_with("i18n/mod.rs") {
|
||||
if path.ends_with("ui-egui/src/i18n.rs") {
|
||||
continue;
|
||||
}
|
||||
let code = before_test_module(source);
|
||||
@@ -202,7 +202,7 @@ fn tl_keys(sources: &[(PathBuf, String)]) -> BTreeSet<Key> {
|
||||
fn plural_keys(sources: &[(PathBuf, String)]) -> BTreeSet<Key> {
|
||||
let mut keys = BTreeSet::new();
|
||||
for (path, source) in sources {
|
||||
if path.ends_with("i18n/mod.rs") {
|
||||
if path.ends_with("ui-egui/src/i18n.rs") {
|
||||
continue;
|
||||
}
|
||||
let code = before_test_module(source);
|
||||
|
||||
Reference in new issue
Block a user