OpenTX-Telemetry-Widget icon indicating copy to clipboard operation
OpenTX-Telemetry-Widget copied to clipboard

Can't select languages other than English.

Open RobertoD91 opened this issue 1 year ago • 4 comments

Describe the bug

The script always runs in English, regardless of the selected language. Even with a custom EdgeTX build in another language or by setting

data.lang = "es"
data.voice = "es"

in SCRIPTS/TELEMETRY/iNav.lua it still defaults to English.

Tested on Jumper T16 with EdgeTX 2.10.2 and Edge Companion Simulator.

To reproduce

  1. Edit file SCRIPTS/TELEMETRY/iNav.lua changing data.lang and data.voice
  2. widget always loads in english

Expected behavior

The script should use the selected language.

Screenshots

n.a.

Radio and model settings

I believe these are not relevant; I also tested with an empty SD card.

Additional context

if i change from

lang = loadScript(FILE_PATH .. "lang" .. ext, env)(modes, labels, data, FILE_PATH, env)

to (for example)

lang = loadScript(FILE_PATH .. "lang_es" .. ext, env)(modes, labels, data, FILE_PATH, env)

it works

RobertoD91 avatar Jul 14 '24 00:07 RobertoD91

Ok, the "problem" was in src/SCRIPTS/TELEMETRY/iNav/lang.lua on line 5 local tmp = FILE_PATH .. "lang_" .. data.lang .. ".luac" It search for compiled .luac instead of .lua (Since I was working on italian translation on the simulator and the .luac don't exist)

Also, the .wav files I was using were in the wrong format.

Maybe we can update the documentation for the translator?

RobertoD91 avatar Jul 14 '24 12:07 RobertoD91

You should be able to just remove the .. ".luac" and the interpreter will do the right thing.

Documentation PRs are gratefully received; all it needs to say is "WAV format as defined by OpenTX / EdgeTX". It may also be that OpenTX and EdgeTX have different WAV formats, in which case the user may have to reformat the files as needed.

e.g. see EdgeTX documentation

stronnag avatar Jul 14 '24 13:07 stronnag

e.g. see EdgeTX documentation

Greatly appreciated. There are CSV files and a script for auto-generating voices. I will do another pull request with new voices.

RobertoD91 avatar Jul 15 '24 17:07 RobertoD91

You should be able to just remove the .. ".luac" and the interpreter will do the right thing.

Maybe we should fix that to use ".lua"? Since it is always available.

nm17 avatar Jul 19 '24 07:07 nm17