Skip to content
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

Incorrect "en-EN" locale code used in emoncms? #888

Closed
pb66 opened this issue Jun 18, 2018 · 2 comments
Closed

Incorrect "en-EN" locale code used in emoncms? #888

pb66 opened this issue Jun 18, 2018 · 2 comments
Assignees

Comments

@pb66
Copy link
Collaborator

pb66 commented Jun 18, 2018

I am trying to understand some user profile code in emoncms and noticed that the default locale code seems to be "en_EN" is that intended/correct?

It doesn't seem to be a standard locale code, should we not be using "en-GB" as the default?

(I'm new to JS and not great with PHP so apologies if I ask a stupid question)

Whilst looking at using a user account timezone in client run javascript I found the JS toLocaleString() function uses a locale to format the date and time string eg

var acct_time = new Date().toLocaleString("en-GB", {timeZone: "Australia/Sydney", timeZoneName: "long"})
document.getElementById('acct_time').innerHTML = acct_time;

so I was just pondering on whether the session['lang'] would be suitable/available to use (in addition to adding a new session['timezone'] variable) and found this code which threw me a bit.

https://github.com/emoncms/emoncms/blob/9.8.30/locale.php#L62-L93

This won't effect using a user account (session?) timezone directly, but I was thinking that displaying the current time in both session and browser timezones might be useful to the viewer.

@emrysr
Copy link
Contributor

emrysr commented Jun 25, 2018

Hi @pb66 ,

I added the session variables here:
https://github.com/emoncms/emoncms/pull/896/files#diff-3a8983b5e260461fe91544f3ff97de77R733

Not yet sure what will make use of them?

@pb66
Copy link
Collaborator Author

pb66 commented Jun 26, 2018

When I was trying to figure out how to make the user account timezone available to dashboards and apps etc, I noticed the "lang" variable was already in the session data and I figured that was the way to go. I have since worked out that because dashboards and apps are also available without being logged in, either publicly or using read or write apikeys in the urls, this will not work for all viewing instances.

So I now do not know if that data is of any real value in the session data as any fix for non-logged in viewing will still be available for logged in viewing, I do not know why the "lang" was already there either.

But thanks for fixing the en-GB locale code, I haven't tried it yet but it looks good :-)

@pb66 pb66 closed this as completed Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants