OpenSprinkler / OpenSprinkler-App

A mobile interface for the OpenSprinkler irrigation device. Designed to allow manual control, program management (preview, add, edit, and delete), initiation of a run-once program, viewing graphical and tabulated representations of log data, viewing device status, adjusting rain delay, and changing of OpenSprinkler settings.
https://opensprinkler.com
GNU Affero General Public License v3.0
172 stars 93 forks source link

Text translations are called before language is initialized #125

Open DMT07 opened 3 years ago

DMT07 commented 3 years ago

A number of text strings do not translate and I believe the problem may be the following:

A number of functions are instantiated as variables:

These functions are instantiated as variables/objects while the language variable is still undefined. updateLang() is only called in initApp() after all the above functions have been instantiated.

It seems that the text strings that are instantiated within the body of the functions only get called once when the function object is instantiated. Because the language variable is still undefined at that time, any translation call returns the default English version. When methods are called thereafter, those text strings are not updated again.

I have a very rudimentary understanding of javascript so I don't know if there is any easy or elegant way to fix this other than to deliberatly update those text string variables everytime the respective methods are called.

salbahra commented 1 year ago

Thank you for this report and apologizes for the delay!

I'll see if I can take a look at this issue soon.