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

Not defined language and units #207

Open
baublys opened this issue Jan 9, 2020 · 1 comment
Open

Not defined language and units #207

baublys opened this issue Jan 9, 2020 · 1 comment

Comments

@baublys
Copy link

baublys commented Jan 9, 2020

Here the following is written:

lang = [language] optional
Return summary properties in the desired language. (Note that units in the summary will be set according to the units parameter, so be sure to set both parameters appropriately.)
units = [units] optional
Return weather conditions in the requested units. [units] should be one of the following:
auto: automatically select units based on geographic location

I added in app.js to the getForecastFromNetwork function "?Lang=ru&units=auto":

function getForecastFromNetwork(coords) {
  return fetch(`/forecast/${coords}?lang=ru&units=auto`)
    .then(response => {
      return response.json();
    })
    .catch(() => {
      return null;
    });
}

Errors appeared in app.js:

'luxon' is not defined
Снимок экрана (4447)

Error in index.html:

The attribute name of [viewBox] must be in a lowercase.

<div id="weather-template" class="weather-card" hidden>
        <div class="card-spinner">
 HERE>> <svg viewBox="0 0 32 32" width="32" height="32"> <<HERE
            <circle cx="16" cy="16" r="14" fill="none"></circle>
          </svg>
</div>

Снимок экрана (4448)

General view: still Fahrenheit and miles/hour instead of Celsius and meters/second.
Снимок экрана (4444)

I would be grateful for a hint on how to change the code so that the language and units of measurement are correctly determined.

@baublys
Copy link
Author

baublys commented Jan 30, 2020

Found.
It is also necessary to add the same fragment "?Lang=ru&units=auto" in function getForecast() to server.js.
Unfortunately, in the index.html file, the units are static. Therefore, instead of "°F" you can write "°F/°C".
But it is better to analyze “timezone” in the answer and if “America/New_York”, then substitute “°F”, otherwise set “°C”.

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

1 participant