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

Renamespace localisation strings to fa.* #229

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,12 @@ function read_hand(pindex)
printout(fa_localising.get(cursor_stack, pindex) .. remote_info, pindex)
else
--Any other valid item
local out = { "access.cursor-description" }
local out = { "fa.cursor-description" }
table.insert(out, cursor_stack.prototype.localised_name)
local build_entity = cursor_stack.prototype.place_result
if build_entity and build_entity.supports_direction then
table.insert(out, 1)
table.insert(out, { "access.facing-direction", players[pindex].building_direction })
table.insert(out, { "fa.facing-direction", players[pindex].building_direction })
else
table.insert(out, 0)
table.insert(out, "")
Expand All @@ -378,12 +378,12 @@ function read_hand(pindex)
end
elseif cursor_ghost ~= nil then
--Any ghost
local out = { "access.cursor-description" }
local out = { "fa.cursor-description" }
table.insert(out, cursor_ghost.localised_name)
local build_entity = cursor_ghost.place_result
if build_entity and build_entity.supports_direction then
table.insert(out, 1)
table.insert(out, { "access.facing-direction", players[pindex].building_direction })
table.insert(out, { "fa.facing-direction", players[pindex].building_direction })
else
table.insert(out, 0)
table.insert(out, "")
Expand All @@ -397,7 +397,7 @@ function read_hand(pindex)
end
printout(out, pindex)
else
printout({ "access.empty_cursor" }, pindex)
printout({ "fa.empty_cursor" }, pindex)
end
end

