mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
feat(player_list): added internationalization
This commit is contained in:
parent
a77e6ded7b
commit
b02929edf0
@ -148,8 +148,9 @@ local column_builders = {
|
|||||||
sort = function(a, b)
|
sort = function(a, b)
|
||||||
return a.name:lower() < b.name:lower()
|
return a.name:lower() < b.name:lower()
|
||||||
end,
|
end,
|
||||||
draw_heading = function(parent)
|
draw_heading = function(parent, data, sort_symbol)
|
||||||
local label = parent.add {type = 'label', name = player_name_heading_name, caption = 'Name'}
|
local caption = {'player_list.name_caption', sort_symbol}
|
||||||
|
local label = parent.add {type = 'label', name = player_name_heading_name, caption = caption}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
apply_heading_style(label_style)
|
apply_heading_style(label_style)
|
||||||
label_style.width = 150
|
label_style.width = 150
|
||||||
@ -182,8 +183,9 @@ local column_builders = {
|
|||||||
sort = function(a, b)
|
sort = function(a, b)
|
||||||
return a < b
|
return a < b
|
||||||
end,
|
end,
|
||||||
draw_heading = function(parent)
|
draw_heading = function(parent, data, sort_symbol)
|
||||||
local label = parent.add {type = 'label', name = time_heading_name, caption = 'Time'}
|
local caption = {'player_list.time_caption', sort_symbol}
|
||||||
|
local label = parent.add {type = 'label', name = time_heading_name, caption = caption}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
apply_heading_style(label_style)
|
apply_heading_style(label_style)
|
||||||
label_style.width = 125
|
label_style.width = 125
|
||||||
@ -216,8 +218,9 @@ local column_builders = {
|
|||||||
end
|
end
|
||||||
return a_rank < b_rank
|
return a_rank < b_rank
|
||||||
end,
|
end,
|
||||||
draw_heading = function(parent)
|
draw_heading = function(parent, data, sort_symbol)
|
||||||
local label = parent.add {type = 'label', name = rank_heading_name, caption = 'Rank'}
|
local caption = {'player_list.rank_caption', sort_symbol}
|
||||||
|
local label = parent.add {type = 'label', name = rank_heading_name, caption = caption}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
apply_heading_style(label_style)
|
apply_heading_style(label_style)
|
||||||
label_style.width = rank_column_width
|
label_style.width = rank_column_width
|
||||||
@ -258,8 +261,9 @@ local column_builders = {
|
|||||||
sort = function(a, b)
|
sort = function(a, b)
|
||||||
return a < b
|
return a < b
|
||||||
end,
|
end,
|
||||||
draw_heading = function(parent)
|
draw_heading = function(parent, data, sort_symbol)
|
||||||
local label = parent.add {type = 'label', name = distance_heading_name, caption = 'Distance'}
|
local caption = {'player_list.distance_caption', sort_symbol}
|
||||||
|
local label = parent.add {type = 'label', name = distance_heading_name, caption = caption}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
apply_heading_style(label_style)
|
apply_heading_style(label_style)
|
||||||
label_style.width = 70
|
label_style.width = 70
|
||||||
@ -293,12 +297,13 @@ local column_builders = {
|
|||||||
return a_coin_earned < b_coin_earned
|
return a_coin_earned < b_coin_earned
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
draw_heading = function(parent)
|
draw_heading = function(parent, data, sort_symbol)
|
||||||
|
local caption = {'player_list.coins_caption', sort_symbol}
|
||||||
local label =
|
local label =
|
||||||
parent.add {
|
parent.add {
|
||||||
type = 'label',
|
type = 'label',
|
||||||
name = coin_heading_name,
|
name = coin_heading_name,
|
||||||
caption = 'Coins',
|
caption = caption,
|
||||||
tooltip = 'Coins earned / spent.'
|
tooltip = 'Coins earned / spent.'
|
||||||
}
|
}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
@ -329,8 +334,9 @@ local column_builders = {
|
|||||||
sort = function(a, b)
|
sort = function(a, b)
|
||||||
return a.count < b.count
|
return a.count < b.count
|
||||||
end,
|
end,
|
||||||
draw_heading = function(parent)
|
draw_heading = function(parent, data, sort_symbol)
|
||||||
local label = parent.add {type = 'label', name = deaths_heading_name, caption = 'Deaths'}
|
local caption = {'player_list.deaths_caption', sort_symbol}
|
||||||
|
local label = parent.add {type = 'label', name = deaths_heading_name, caption = caption}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
apply_heading_style(label_style)
|
apply_heading_style(label_style)
|
||||||
label_style.width = 60
|
label_style.width = 60
|
||||||
@ -364,8 +370,9 @@ local column_builders = {
|
|||||||
sort = function(a, b)
|
sort = function(a, b)
|
||||||
return a.poke_count < b.poke_count
|
return a.poke_count < b.poke_count
|
||||||
end,
|
end,
|
||||||
draw_heading = function(parent, data)
|
draw_heading = function(parent, data, sort_symbol)
|
||||||
local label = parent.add {type = 'label', name = poke_name_heading_name, caption = 'Poke'}
|
local caption = {'player_list.poke_caption', sort_symbol}
|
||||||
|
local label = parent.add {type = 'label', name = poke_name_heading_name, caption = caption}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
apply_heading_style(label_style)
|
apply_heading_style(label_style)
|
||||||
label_style.width = 60
|
label_style.width = 60
|
||||||
@ -406,13 +413,14 @@ local column_builders = {
|
|||||||
sort = function(a, b)
|
sort = function(a, b)
|
||||||
return a.name:lower() < b.name:lower()
|
return a.name:lower() < b.name:lower()
|
||||||
end,
|
end,
|
||||||
draw_heading = function(parent)
|
draw_heading = function(parent, data, sort_symbol)
|
||||||
|
local caption = {'player_list.report_caption', sort_symbol}
|
||||||
local label =
|
local label =
|
||||||
parent.add {
|
parent.add {
|
||||||
type = 'label',
|
type = 'label',
|
||||||
name = report_heading_name,
|
name = report_heading_name,
|
||||||
caption = 'Report',
|
caption = caption,
|
||||||
tooltip = 'Report player to the admin team for griefing or breaking the rules.'
|
tooltip = {'player_list.report_tooltip'}
|
||||||
}
|
}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
apply_heading_style(label_style)
|
apply_heading_style(label_style)
|
||||||
@ -430,7 +438,7 @@ local column_builders = {
|
|||||||
type = 'sprite-button',
|
type = 'sprite-button',
|
||||||
name = report_cell_name,
|
name = report_cell_name,
|
||||||
sprite = 'utility/force_editor_icon',
|
sprite = 'utility/force_editor_icon',
|
||||||
tooltip = 'Report ' .. cell_data.name
|
tooltip = {'player_list.report_button_tooltip', cell_data.name}
|
||||||
}
|
}
|
||||||
local label_style = label.style
|
local label_style = label.style
|
||||||
label_style.horizontal_align = 'center'
|
label_style.horizontal_align = 'center'
|
||||||
@ -477,9 +485,7 @@ local function redraw_title(data)
|
|||||||
local online_count = #game.connected_players
|
local online_count = #game.connected_players
|
||||||
local total_count = PlayerStats.get_total_player_count()
|
local total_count = PlayerStats.get_total_player_count()
|
||||||
|
|
||||||
local title = table.concat {'Player list - Online: ', online_count, ' Total: ' .. total_count}
|
frame.caption = {'player_list.title', online_count, total_count}
|
||||||
|
|
||||||
frame.caption = title
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function redraw_headings(data)
|
local function redraw_headings(data)
|
||||||
@ -488,25 +494,20 @@ local function redraw_headings(data)
|
|||||||
local sort = settings.sort
|
local sort = settings.sort
|
||||||
local sort_column = math.abs(sort)
|
local sort_column = math.abs(sort)
|
||||||
|
|
||||||
local sort_symbol
|
|
||||||
if sort > 0 then
|
|
||||||
sort_symbol = symbol_asc
|
|
||||||
else
|
|
||||||
sort_symbol = symbol_desc
|
|
||||||
end
|
|
||||||
|
|
||||||
local heading_table_flow = data.heading_table_flow
|
local heading_table_flow = data.heading_table_flow
|
||||||
Gui.clear(heading_table_flow)
|
Gui.clear(heading_table_flow)
|
||||||
|
|
||||||
local heading_table = heading_table_flow.add {type = 'table', column_count = #columns}
|
local heading_table = heading_table_flow.add {type = 'table', column_count = #columns}
|
||||||
|
|
||||||
for i, c in ipairs(settings.columns) do
|
for i, c in ipairs(settings.columns) do
|
||||||
local heading = column_builders[c].draw_heading(heading_table, data)
|
local sort_symbol = ''
|
||||||
|
|
||||||
if i == sort_column then
|
if i == sort_column then
|
||||||
heading.caption = heading.caption .. sort_symbol
|
sort_symbol = sort > 0 and symbol_asc or symbol_desc
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local heading = column_builders[c].draw_heading(heading_table, data, sort_symbol)
|
||||||
|
|
||||||
Gui.set_data(heading, {data = data, index = i})
|
Gui.set_data(heading, {data = data, index = i})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -570,11 +571,11 @@ local function draw_main_frame(left, player)
|
|||||||
type = 'checkbox',
|
type = 'checkbox',
|
||||||
name = notify_checkbox_name,
|
name = notify_checkbox_name,
|
||||||
state = not no_notify_players[player_index],
|
state = not no_notify_players[player_index],
|
||||||
caption = 'Notify me when pokes happen.',
|
caption = {'player_list.poke_notify_caption'},
|
||||||
tooltip = 'Receive a message when a player pokes another player.'
|
tooltip = {'player_list.poke_notify_tooltip'}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.add {type = 'button', name = main_button_name, caption = 'Close'}
|
frame.add {type = 'button', name = main_button_name, caption = {'player_list.close_caption'}}
|
||||||
|
|
||||||
local settings = player_settings[player_index] or get_default_player_settings()
|
local settings = player_settings[player_index] or get_default_player_settings()
|
||||||
local data = {
|
local data = {
|
||||||
|
@ -45,3 +45,19 @@ whats_new_button=What's New
|
|||||||
[toast]
|
[toast]
|
||||||
toast_all=__1__ sent a toast to all players.
|
toast_all=__1__ sent a toast to all players.
|
||||||
toast_player=__1__ sent a toast to __2__.
|
toast_player=__1__ sent a toast to __2__.
|
||||||
|
|
||||||
|
[player_list]
|
||||||
|
title=Player list - Online: __1__ Total: __2__
|
||||||
|
name_caption=Name __1__
|
||||||
|
time_caption=Time __1__
|
||||||
|
rank_caption=Rank __1__
|
||||||
|
distance_caption=Distance __1__
|
||||||
|
coins_caption=Coins __1__
|
||||||
|
deaths_caption=Deaths __1__
|
||||||
|
poke_caption=Poke __1__
|
||||||
|
report_caption=Report __1__
|
||||||
|
report_tooltip=Report player to the admin team for griefing or breaking the rules.
|
||||||
|
report_button_tooltip=Report __1__
|
||||||
|
close_caption=Close
|
||||||
|
poke_notify_caption=Notify me when pokes happen.
|
||||||
|
poke_notify_tooltip=Receive a message when a player pokes another player.
|
@ -45,3 +45,19 @@ whats_new_button=Что нового
|
|||||||
[toast]
|
[toast]
|
||||||
toast_all=__1__ sent a toast to all players.
|
toast_all=__1__ sent a toast to all players.
|
||||||
toast_player=__1__ sent a toast to __2__.
|
toast_player=__1__ sent a toast to __2__.
|
||||||
|
|
||||||
|
[player_list]
|
||||||
|
title=Список игроков - В игре: __1__ Всего: __2__
|
||||||
|
name_caption=Имя __1__
|
||||||
|
time_caption=Время __1__
|
||||||
|
rank_caption=Ранг __1__
|
||||||
|
distance_caption=Дистанция __1__
|
||||||
|
coins_caption=Монеты __1__
|
||||||
|
deaths_caption=Смерти __1__
|
||||||
|
poke_caption=Ткнуть __1__
|
||||||
|
report_caption=Жалоба __1__
|
||||||
|
report_tooltip=Сообщить администраторам о грифинге или нарушении правил.
|
||||||
|
report_button_tooltip=Пожаловаться на __1__
|
||||||
|
close_caption=Закрыть
|
||||||
|
poke_notify_caption=Сообщать мне когда кого-то ткнули.
|
||||||
|
poke_notify_tooltip=Отправлять сообщение когда один игрок ткнул другого.
|
Loading…
Reference in New Issue
Block a user