1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-28 00:59:31 +00:00

Translation system first draft

This commit is contained in:
Étienne Fildadut 2023-12-23 21:09:12 +01:00
parent ffadc0dd69
commit c4636343b4
15 changed files with 215 additions and 18 deletions

View file

@ -44,6 +44,9 @@ traverse = {
end,
hash = function(self, t)
table.insert(t, self:hash())
end,
list_translatable = function(self, t)
self:list_translatable(t)
end
}
@ -119,6 +122,15 @@ Node = class {
self:traverse(traverse.prepare, state)
end,
-- generate a list of translatable nodes that appear in this node
-- should only be called on non-runtime nodes
-- if a node is translatable, redefine this to add it to the table - note that it shouldn't call :traverse or :list_translatable on its children, as nested translations should not be needed
list_translatable = function(self, t)
t = t or {}
self:traverse(traverse.list_translatable, t)
return t
end,
-- same as eval, but make the evaluated expression as a resume boundary
-- i.e. if a checkpoint is defined somewhere in this eval, it will start back from this node eval when resuming
eval_resumable = function(self, state)