Expand Down Expand Up @@ -2930,7 +2930,7 @@ script.on_event("read-cursor-distance-and-direction", function(event)
local cursor_location_description = "At"
local cursor_production = " "
local cursor_description_of = " "
local result = { "access.thing-producing-listpos-dirdist", cursor_location_description }
local result = { "fa.thing-producing-listpos-dirdist", cursor_location_description }
table.insert(result, cursor_production) --no production
table.insert(result, cursor_description_of) --listpos
table.insert(result, dir_dist)
Expand Down Expand Up @@ -4821,7 +4821,7 @@ script.on_event("click-menu", function(event)
fa_graphics.draw_cursor_highlight(pindex, ent, nil)
fa_graphics.sync_build_cursor_graphics(pindex)
printout({
"access.teleported-cursor-to",
"fa.teleported-cursor-to",
"" .. math.floor(players[pindex].cursor_pos.x) .. " " .. math.floor(players[pindex].cursor_pos.y),
}, pindex)
-- players[pindex].menu = ""
Expand Down Expand Up @@ -5683,28 +5683,28 @@ function do_multi_stack_transfer(ratio, pindex)
table.insert(result, ", ")
end
if table_size(moved) == 0 then
table.insert(result, { "access.grabbed-nothing" })
table.insert(result, { "fa.grabbed-nothing" })
else
game.get_player(pindex).play_sound({ path = "utility/inventory_move" })
local item_list = { "" }
local other_items = 0
local listed_count = 0
for name, amount in pairs(moved) do
if listed_count <= 5 then
table.insert(item_list, { "access.item-quantity", game.item_prototypes[name].localised_name, amount })
table.insert(item_list, { "fa.item-quantity", game.item_prototypes[name].localised_name, amount })
table.insert(item_list, ", ")
else
other_items = other_items + amount
end
listed_count = listed_count + 1
end
if other_items > 0 then
table.insert(item_list, { "access.item-quantity", "other items", other_items }) --***todo localize "other items
table.insert(item_list, { "fa.item-quantity", "other items", other_items }) --***todo localize "other items
table.insert(item_list, ", ")
end
--trim traling comma off
item_list[#item_list] = nil
table.insert(result, { "access.grabbed-stuff", item_list })
table.insert(result, { "fa.grabbed-stuff", item_list })
end
elseif sector and sector.name == "fluid" then
--Do nothing
Expand All @@ -5727,7 +5727,7 @@ function do_multi_stack_transfer(ratio, pindex)

if table_size(moved) == 0 then
if full then table.insert(result, "Inventory full or not applicable, ") end
table.insert(result, { "access.placed-nothing" })
table.insert(result, { "fa.placed-nothing" })
else
if full then table.insert(result, "Partial success, ") end
game.get_player(pindex).play_sound({ path = "utility/inventory_move" })
Expand All @@ -5736,20 +5736,20 @@ function do_multi_stack_transfer(ratio, pindex)
local listed_count = 0
for name, amount in pairs(moved) do
if listed_count <= 5 then
table.insert(item_list, { "access.item-quantity", game.item_prototypes[name].localised_name, amount })
table.insert(item_list, { "fa.item-quantity", game.item_prototypes[name].localised_name, amount })
table.insert(item_list, ", ")
else
other_items = other_items + amount
end
listed_count = listed_count + 1
end
if other_items > 0 then
table.insert(item_list, { "access.item-quantity", "other items", other_items }) --***todo localize "other items
table.insert(item_list, { "fa.item-quantity", "other items", other_items }) --***todo localize "other items
table.insert(item_list, ", ")
end
--trim trailing comma off
item_list[#item_list] = nil
table.insert(result, { "access.placed-stuff", fa_utils.breakup_string(item_list) })
table.insert(result, { "fa.placed-stuff", fa_utils.breakup_string(item_list) })
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion locale/en/factorio-access.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#all keys should be part of category to not pollute the main namespace
[access]
[fa]
#direction
#eg North
direction=__plural_for_parameter_1_{0=North|1=NorthEast|2=East|3=SouthEast|4=South|5=SouthWest|6=West|7=NorthWest|rest=}__
Expand Down
6 changes: 3 additions & 3 deletions scripts/building-tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ function mod.nudge_key(direction, event)
temporary_teleported = ent.teleport({ 0, 0 })
if not temporary_teleported then
game.get_player(pindex).play_sound({ path = "utility/cannot_build" })
printout({ "access.failed-to-nudge" }, pindex)
printout({ "fa.failed-to-nudge" }, pindex)
return
end

Expand All @@ -535,11 +535,11 @@ function mod.nudge_key(direction, event)
end
if not actually_teleported then
--Failed to teleport
printout({ "access.failed-to-nudge" }, pindex)
printout({ "fa.failed-to-nudge" }, pindex)
return
else
--Successfully teleported and so nudged
printout({ "access.nudged-one-direction", { "access.direction", direction } }, pindex)
printout({ "fa.nudged-one-direction", { "fa.direction", direction } }, pindex)
if players[pindex].cursor then
players[pindex].cursor_pos = fa_utils.offset_position(players[pindex].cursor_pos, direction, 1)
fa_graphics.draw_cursor_highlight(pindex, ent, "train-visualization")
Expand Down
6 changes: 3 additions & 3 deletions scripts/building-vehicle-sectors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function mod.add_to_inventory_bar(ent, amount)
local inventory = ent.get_inventory(defines.inventory.chest)

--Checks
if not inventory then return { "access.failed-inventory-limit-ajust-notcontainter" } end
if not inventory.supports_bar() then return { "access.failed-inventory-limit-ajust-no-limit" } end
if not inventory then return { "fa.failed-inventory-limit-ajust-notcontainter" } end
if not inventory.supports_bar() then return { "fa.failed-inventory-limit-ajust-no-limit" } end

local max_bar = #inventory + 1
local current_bar = inventory.get_bar()
Expand All @@ -43,7 +43,7 @@ function mod.add_to_inventory_bar(ent, amount)
else
current_bar = value
end
return { "access.inventory-limit-status", value, current_bar }
return { "fa.inventory-limit-status", value, current_bar }
end

--Increases the selected inserter's hand stack size by 1
Expand Down
8 changes: 4 additions & 4 deletions scripts/fa-info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1437,9 +1437,9 @@ function mod.read_selected_entity_status(pindex)

--Entity Health
if ent.is_entity_with_health and ent.get_health_ratio() == 1 then
table.insert(result, { "access.full-health" })
table.insert(result, { "fa.full-health" })
elseif ent.is_entity_with_health then
table.insert(result, { "access.percent-health", math.floor(ent.get_health_ratio() * 100) })
table.insert(result, { "fa.percent-health", math.floor(ent.get_health_ratio() * 100) })
end

-- Report nearest rail intersection position -- laterdo find better keybind
Expand Down Expand Up @@ -1497,9 +1497,9 @@ function mod.read_character_status(pindex)
end
--Character health
if char.is_entity_with_health and char.get_health_ratio() == 1 then
table.insert(result, { "access.full-health" })
table.insert(result, { "fa.full-health" })
elseif char.is_entity_with_health then
table.insert(result, { "access.percent-health", math.floor(char.get_health_ratio() * 100) })
table.insert(result, { "fa.percent-health", math.floor(char.get_health_ratio() * 100) })
end
printout(result, pindex)
return
Expand Down
4 changes: 2 additions & 2 deletions scripts/fa-utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ function mod.dir_dist_locale(pos1, pos2)
local dir_dist = mod.dir_dist(pos1, pos2)
local aligned_note = ""
if mod.is_direction_aligned(pos1, pos2) then aligned_note = "aligned " end
return { "access.dir-dist", aligned_note .. mod.direction_lookup(dir_dist[1]), math.floor(dir_dist[2] + 0.5) }
return { "fa.dir-dist", aligned_note .. mod.direction_lookup(dir_dist[1]), math.floor(dir_dist[2] + 0.5) }
end

function mod.ent_name_locale(ent)
Expand All @@ -701,7 +701,7 @@ function mod.ent_name_locale(ent)
end
if ent.name == "forest" then
print("todo: forest isn't an entity")
return { "access.forest" }
return { "fa.forest" }
end
local entity_prototype = game.entity_prototypes[ent.name]
local resource_prototype = game.resource_category_prototypes[ent.name]
Expand Down
14 changes: 7 additions & 7 deletions scripts/kruise-kontrol-wrapper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function mod.activate_kk(pindex)

local hand = p.cursor_stack
if hand and hand.valid_for_read and (hand.name == "blueprint" or hand.name == "blueprint-book") then
return { "access.kk-blueprints-not-allowed" }
return { "fa.kk-blueprints-not-allowed" }
end

-- Okay. Finally we're good. Let's kick this off.
Expand All @@ -63,10 +63,10 @@ function mod.activate_kk(pindex)

remote.call(interface_name, "start_job", pindex, { x = math.floor(kk_pos.x), y = math.floor(kk_pos.y) }, target)
local desc = remote.call(interface_name, "get_description", pindex)
if not desc then return { "access.kk-not-started" } end
if not desc then return { "fa.kk-not-started" } end

return { "access.kk-start", desc }
end, { "access.kk-not-available" })
return { "fa.kk-start", desc }
end, { "fa.kk-not-available" })

printout(announcing, pindex)
end
Expand All @@ -90,7 +90,7 @@ function mod.cancel_kk(pindex)
-- cursor mode.
fix_walk(pindex)

printout({ "access.kk-cancel" }, pindex)
printout({ "fa.kk-cancel" }, pindex)
end)
end

Expand All @@ -102,9 +102,9 @@ function mod.status_read(pindex, short_version)
local was_active = players[pindex].kruise_kontrol_active_last_time
players[pindex].kruise_kontrol_active_last_time = active
if active then
printout({ "access.kk-state", remote.call(interface_name, "get_description", pindex) }, pindex)
printout({ "fa.kk-state", remote.call(interface_name, "get_description", pindex) }, pindex)
elseif not active and was_active then
printout({ "access.kk-done" }, pindex)
printout({ "fa.kk-done" }, pindex)
end
end)
end
Expand Down
6 changes: 3 additions & 3 deletions scripts/scanner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ function mod.list_index(pindex)
local dir_dist = fa_utils.dir_dist_locale(p.position, players[pindex].cursor_pos)
if players[pindex].nearby.count == false then
--Read the entity in terms of distance and direction, taking the cursor position as the reference point
local result = { "access.thing-producing-listpos-dirdist", fa_utils.ent_name_locale(ent) }
local result = { "fa.thing-producing-listpos-dirdist", fa_utils.ent_name_locale(ent) }
table.insert(result, mod.ent_extra_list_info(ent, pindex, true))
table.insert(
result,
Expand All @@ -794,8 +794,8 @@ function mod.list_index(pindex)
else
--Read the entity in terms of count, and give the direction and distance of an example
local result = {
"access.item_and_quantity-example-at-dirdist",
{ "access.item-quantity", fa_utils.ent_name_locale(ent), ents[players[pindex].nearby.index].count },
"fa.item_and_quantity-example-at-dirdist",
{ "fa.item-quantity", fa_utils.ent_name_locale(ent), ents[players[pindex].nearby.index].count },
dir_dist,
}
local final_result = { "" }
Expand Down