mlverse / torch

R Interface to Torch
https://torch.mlverse.org
Other
490 stars 64 forks source link

fix R-level fr-FR translation #1176

Open cregouby opened 3 months ago

cregouby commented 3 months ago

After some exchange with Philippe Grosjean during the French Rencontre R 2024, I finally got the correct way to wrap R-level messages so that they get translated.

> withr::with_language(lang = "fr",
+                      torch_scalar_tensor(torch_randn(8, 2, 7))
+ )
Error in `value_error()` at torch/R/creation-ops.R:380:5:
! les valeurs doivent être de longueur 1
Run `rlang::last_trace()` to see where the error occurred.
Called from: signal_abort(cnd, .file)
Browse[1]> 
> 

Note Cpp-level translation is

dfalbel commented 3 months ago

@cregouby I rebased the PR. Some test cases are failing, and they seem related to this PR.

cregouby commented 3 months ago

Oh ! Sorry for that. Please give me some time to have a deeper look...

dfalbel commented 3 months ago

No worries, let me know if you want me to take a look too!

dfalbel commented 3 months ago

I also just added you as a collaborator so you don't need to wait for me to approve and run your PR's.

cregouby commented 3 months ago

Thanks, I feel honored !