REAPER-ReaScripts icon indicating copy to clipboard operation
REAPER-ReaScripts copied to clipboard

Conditionals by envelope name should use `LocalizeString()`

Open Phroneris opened this issue 2 months ago • 2 comments

Hello, thank you for providing tons of cool utilities!

I tried to use X-Raym_Set selected tempo envelope points value.lua, but nothing happened despite the tempo envelope is already selected.

I took a look into the IDE and found that env_name is set to "テンポマップ" on my REAPER v6.83 with Japanese localization. "テンポマップ" is "tempo map" in Japanese.

So,

https://github.com/X-Raym/REAPER-ReaScripts/blob/92806706c1287326e4748dc0749df609dfaf70c3/Tempo%20and%20Time%20Signature/X-Raym_Set%20selected%20tempo%20envelope%20points%20value.lua#L49

the env_name should be compared with reaper.LocalizeString("Tempo map", "env"), or at least reaper.LocalizeString("Tempo map", "common"), instead of bare "Tempo map".

I'm afraid that the same thing would be happening on any other scripts which detect something by name.

Phroneris avatar Apr 22 '24 14:04 Phroneris

@Phroneris Oh wow, I didn't know under the hood (from API), the get envelope name function returned a localized version of the string... I though it was the rough initial string. I wonder if it was always like this or if something change, cause I have tons of scripts and some where shared on French community, but this is the first report.

Thanks for detailed report and solution exploration. I'll see if I can consider put time on this, and explore a bit more this, but for now I can only ask for patience cause the number of scripts checking for envelope name at some point is quite big.

Cheers !

X-Raym avatar Apr 22 '24 15:04 X-Raym

@X-Raym The reason why I figured out the cause clearly may be that I AM the author of Japanese language pack. If you're interested, get JPN_Phroneris.ReaperLangPack (in zip) and find entries with AEF53FB432FD3810 key under [common]/[env] sections.

FYI there used to be a similar problem with GetTrackEnvelopeByName()/GetTakeEnvelopeByName(), but it was fixed sometime ago: https://forum.cockos.com/showpost.php?p=1966814&postcount=393 How worrisome for ReaScripters!

Phroneris avatar Apr 22 '24 16:04 Phroneris