mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-09-14 11:06:16 +05:00
Added Localizations to Weather app
This commit is contained in:
parent
ab220221d3
commit
bc81aca9f4
18
Applications/Weather.app/Localizations/English.lang
Normal file
18
Applications/Weather.app/Localizations/English.lang
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
winds = {
|
||||
[0] = "N",
|
||||
[1] = "NE",
|
||||
[2] = "E",
|
||||
[3] = "SE",
|
||||
[4] = "S",
|
||||
[5] = "SW",
|
||||
[6] = "W",
|
||||
[7] = "NW",
|
||||
[8] = "N",
|
||||
},
|
||||
mmHg = " mm Hg",
|
||||
speed = " m/s, ",
|
||||
population = "Population: ",
|
||||
city = "Type city name here",
|
||||
cityError = "Wrong result. Check city name and try again."
|
||||
}
|
||||
18
Applications/Weather.app/Localizations/Russian.lang
Normal file
18
Applications/Weather.app/Localizations/Russian.lang
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
winds = {
|
||||
[0] = "С",
|
||||
[1] = "СВ",
|
||||
[2] = "В",
|
||||
[3] = "ЮВ",
|
||||
[4] = "Ю",
|
||||
[5] = "ЮЗ",
|
||||
[6] = "З",
|
||||
[7] = "СЗ",
|
||||
[8] = "С",
|
||||
},
|
||||
mmHg = " мм рт. ст.",
|
||||
speed = " м/с, ",
|
||||
population = "Популяция: ",
|
||||
city = "Введите название города",
|
||||
cityError = "Неправильный результат. Проверьте название города и повторите попытку."
|
||||
}
|
||||
@ -35,6 +35,7 @@ local config = {
|
||||
lastCityName = "Санкт-Петербург"
|
||||
}
|
||||
|
||||
local locale = system.getCurrentScriptLocalization()
|
||||
--------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function newWeather(x, y, day)
|
||||
@ -60,20 +61,10 @@ local function newWeather(x, y, day)
|
||||
end
|
||||
|
||||
local temp = number.round(day.temp.min) .. " / " .. number.round(day.temp.max) .. " °C"
|
||||
local pressure = number.round(day.pressure / 1.33322387415) .. " mm Hg"
|
||||
local pressure = number.round(day.pressure / 1.33322387415) .. locale.mmHg
|
||||
local humidity = number.round(day.humidity) .. "%"
|
||||
local winds = {
|
||||
[0] = "N",
|
||||
[1] = "NE",
|
||||
[2] = "E",
|
||||
[3] = "SE",
|
||||
[4] = "S",
|
||||
[5] = "SW",
|
||||
[6] = "W",
|
||||
[7] = "NW",
|
||||
[8] = "N",
|
||||
}
|
||||
local wind = day.speed .. " m/s, " .. (winds[number.round(day.deg / 45)] or "N/A")
|
||||
local winds = locale.winds
|
||||
local wind = day.speed .. locale.speed .. (winds[number.round(day.deg / 45)] or "N/A")
|
||||
|
||||
local function centerText(y, color, text)
|
||||
screen.drawText(math.floor(object.x + object.width / 2 - unicode.len(text) / 2), y, color, text)
|
||||
@ -105,12 +96,12 @@ local function updateForecast()
|
||||
object.draw = function()
|
||||
bigLetters.drawText(object.x, object.y, 0xFFFFFF, number.round((currentDay.temp.max + currentDay.temp.min) / 2) .. "°")
|
||||
screen.drawText(object.x, object.y + 6, 0xFFFFFF, result.city.name .. ", " .. result.city.country)
|
||||
screen.drawText(object.x, object.y + 7, 0xFFFFFF, "Population: " .. number.shorten(result.city.population, 2))
|
||||
screen.drawText(object.x, object.y + 7, 0xFFFFFF, locale.population .. number.shorten(result.city.population, 2))
|
||||
end
|
||||
|
||||
y = y + object.height + 1
|
||||
|
||||
local input = weatherContainer:addChild(GUI.input(x + 2, y, 25, 1, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, "", "Type city name here"))
|
||||
local input = weatherContainer:addChild(GUI.input(x + 2, y, 25, 1, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, "", locale.city))
|
||||
input.onInputFinished = function()
|
||||
config.lastCityName = input.text
|
||||
updateForecast()
|
||||
@ -152,14 +143,3 @@ if fs.exists(configPath) then
|
||||
end
|
||||
|
||||
updateForecast()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user