Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t! return previous value in the file #46

Open
doowonee opened this issue Aug 3, 2023 · 5 comments
Open

t! return previous value in the file #46

doowonee opened this issue Aug 3, 2023 · 5 comments

Comments

@doowonee
Copy link

doowonee commented Aug 3, 2023

Does it can detect file changed and compile newer version of locale files? It seems not work.

I just modified the value with the same key locale file en.toml and it just showed me previous value of it.

How to tell rust-i18n to file is changed?

@huacnlee
Copy link
Member

huacnlee commented Aug 4, 2023

Show me your file struct please

@doowonee
Copy link
Author

doowonee commented Aug 4, 2023

I use cargo workspace and i18n is in A crate in workspace.

I usually run B crate. When I modified en.toml in A crate and run B it shows not changed. only after cargo clean works

@juh9870
Copy link

juh9870 commented Sep 2, 2023

From my observations, if you modify only localization files in crate A, Cargo will not trigger a rebuild when crate B, which depends on A, is compiled. This results in B using an outdated version of A's localization files.

@juh9870
Copy link

juh9870 commented Sep 2, 2023

One solution I got hinted at in the Rust GameDev discord is to add locales folder as a build dependency via buildscript in crate A. Like this:
build.rs

fn main() {
    println!("cargo:rerun-if-changed=locales");
}

Note that this will rebuild the whole crate A every time you change localization files.

@doowonee
Copy link
Author

doowonee commented Sep 2, 2023

Thank you for your investigation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants