iNavFlight / OpenTX-Telemetry-Widget

INAV Lua Telemetry with support for EdgeTX
https://luatelemetry.readthedocs.io/en/latest/
GNU General Public License v3.0
155 stars 32 forks source link

Can't select languages other than English. #150

Open RobertoD91 opened 1 month ago

RobertoD91 commented 1 month ago

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 commented 1 month ago

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?

stronnag commented 1 month ago

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

RobertoD91 commented 1 month ago

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.

nm17 commented 1 month ago

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.