-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add i18n support to app/myelectric in emoncms 9.x #11
base: 9.0
Are you sure you want to change the base?
Conversation
These modifications will only work if the user_model.php file is changed to enable the user language selection with apikey login. myelectricmenu.php: adapted to i18n, install a fr_FR messages file Myelectric.html: Réorganised the seperation between code and presentation, to move css outside of page as much as possible. Install a JS mechanism to translate the hard coded presentation text, myelectric.html page. create a json dictionnary for translations, ref, en, and fr myelectric.js has been partially jslinted added a README.md file with installation and startup instructions
rem : there is a typo in user_model.php, sql string use language instead of lang
I think it's now complete. |
Thanks for this, just tested quickly I get error when I try and load emoncms after switching to your branch:
https://github.com/emoncms/emoncms/blob/master/Modules/user/user_model.php#L443 |
Hi glynhudson, I think I had the same error before I made the database update. I have written the README just after that episode. Beside the need to update the database, there maybe a better way to advise the user of a missing table. I see two methods: Which is the best?
I did not fork versiion 9.x. |
I would say the database would need force update since after updating to these changes I could not even load the emoncms login page, therefore is no way to update the database in the usual way. What do you think @TrystanLea ? |
remove JS language files to not interfere with user profile avauilable languages
@glynhudson I added a table existence test and an error page with a direct access to 'admin/db' for a db update using built-in procedure. |
Hello Euqip I've made the correction to user_model. I think your check table function needs to be:
Would you be able to set the colours for the myelectric totals all to blue? as the other colours are more in relation to solarpv etc. In myelectric config I see the error: "Missing keys in i18n file" should that be shown at this point? could it be hidden if not needed? |
The graph part of my heatpump view has also lost the way the background colour used to stretch to the screen width and are the value colours for solarpv and wind in my energy changed? |
When you adjust the myelectric page width its also doing some strange things.. the realtime graph expands down the page. Is there a way to maintain the previous behaviour? I havent had a chance yet to look through the code in detail |
Hi Tristan and Glyn In new pullrequest I changed the checktable code the way proposed, its shorter and efficient. Hope it will be better now. |
Hi Glyn, I have seen your comments on the difference between before and after. The displayed values are feeds, so I do not understand that the mods I have done will change the results. The feeds are provided by the core application and displayed on screen at a specific place with the desired colour. I am not sure the difference is in code, but in settings. For the second view, in mysolarpv, the error is not a formating error, this result is obtained when app.js does not find the required feeds, I had the same with app_config defined like this: "mysolarpv":{"solarpower":[0],"housepower":[0]} remove this content and the formating will be correct. I will check this bug for a correction after the changes I made are acceptable. |
The solar pv page gives the following error in my browser: TypeError: Math.parseInt is not a function I think it should be just parseInt (https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/parseInt) Otherwise the myelectric page is now responding correctly to screen resizes :) Although not sure if currency is working properly? it prints pound to screen rather than £, the original works as expected for me. |
++ sorry I see that the heatpump page formatting is actually incorrect in the original too. Im working on a new interface for this so might be best for me to remove this page completely |
Hi Tristan this code has been changed $("#myelectric_usetoday_units_a").html("&"+app_myelectric.currency+";");
to
$("#myelectric_usetoday_units_a").html(app_myelectric.currency); Could you please enter the pound symbol (£) in your settings, and see what happens. Hope it will work better. I just discovered the € works too. (why not), but if you choose for USD, it will not be ok. |
parseInt is gives an error in jslint, but works perfect. After having rechecked at W3S and Mozilla, its practically the only math function not using this prefix. I changed my source. |
protect solarPV against lock with missing feeds fallback to 'en' if language js file is missing insert new texts in i18n js files
further translations possibiilities
The support is only possible when enabling user language instead of 'en' with apikey login! This is to be done in user_model.php and is not part of this pull request.