slint icon indicating copy to clipboard operation
slint copied to clipboard

Add support for translations on Windows

Open tronical opened this issue 2 years ago • 1 comments

Support for translations via gettext is currently not supported on Windows.

This is due to a couple of issues:

  1. We have #[cfg(...)] in place on our end to disable gettext-rs.
  2. Even with those out of the way, gettext-rs on Windows requires tools such as tar to be installed in the path. See also https://github.com/Koka/gettext-rs/issues/12
  3. It's unclear how initialisation the locale works without locale definitions.

Instead, it might make more sense to switch to gettext. Then however the burden is on on us to locale the correct .mo files.

tronical avatar Aug 21 '23 09:08 tronical

The Slint language documentation should mention that @tr() currently doesn't work on Windows.

Enyium avatar Aug 10 '24 16:08 Enyium

Any updates on this issue, or are there any workarounds available?

breadgrocery avatar Nov 30 '24 03:11 breadgrocery

Oliver implemented Support for translations that are bundled with the app and don't require gettext. Those work everywhere and will be in the next release.

You can take a sneak peek here:

https://snapshots.slint.dev/master/docs/slint/guide/development/localization/#bundled-translations

tronical avatar Nov 30 '24 08:11 tronical

https://snapshots.slint.dev/master/docs/slint/guide/development/localization/#bundled-translations

It truly helps! Thank you!

The only small issue was that the doc didn't mention that I should use the slint_build::compile_with_config function, and that the slint::select_bundled_translation function must be called after creating the first component until I refered to the rustdoc.

Expect improved in the next release of the documentation.

breadgrocery avatar Dec 01 '24 05:12 breadgrocery