Skip to content

Trouble with text translation #3243

Answered by tronical
chianti-ga asked this question in Q&A
Discussion options

You must be logged in to vote

I also tried your example now and it works for me on macOS if I set LANG=fr, with one caveat:

In your src/main.rs you initialise the base directory for your translations to be next to the executable:

slint::init_translations!(std::env::current_exe().unwrap().parent().unwrap().join("lang"));

If I run with cargo run, the executable will be in target/debug/gmod_3d_packager and consequently slint will try to look for translations target/debug/lang - which doesn't exist.

You can either copy the executable out of there into the root, or (for the purpose of development) use

slint::init_translations!(concat!(env!("CARGO_MANIFEST_DIR"), "/lang/"));

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tronical
Comment options

Answer selected by tronical
@chianti-ga
Comment options

@tronical
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants